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