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                     "SELECT resourceCode FROM ResourceCode resourceCode WHERE ");
422 
423                 query.append("resourceCode.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                     "SELECT resourceCode FROM ResourceCode resourceCode WHERE ");
481 
482                 query.append("resourceCode.companyId = ?");
483 
484                 query.append(" ");
485 
486                 if (obc != null) {
487                     query.append("ORDER BY ");
488 
489                     String[] orderByFields = obc.getOrderByFields();
490 
491                     for (int i = 0; i < orderByFields.length; i++) {
492                         query.append("resourceCode.");
493                         query.append(orderByFields[i]);
494 
495                         if (obc.isAscending()) {
496                             query.append(" ASC");
497                         }
498                         else {
499                             query.append(" DESC");
500                         }
501 
502                         if ((i + 1) < orderByFields.length) {
503                             query.append(", ");
504                         }
505                     }
506                 }
507 
508                 Query q = session.createQuery(query.toString());
509 
510                 QueryPos qPos = QueryPos.getInstance(q);
511 
512                 qPos.add(companyId);
513 
514                 list = (List<ResourceCode>)QueryUtil.list(q, getDialect(),
515                         start, end);
516             }
517             catch (Exception e) {
518                 throw processException(e);
519             }
520             finally {
521                 if (list == null) {
522                     list = new ArrayList<ResourceCode>();
523                 }
524 
525                 cacheResult(list);
526 
527                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
528                     finderArgs, list);
529 
530                 closeSession(session);
531             }
532         }
533 
534         return list;
535     }
536 
537     public ResourceCode findByCompanyId_First(long companyId,
538         OrderByComparator obc)
539         throws NoSuchResourceCodeException, SystemException {
540         List<ResourceCode> list = findByCompanyId(companyId, 0, 1, obc);
541 
542         if (list.isEmpty()) {
543             StringBuilder msg = new StringBuilder();
544 
545             msg.append("No ResourceCode exists with the key {");
546 
547             msg.append("companyId=" + companyId);
548 
549             msg.append(StringPool.CLOSE_CURLY_BRACE);
550 
551             throw new NoSuchResourceCodeException(msg.toString());
552         }
553         else {
554             return list.get(0);
555         }
556     }
557 
558     public ResourceCode findByCompanyId_Last(long companyId,
559         OrderByComparator obc)
560         throws NoSuchResourceCodeException, SystemException {
561         int count = countByCompanyId(companyId);
562 
563         List<ResourceCode> list = findByCompanyId(companyId, count - 1, count,
564                 obc);
565 
566         if (list.isEmpty()) {
567             StringBuilder msg = new StringBuilder();
568 
569             msg.append("No ResourceCode exists with the key {");
570 
571             msg.append("companyId=" + companyId);
572 
573             msg.append(StringPool.CLOSE_CURLY_BRACE);
574 
575             throw new NoSuchResourceCodeException(msg.toString());
576         }
577         else {
578             return list.get(0);
579         }
580     }
581 
582     public ResourceCode[] findByCompanyId_PrevAndNext(long codeId,
583         long companyId, OrderByComparator obc)
584         throws NoSuchResourceCodeException, SystemException {
585         ResourceCode resourceCode = findByPrimaryKey(codeId);
586 
587         int count = countByCompanyId(companyId);
588 
589         Session session = null;
590 
591         try {
592             session = openSession();
593 
594             StringBuilder query = new StringBuilder();
595 
596             query.append(
597                 "SELECT resourceCode FROM ResourceCode resourceCode WHERE ");
598 
599             query.append("resourceCode.companyId = ?");
600 
601             query.append(" ");
602 
603             if (obc != null) {
604                 query.append("ORDER BY ");
605 
606                 String[] orderByFields = obc.getOrderByFields();
607 
608                 for (int i = 0; i < orderByFields.length; i++) {
609                     query.append("resourceCode.");
610                     query.append(orderByFields[i]);
611 
612                     if (obc.isAscending()) {
613                         query.append(" ASC");
614                     }
615                     else {
616                         query.append(" DESC");
617                     }
618 
619                     if ((i + 1) < orderByFields.length) {
620                         query.append(", ");
621                     }
622                 }
623             }
624 
625             Query q = session.createQuery(query.toString());
626 
627             QueryPos qPos = QueryPos.getInstance(q);
628 
629             qPos.add(companyId);
630 
631             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
632                     resourceCode);
633 
634             ResourceCode[] array = new ResourceCodeImpl[3];
635 
636             array[0] = (ResourceCode)objArray[0];
637             array[1] = (ResourceCode)objArray[1];
638             array[2] = (ResourceCode)objArray[2];
639 
640             return array;
641         }
642         catch (Exception e) {
643             throw processException(e);
644         }
645         finally {
646             closeSession(session);
647         }
648     }
649 
650     public List<ResourceCode> findByName(String name) throws SystemException {
651         Object[] finderArgs = new Object[] { name };
652 
653         List<ResourceCode> list = (List<ResourceCode>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_NAME,
654                 finderArgs, this);
655 
656         if (list == null) {
657             Session session = null;
658 
659             try {
660                 session = openSession();
661 
662                 StringBuilder query = new StringBuilder();
663 
664                 query.append(
665                     "SELECT resourceCode FROM ResourceCode resourceCode WHERE ");
666 
667                 if (name == null) {
668                     query.append("resourceCode.name IS NULL");
669                 }
670                 else {
671                     query.append("resourceCode.name = ?");
672                 }
673 
674                 query.append(" ");
675 
676                 Query q = session.createQuery(query.toString());
677 
678                 QueryPos qPos = QueryPos.getInstance(q);
679 
680                 if (name != null) {
681                     qPos.add(name);
682                 }
683 
684                 list = q.list();
685             }
686             catch (Exception e) {
687                 throw processException(e);
688             }
689             finally {
690                 if (list == null) {
691                     list = new ArrayList<ResourceCode>();
692                 }
693 
694                 cacheResult(list);
695 
696                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_NAME, finderArgs,
697                     list);
698 
699                 closeSession(session);
700             }
701         }
702 
703         return list;
704     }
705 
706     public List<ResourceCode> findByName(String name, int start, int end)
707         throws SystemException {
708         return findByName(name, start, end, null);
709     }
710 
711     public List<ResourceCode> findByName(String name, int start, int end,
712         OrderByComparator obc) throws SystemException {
713         Object[] finderArgs = new Object[] {
714                 name,
715                 
716                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
717             };
718 
719         List<ResourceCode> list = (List<ResourceCode>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_NAME,
720                 finderArgs, this);
721 
722         if (list == null) {
723             Session session = null;
724 
725             try {
726                 session = openSession();
727 
728                 StringBuilder query = new StringBuilder();
729 
730                 query.append(
731                     "SELECT resourceCode FROM ResourceCode resourceCode WHERE ");
732 
733                 if (name == null) {
734                     query.append("resourceCode.name IS NULL");
735                 }
736                 else {
737                     query.append("resourceCode.name = ?");
738                 }
739 
740                 query.append(" ");
741 
742                 if (obc != null) {
743                     query.append("ORDER BY ");
744 
745                     String[] orderByFields = obc.getOrderByFields();
746 
747                     for (int i = 0; i < orderByFields.length; i++) {
748                         query.append("resourceCode.");
749                         query.append(orderByFields[i]);
750 
751                         if (obc.isAscending()) {
752                             query.append(" ASC");
753                         }
754                         else {
755                             query.append(" DESC");
756                         }
757 
758                         if ((i + 1) < orderByFields.length) {
759                             query.append(", ");
760                         }
761                     }
762                 }
763 
764                 Query q = session.createQuery(query.toString());
765 
766                 QueryPos qPos = QueryPos.getInstance(q);
767 
768                 if (name != null) {
769                     qPos.add(name);
770                 }
771 
772                 list = (List<ResourceCode>)QueryUtil.list(q, getDialect(),
773                         start, end);
774             }
775             catch (Exception e) {
776                 throw processException(e);
777             }
778             finally {
779                 if (list == null) {
780                     list = new ArrayList<ResourceCode>();
781                 }
782 
783                 cacheResult(list);
784 
785                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_NAME,
786                     finderArgs, list);
787 
788                 closeSession(session);
789             }
790         }
791 
792         return list;
793     }
794 
795     public ResourceCode findByName_First(String name, OrderByComparator obc)
796         throws NoSuchResourceCodeException, SystemException {
797         List<ResourceCode> list = findByName(name, 0, 1, obc);
798 
799         if (list.isEmpty()) {
800             StringBuilder msg = new StringBuilder();
801 
802             msg.append("No ResourceCode exists with the key {");
803 
804             msg.append("name=" + name);
805 
806             msg.append(StringPool.CLOSE_CURLY_BRACE);
807 
808             throw new NoSuchResourceCodeException(msg.toString());
809         }
810         else {
811             return list.get(0);
812         }
813     }
814 
815     public ResourceCode findByName_Last(String name, OrderByComparator obc)
816         throws NoSuchResourceCodeException, SystemException {
817         int count = countByName(name);
818 
819         List<ResourceCode> list = findByName(name, count - 1, count, obc);
820 
821         if (list.isEmpty()) {
822             StringBuilder msg = new StringBuilder();
823 
824             msg.append("No ResourceCode exists with the key {");
825 
826             msg.append("name=" + name);
827 
828             msg.append(StringPool.CLOSE_CURLY_BRACE);
829 
830             throw new NoSuchResourceCodeException(msg.toString());
831         }
832         else {
833             return list.get(0);
834         }
835     }
836 
837     public ResourceCode[] findByName_PrevAndNext(long codeId, String name,
838         OrderByComparator obc)
839         throws NoSuchResourceCodeException, SystemException {
840         ResourceCode resourceCode = findByPrimaryKey(codeId);
841 
842         int count = countByName(name);
843 
844         Session session = null;
845 
846         try {
847             session = openSession();
848 
849             StringBuilder query = new StringBuilder();
850 
851             query.append(
852                 "SELECT resourceCode FROM ResourceCode resourceCode WHERE ");
853 
854             if (name == null) {
855                 query.append("resourceCode.name IS NULL");
856             }
857             else {
858                 query.append("resourceCode.name = ?");
859             }
860 
861             query.append(" ");
862 
863             if (obc != null) {
864                 query.append("ORDER BY ");
865 
866                 String[] orderByFields = obc.getOrderByFields();
867 
868                 for (int i = 0; i < orderByFields.length; i++) {
869                     query.append("resourceCode.");
870                     query.append(orderByFields[i]);
871 
872                     if (obc.isAscending()) {
873                         query.append(" ASC");
874                     }
875                     else {
876                         query.append(" DESC");
877                     }
878 
879                     if ((i + 1) < orderByFields.length) {
880                         query.append(", ");
881                     }
882                 }
883             }
884 
885             Query q = session.createQuery(query.toString());
886 
887             QueryPos qPos = QueryPos.getInstance(q);
888 
889             if (name != null) {
890                 qPos.add(name);
891             }
892 
893             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
894                     resourceCode);
895 
896             ResourceCode[] array = new ResourceCodeImpl[3];
897 
898             array[0] = (ResourceCode)objArray[0];
899             array[1] = (ResourceCode)objArray[1];
900             array[2] = (ResourceCode)objArray[2];
901 
902             return array;
903         }
904         catch (Exception e) {
905             throw processException(e);
906         }
907         finally {
908             closeSession(session);
909         }
910     }
911 
912     public ResourceCode findByC_N_S(long companyId, String name, int scope)
913         throws NoSuchResourceCodeException, SystemException {
914         ResourceCode resourceCode = fetchByC_N_S(companyId, name, scope);
915 
916         if (resourceCode == null) {
917             StringBuilder msg = new StringBuilder();
918 
919             msg.append("No ResourceCode exists with the key {");
920 
921             msg.append("companyId=" + companyId);
922 
923             msg.append(", ");
924             msg.append("name=" + name);
925 
926             msg.append(", ");
927             msg.append("scope=" + scope);
928 
929             msg.append(StringPool.CLOSE_CURLY_BRACE);
930 
931             if (_log.isWarnEnabled()) {
932                 _log.warn(msg.toString());
933             }
934 
935             throw new NoSuchResourceCodeException(msg.toString());
936         }
937 
938         return resourceCode;
939     }
940 
941     public ResourceCode fetchByC_N_S(long companyId, String name, int scope)
942         throws SystemException {
943         return fetchByC_N_S(companyId, name, scope, true);
944     }
945 
946     public ResourceCode fetchByC_N_S(long companyId, String name, int scope,
947         boolean retrieveFromCache) throws SystemException {
948         Object[] finderArgs = new Object[] {
949                 new Long(companyId),
950                 
951                 name, new Integer(scope)
952             };
953 
954         Object result = null;
955 
956         if (retrieveFromCache) {
957             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_N_S,
958                     finderArgs, this);
959         }
960 
961         if (result == null) {
962             Session session = null;
963 
964             try {
965                 session = openSession();
966 
967                 StringBuilder query = new StringBuilder();
968 
969                 query.append(
970                     "SELECT resourceCode FROM ResourceCode resourceCode WHERE ");
971 
972                 query.append("resourceCode.companyId = ?");
973 
974                 query.append(" AND ");
975 
976                 if (name == null) {
977                     query.append("resourceCode.name IS NULL");
978                 }
979                 else {
980                     query.append("resourceCode.name = ?");
981                 }
982 
983                 query.append(" AND ");
984 
985                 query.append("resourceCode.scope = ?");
986 
987                 query.append(" ");
988 
989                 Query q = session.createQuery(query.toString());
990 
991                 QueryPos qPos = QueryPos.getInstance(q);
992 
993                 qPos.add(companyId);
994 
995                 if (name != null) {
996                     qPos.add(name);
997                 }
998 
999                 qPos.add(scope);
1000
1001                List<ResourceCode> list = q.list();
1002
1003                result = list;
1004
1005                ResourceCode resourceCode = null;
1006
1007                if (list.isEmpty()) {
1008                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N_S,
1009                        finderArgs, list);
1010                }
1011                else {
1012                    resourceCode = list.get(0);
1013
1014                    cacheResult(resourceCode);
1015
1016                    if ((resourceCode.getCompanyId() != companyId) ||
1017                            (resourceCode.getName() == null) ||
1018                            !resourceCode.getName().equals(name) ||
1019                            (resourceCode.getScope() != scope)) {
1020                        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N_S,
1021                            finderArgs, resourceCode);
1022                    }
1023                }
1024
1025                return resourceCode;
1026            }
1027            catch (Exception e) {
1028                throw processException(e);
1029            }
1030            finally {
1031                if (result == null) {
1032                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N_S,
1033                        finderArgs, new ArrayList<ResourceCode>());
1034                }
1035
1036                closeSession(session);
1037            }
1038        }
1039        else {
1040            if (result instanceof List) {
1041                return null;
1042            }
1043            else {
1044                return (ResourceCode)result;
1045            }
1046        }
1047    }
1048
1049    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
1050        throws SystemException {
1051        Session session = null;
1052
1053        try {
1054            session = openSession();
1055
1056            dynamicQuery.compile(session);
1057
1058            return dynamicQuery.list();
1059        }
1060        catch (Exception e) {
1061            throw processException(e);
1062        }
1063        finally {
1064            closeSession(session);
1065        }
1066    }
1067
1068    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
1069        int start, int end) throws SystemException {
1070        Session session = null;
1071
1072        try {
1073            session = openSession();
1074
1075            dynamicQuery.setLimit(start, end);
1076
1077            dynamicQuery.compile(session);
1078
1079            return dynamicQuery.list();
1080        }
1081        catch (Exception e) {
1082            throw processException(e);
1083        }
1084        finally {
1085            closeSession(session);
1086        }
1087    }
1088
1089    public List<ResourceCode> findAll() throws SystemException {
1090        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1091    }
1092
1093    public List<ResourceCode> findAll(int start, int end)
1094        throws SystemException {
1095        return findAll(start, end, null);
1096    }
1097
1098    public List<ResourceCode> findAll(int start, int end, OrderByComparator obc)
1099        throws SystemException {
1100        Object[] finderArgs = new Object[] {
1101                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1102            };
1103
1104        List<ResourceCode> list = (List<ResourceCode>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1105                finderArgs, this);
1106
1107        if (list == null) {
1108            Session session = null;
1109
1110            try {
1111                session = openSession();
1112
1113                StringBuilder query = new StringBuilder();
1114
1115                query.append(
1116                    "SELECT resourceCode FROM ResourceCode resourceCode ");
1117
1118                if (obc != null) {
1119                    query.append("ORDER BY ");
1120
1121                    String[] orderByFields = obc.getOrderByFields();
1122
1123                    for (int i = 0; i < orderByFields.length; i++) {
1124                        query.append("resourceCode.");
1125                        query.append(orderByFields[i]);
1126
1127                        if (obc.isAscending()) {
1128                            query.append(" ASC");
1129                        }
1130                        else {
1131                            query.append(" DESC");
1132                        }
1133
1134                        if ((i + 1) < orderByFields.length) {
1135                            query.append(", ");
1136                        }
1137                    }
1138                }
1139
1140                Query q = session.createQuery(query.toString());
1141
1142                if (obc == null) {
1143                    list = (List<ResourceCode>)QueryUtil.list(q, getDialect(),
1144                            start, end, false);
1145
1146                    Collections.sort(list);
1147                }
1148                else {
1149                    list = (List<ResourceCode>)QueryUtil.list(q, getDialect(),
1150                            start, end);
1151                }
1152            }
1153            catch (Exception e) {
1154                throw processException(e);
1155            }
1156            finally {
1157                if (list == null) {
1158                    list = new ArrayList<ResourceCode>();
1159                }
1160
1161                cacheResult(list);
1162
1163                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1164
1165                closeSession(session);
1166            }
1167        }
1168
1169        return list;
1170    }
1171
1172    public void removeByCompanyId(long companyId) throws SystemException {
1173        for (ResourceCode resourceCode : findByCompanyId(companyId)) {
1174            remove(resourceCode);
1175        }
1176    }
1177
1178    public void removeByName(String name) throws SystemException {
1179        for (ResourceCode resourceCode : findByName(name)) {
1180            remove(resourceCode);
1181        }
1182    }
1183
1184    public void removeByC_N_S(long companyId, String name, int scope)
1185        throws NoSuchResourceCodeException, SystemException {
1186        ResourceCode resourceCode = findByC_N_S(companyId, name, scope);
1187
1188        remove(resourceCode);
1189    }
1190
1191    public void removeAll() throws SystemException {
1192        for (ResourceCode resourceCode : findAll()) {
1193            remove(resourceCode);
1194        }
1195    }
1196
1197    public int countByCompanyId(long companyId) throws SystemException {
1198        Object[] finderArgs = new Object[] { new Long(companyId) };
1199
1200        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
1201                finderArgs, this);
1202
1203        if (count == null) {
1204            Session session = null;
1205
1206            try {
1207                session = openSession();
1208
1209                StringBuilder query = new StringBuilder();
1210
1211                query.append("SELECT COUNT(resourceCode) ");
1212                query.append("FROM ResourceCode resourceCode WHERE ");
1213
1214                query.append("resourceCode.companyId = ?");
1215
1216                query.append(" ");
1217
1218                Query q = session.createQuery(query.toString());
1219
1220                QueryPos qPos = QueryPos.getInstance(q);
1221
1222                qPos.add(companyId);
1223
1224                count = (Long)q.uniqueResult();
1225            }
1226            catch (Exception e) {
1227                throw processException(e);
1228            }
1229            finally {
1230                if (count == null) {
1231                    count = Long.valueOf(0);
1232                }
1233
1234                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
1235                    finderArgs, count);
1236
1237                closeSession(session);
1238            }
1239        }
1240
1241        return count.intValue();
1242    }
1243
1244    public int countByName(String name) throws SystemException {
1245        Object[] finderArgs = new Object[] { name };
1246
1247        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_NAME,
1248                finderArgs, this);
1249
1250        if (count == null) {
1251            Session session = null;
1252
1253            try {
1254                session = openSession();
1255
1256                StringBuilder query = new StringBuilder();
1257
1258                query.append("SELECT COUNT(resourceCode) ");
1259                query.append("FROM ResourceCode resourceCode WHERE ");
1260
1261                if (name == null) {
1262                    query.append("resourceCode.name IS NULL");
1263                }
1264                else {
1265                    query.append("resourceCode.name = ?");
1266                }
1267
1268                query.append(" ");
1269
1270                Query q = session.createQuery(query.toString());
1271
1272                QueryPos qPos = QueryPos.getInstance(q);
1273
1274                if (name != null) {
1275                    qPos.add(name);
1276                }
1277
1278                count = (Long)q.uniqueResult();
1279            }
1280            catch (Exception e) {
1281                throw processException(e);
1282            }
1283            finally {
1284                if (count == null) {
1285                    count = Long.valueOf(0);
1286                }
1287
1288                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_NAME,
1289                    finderArgs, count);
1290
1291                closeSession(session);
1292            }
1293        }
1294
1295        return count.intValue();
1296    }
1297
1298    public int countByC_N_S(long companyId, String name, int scope)
1299        throws SystemException {
1300        Object[] finderArgs = new Object[] {
1301                new Long(companyId),
1302                
1303                name, new Integer(scope)
1304            };
1305
1306        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_N_S,
1307                finderArgs, this);
1308
1309        if (count == null) {
1310            Session session = null;
1311
1312            try {
1313                session = openSession();
1314
1315                StringBuilder query = new StringBuilder();
1316
1317                query.append("SELECT COUNT(resourceCode) ");
1318                query.append("FROM ResourceCode resourceCode WHERE ");
1319
1320                query.append("resourceCode.companyId = ?");
1321
1322                query.append(" AND ");
1323
1324                if (name == null) {
1325                    query.append("resourceCode.name IS NULL");
1326                }
1327                else {
1328                    query.append("resourceCode.name = ?");
1329                }
1330
1331                query.append(" AND ");
1332
1333                query.append("resourceCode.scope = ?");
1334
1335                query.append(" ");
1336
1337                Query q = session.createQuery(query.toString());
1338
1339                QueryPos qPos = QueryPos.getInstance(q);
1340
1341                qPos.add(companyId);
1342
1343                if (name != null) {
1344                    qPos.add(name);
1345                }
1346
1347                qPos.add(scope);
1348
1349                count = (Long)q.uniqueResult();
1350            }
1351            catch (Exception e) {
1352                throw processException(e);
1353            }
1354            finally {
1355                if (count == null) {
1356                    count = Long.valueOf(0);
1357                }
1358
1359                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_N_S,
1360                    finderArgs, count);
1361
1362                closeSession(session);
1363            }
1364        }
1365
1366        return count.intValue();
1367    }
1368
1369    public int countAll() throws SystemException {
1370        Object[] finderArgs = new Object[0];
1371
1372        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1373                finderArgs, this);
1374
1375        if (count == null) {
1376            Session session = null;
1377
1378            try {
1379                session = openSession();
1380
1381                Query q = session.createQuery(
1382                        "SELECT COUNT(resourceCode) FROM ResourceCode resourceCode");
1383
1384                count = (Long)q.uniqueResult();
1385            }
1386            catch (Exception e) {
1387                throw processException(e);
1388            }
1389            finally {
1390                if (count == null) {
1391                    count = Long.valueOf(0);
1392                }
1393
1394                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1395                    count);
1396
1397                closeSession(session);
1398            }
1399        }
1400
1401        return count.intValue();
1402    }
1403
1404    public void afterPropertiesSet() {
1405        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1406                    com.liferay.portal.util.PropsUtil.get(
1407                        "value.object.listener.com.liferay.portal.model.ResourceCode")));
1408
1409        if (listenerClassNames.length > 0) {
1410            try {
1411                List<ModelListener<ResourceCode>> listenersList = new ArrayList<ModelListener<ResourceCode>>();
1412
1413                for (String listenerClassName : listenerClassNames) {
1414                    listenersList.add((ModelListener<ResourceCode>)Class.forName(
1415                            listenerClassName).newInstance());
1416                }
1417
1418                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1419            }
1420            catch (Exception e) {
1421                _log.error(e);
1422            }
1423        }
1424    }
1425
1426    @BeanReference(name = "com.liferay.portal.service.persistence.AccountPersistence.impl")
1427    protected com.liferay.portal.service.persistence.AccountPersistence accountPersistence;
1428    @BeanReference(name = "com.liferay.portal.service.persistence.AddressPersistence.impl")
1429    protected com.liferay.portal.service.persistence.AddressPersistence addressPersistence;
1430    @BeanReference(name = "com.liferay.portal.service.persistence.BrowserTrackerPersistence.impl")
1431    protected com.liferay.portal.service.persistence.BrowserTrackerPersistence browserTrackerPersistence;
1432    @BeanReference(name = "com.liferay.portal.service.persistence.ClassNamePersistence.impl")
1433    protected com.liferay.portal.service.persistence.ClassNamePersistence classNamePersistence;
1434    @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence.impl")
1435    protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
1436    @BeanReference(name = "com.liferay.portal.service.persistence.ContactPersistence.impl")
1437    protected com.liferay.portal.service.persistence.ContactPersistence contactPersistence;
1438    @BeanReference(name = "com.liferay.portal.service.persistence.CountryPersistence.impl")
1439    protected com.liferay.portal.service.persistence.CountryPersistence countryPersistence;
1440    @BeanReference(name = "com.liferay.portal.service.persistence.EmailAddressPersistence.impl")
1441    protected com.liferay.portal.service.persistence.EmailAddressPersistence emailAddressPersistence;
1442    @BeanReference(name = "com.liferay.portal.service.persistence.GroupPersistence.impl")
1443    protected com.liferay.portal.service.persistence.GroupPersistence groupPersistence;
1444    @BeanReference(name = "com.liferay.portal.service.persistence.ImagePersistence.impl")
1445    protected com.liferay.portal.service.persistence.ImagePersistence imagePersistence;
1446    @BeanReference(name = "com.liferay.portal.service.persistence.LayoutPersistence.impl")
1447    protected com.liferay.portal.service.persistence.LayoutPersistence layoutPersistence;
1448    @BeanReference(name = "com.liferay.portal.service.persistence.LayoutSetPersistence.impl")
1449    protected com.liferay.portal.service.persistence.LayoutSetPersistence layoutSetPersistence;
1450    @BeanReference(name = "com.liferay.portal.service.persistence.ListTypePersistence.impl")
1451    protected com.liferay.portal.service.persistence.ListTypePersistence listTypePersistence;
1452    @BeanReference(name = "com.liferay.portal.service.persistence.MembershipRequestPersistence.impl")
1453    protected com.liferay.portal.service.persistence.MembershipRequestPersistence membershipRequestPersistence;
1454    @BeanReference(name = "com.liferay.portal.service.persistence.OrganizationPersistence.impl")
1455    protected com.liferay.portal.service.persistence.OrganizationPersistence organizationPersistence;
1456    @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupPermissionPersistence.impl")
1457    protected com.liferay.portal.service.persistence.OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1458    @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupRolePersistence.impl")
1459    protected com.liferay.portal.service.persistence.OrgGroupRolePersistence orgGroupRolePersistence;
1460    @BeanReference(name = "com.liferay.portal.service.persistence.OrgLaborPersistence.impl")
1461    protected com.liferay.portal.service.persistence.OrgLaborPersistence orgLaborPersistence;
1462    @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyPersistence.impl")
1463    protected com.liferay.portal.service.persistence.PasswordPolicyPersistence passwordPolicyPersistence;
1464    @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyRelPersistence.impl")
1465    protected com.liferay.portal.service.persistence.PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1466    @BeanReference(name = "com.liferay.portal.service.persistence.PasswordTrackerPersistence.impl")
1467    protected com.liferay.portal.service.persistence.PasswordTrackerPersistence passwordTrackerPersistence;
1468    @BeanReference(name = "com.liferay.portal.service.persistence.PermissionPersistence.impl")
1469    protected com.liferay.portal.service.persistence.PermissionPersistence permissionPersistence;
1470    @BeanReference(name = "com.liferay.portal.service.persistence.PhonePersistence.impl")
1471    protected com.liferay.portal.service.persistence.PhonePersistence phonePersistence;
1472    @BeanReference(name = "com.liferay.portal.service.persistence.PluginSettingPersistence.impl")
1473    protected com.liferay.portal.service.persistence.PluginSettingPersistence pluginSettingPersistence;
1474    @BeanReference(name = "com.liferay.portal.service.persistence.PortletPersistence.impl")
1475    protected com.liferay.portal.service.persistence.PortletPersistence portletPersistence;
1476    @BeanReference(name = "com.liferay.portal.service.persistence.PortletItemPersistence.impl")
1477    protected com.liferay.portal.service.persistence.PortletItemPersistence portletItemPersistence;
1478    @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence.impl")
1479    protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
1480    @BeanReference(name = "com.liferay.portal.service.persistence.RegionPersistence.impl")
1481    protected com.liferay.portal.service.persistence.RegionPersistence regionPersistence;
1482    @BeanReference(name = "com.liferay.portal.service.persistence.ReleasePersistence.impl")
1483    protected com.liferay.portal.service.persistence.ReleasePersistence releasePersistence;
1484    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence.impl")
1485    protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
1486    @BeanReference(name = "com.liferay.portal.service.persistence.ResourceActionPersistence.impl")
1487    protected com.liferay.portal.service.persistence.ResourceActionPersistence resourceActionPersistence;
1488    @BeanReference(name = "com.liferay.portal.service.persistence.ResourceCodePersistence.impl")
1489    protected com.liferay.portal.service.persistence.ResourceCodePersistence resourceCodePersistence;
1490    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePermissionPersistence.impl")
1491    protected com.liferay.portal.service.persistence.ResourcePermissionPersistence resourcePermissionPersistence;
1492    @BeanReference(name = "com.liferay.portal.service.persistence.RolePersistence.impl")
1493    protected com.liferay.portal.service.persistence.RolePersistence rolePersistence;
1494    @BeanReference(name = "com.liferay.portal.service.persistence.ServiceComponentPersistence.impl")
1495    protected com.liferay.portal.service.persistence.ServiceComponentPersistence serviceComponentPersistence;
1496    @BeanReference(name = "com.liferay.portal.service.persistence.ShardPersistence.impl")
1497    protected com.liferay.portal.service.persistence.ShardPersistence shardPersistence;
1498    @BeanReference(name = "com.liferay.portal.service.persistence.SubscriptionPersistence.impl")
1499    protected com.liferay.portal.service.persistence.SubscriptionPersistence subscriptionPersistence;
1500    @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence.impl")
1501    protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
1502    @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupPersistence.impl")
1503    protected com.liferay.portal.service.persistence.UserGroupPersistence userGroupPersistence;
1504    @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupRolePersistence.impl")
1505    protected com.liferay.portal.service.persistence.UserGroupRolePersistence userGroupRolePersistence;
1506    @BeanReference(name = "com.liferay.portal.service.persistence.UserIdMapperPersistence.impl")
1507    protected com.liferay.portal.service.persistence.UserIdMapperPersistence userIdMapperPersistence;
1508    @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPersistence.impl")
1509    protected com.liferay.portal.service.persistence.UserTrackerPersistence userTrackerPersistence;
1510    @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPathPersistence.impl")
1511    protected com.liferay.portal.service.persistence.UserTrackerPathPersistence userTrackerPathPersistence;
1512    @BeanReference(name = "com.liferay.portal.service.persistence.WebDAVPropsPersistence.impl")
1513    protected com.liferay.portal.service.persistence.WebDAVPropsPersistence webDAVPropsPersistence;
1514    @BeanReference(name = "com.liferay.portal.service.persistence.WebsitePersistence.impl")
1515    protected com.liferay.portal.service.persistence.WebsitePersistence websitePersistence;
1516    private static Log _log = LogFactoryUtil.getLog(ResourceCodePersistenceImpl.class);
1517}