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