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