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