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