001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.NoSuchResourceActionException;
019 import com.liferay.portal.kernel.bean.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.CacheModel;
039 import com.liferay.portal.model.ModelListener;
040 import com.liferay.portal.model.ResourceAction;
041 import com.liferay.portal.model.impl.ResourceActionImpl;
042 import com.liferay.portal.model.impl.ResourceActionModelImpl;
043 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
044
045 import java.io.Serializable;
046
047 import java.util.ArrayList;
048 import java.util.Collections;
049 import java.util.List;
050
051
063 public class ResourceActionPersistenceImpl extends BasePersistenceImpl<ResourceAction>
064 implements ResourceActionPersistence {
065
070 public static final String FINDER_CLASS_NAME_ENTITY = ResourceActionImpl.class.getName();
071 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
072 ".List1";
073 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
074 ".List2";
075 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_NAME = new FinderPath(ResourceActionModelImpl.ENTITY_CACHE_ENABLED,
076 ResourceActionModelImpl.FINDER_CACHE_ENABLED,
077 ResourceActionImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
078 "findByName",
079 new String[] {
080 String.class.getName(),
081
082 "java.lang.Integer", "java.lang.Integer",
083 "com.liferay.portal.kernel.util.OrderByComparator"
084 });
085 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_NAME = new FinderPath(ResourceActionModelImpl.ENTITY_CACHE_ENABLED,
086 ResourceActionModelImpl.FINDER_CACHE_ENABLED,
087 ResourceActionImpl.class,
088 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByName",
089 new String[] { String.class.getName() },
090 ResourceActionModelImpl.NAME_COLUMN_BITMASK);
091 public static final FinderPath FINDER_PATH_COUNT_BY_NAME = new FinderPath(ResourceActionModelImpl.ENTITY_CACHE_ENABLED,
092 ResourceActionModelImpl.FINDER_CACHE_ENABLED, Long.class,
093 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByName",
094 new String[] { String.class.getName() });
095 public static final FinderPath FINDER_PATH_FETCH_BY_N_A = new FinderPath(ResourceActionModelImpl.ENTITY_CACHE_ENABLED,
096 ResourceActionModelImpl.FINDER_CACHE_ENABLED,
097 ResourceActionImpl.class, FINDER_CLASS_NAME_ENTITY, "fetchByN_A",
098 new String[] { String.class.getName(), String.class.getName() },
099 ResourceActionModelImpl.NAME_COLUMN_BITMASK |
100 ResourceActionModelImpl.ACTIONID_COLUMN_BITMASK);
101 public static final FinderPath FINDER_PATH_COUNT_BY_N_A = new FinderPath(ResourceActionModelImpl.ENTITY_CACHE_ENABLED,
102 ResourceActionModelImpl.FINDER_CACHE_ENABLED, Long.class,
103 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByN_A",
104 new String[] { String.class.getName(), String.class.getName() });
105 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(ResourceActionModelImpl.ENTITY_CACHE_ENABLED,
106 ResourceActionModelImpl.FINDER_CACHE_ENABLED,
107 ResourceActionImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
108 "findAll", new String[0]);
109 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(ResourceActionModelImpl.ENTITY_CACHE_ENABLED,
110 ResourceActionModelImpl.FINDER_CACHE_ENABLED,
111 ResourceActionImpl.class,
112 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
113 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ResourceActionModelImpl.ENTITY_CACHE_ENABLED,
114 ResourceActionModelImpl.FINDER_CACHE_ENABLED, Long.class,
115 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
116
117
122 public void cacheResult(ResourceAction resourceAction) {
123 EntityCacheUtil.putResult(ResourceActionModelImpl.ENTITY_CACHE_ENABLED,
124 ResourceActionImpl.class, resourceAction.getPrimaryKey(),
125 resourceAction);
126
127 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_A,
128 new Object[] { resourceAction.getName(), resourceAction.getActionId() },
129 resourceAction);
130
131 resourceAction.resetOriginalValues();
132 }
133
134
139 public void cacheResult(List<ResourceAction> resourceActions) {
140 for (ResourceAction resourceAction : resourceActions) {
141 if (EntityCacheUtil.getResult(
142 ResourceActionModelImpl.ENTITY_CACHE_ENABLED,
143 ResourceActionImpl.class, resourceAction.getPrimaryKey()) == null) {
144 cacheResult(resourceAction);
145 }
146 else {
147 resourceAction.resetOriginalValues();
148 }
149 }
150 }
151
152
159 @Override
160 public void clearCache() {
161 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
162 CacheRegistryUtil.clear(ResourceActionImpl.class.getName());
163 }
164
165 EntityCacheUtil.clearCache(ResourceActionImpl.class.getName());
166
167 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
168 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
169 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
170 }
171
172
179 @Override
180 public void clearCache(ResourceAction resourceAction) {
181 EntityCacheUtil.removeResult(ResourceActionModelImpl.ENTITY_CACHE_ENABLED,
182 ResourceActionImpl.class, resourceAction.getPrimaryKey());
183
184 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
185 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
186
187 clearUniqueFindersCache(resourceAction);
188 }
189
190 @Override
191 public void clearCache(List<ResourceAction> resourceActions) {
192 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
193 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
194
195 for (ResourceAction resourceAction : resourceActions) {
196 EntityCacheUtil.removeResult(ResourceActionModelImpl.ENTITY_CACHE_ENABLED,
197 ResourceActionImpl.class, resourceAction.getPrimaryKey());
198
199 clearUniqueFindersCache(resourceAction);
200 }
201 }
202
203 protected void clearUniqueFindersCache(ResourceAction resourceAction) {
204 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_N_A,
205 new Object[] { resourceAction.getName(), resourceAction.getActionId() });
206 }
207
208
214 public ResourceAction create(long resourceActionId) {
215 ResourceAction resourceAction = new ResourceActionImpl();
216
217 resourceAction.setNew(true);
218 resourceAction.setPrimaryKey(resourceActionId);
219
220 return resourceAction;
221 }
222
223
231 public ResourceAction remove(long resourceActionId)
232 throws NoSuchResourceActionException, SystemException {
233 return remove(Long.valueOf(resourceActionId));
234 }
235
236
244 @Override
245 public ResourceAction remove(Serializable primaryKey)
246 throws NoSuchResourceActionException, SystemException {
247 Session session = null;
248
249 try {
250 session = openSession();
251
252 ResourceAction resourceAction = (ResourceAction)session.get(ResourceActionImpl.class,
253 primaryKey);
254
255 if (resourceAction == null) {
256 if (_log.isWarnEnabled()) {
257 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
258 }
259
260 throw new NoSuchResourceActionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
261 primaryKey);
262 }
263
264 return remove(resourceAction);
265 }
266 catch (NoSuchResourceActionException nsee) {
267 throw nsee;
268 }
269 catch (Exception e) {
270 throw processException(e);
271 }
272 finally {
273 closeSession(session);
274 }
275 }
276
277 @Override
278 protected ResourceAction removeImpl(ResourceAction resourceAction)
279 throws SystemException {
280 resourceAction = toUnwrappedModel(resourceAction);
281
282 Session session = null;
283
284 try {
285 session = openSession();
286
287 BatchSessionUtil.delete(session, resourceAction);
288 }
289 catch (Exception e) {
290 throw processException(e);
291 }
292 finally {
293 closeSession(session);
294 }
295
296 clearCache(resourceAction);
297
298 return resourceAction;
299 }
300
301 @Override
302 public ResourceAction updateImpl(
303 com.liferay.portal.model.ResourceAction resourceAction, boolean merge)
304 throws SystemException {
305 resourceAction = toUnwrappedModel(resourceAction);
306
307 boolean isNew = resourceAction.isNew();
308
309 ResourceActionModelImpl resourceActionModelImpl = (ResourceActionModelImpl)resourceAction;
310
311 Session session = null;
312
313 try {
314 session = openSession();
315
316 BatchSessionUtil.update(session, resourceAction, merge);
317
318 resourceAction.setNew(false);
319 }
320 catch (Exception e) {
321 throw processException(e);
322 }
323 finally {
324 closeSession(session);
325 }
326
327 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
328
329 if (isNew || !ResourceActionModelImpl.COLUMN_BITMASK_ENABLED) {
330 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
331 }
332 else {
333 if ((resourceActionModelImpl.getColumnBitmask() &
334 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_NAME.getColumnBitmask()) != 0) {
335 Object[] args = new Object[] {
336 resourceActionModelImpl.getOriginalName()
337 };
338
339 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_NAME, args);
340 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_NAME,
341 args);
342
343 args = new Object[] { resourceActionModelImpl.getName() };
344
345 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_NAME, args);
346 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_NAME,
347 args);
348 }
349 }
350
351 EntityCacheUtil.putResult(ResourceActionModelImpl.ENTITY_CACHE_ENABLED,
352 ResourceActionImpl.class, resourceAction.getPrimaryKey(),
353 resourceAction);
354
355 if (isNew) {
356 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_A,
357 new Object[] {
358 resourceAction.getName(),
359
360 resourceAction.getActionId()
361 }, resourceAction);
362 }
363 else {
364 if ((resourceActionModelImpl.getColumnBitmask() &
365 FINDER_PATH_FETCH_BY_N_A.getColumnBitmask()) != 0) {
366 Object[] args = new Object[] {
367 resourceActionModelImpl.getOriginalName(),
368
369 resourceActionModelImpl.getOriginalActionId()
370 };
371
372 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_N_A, args);
373 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_N_A, args);
374
375 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_A,
376 new Object[] {
377 resourceAction.getName(),
378
379 resourceAction.getActionId()
380 }, resourceAction);
381 }
382 }
383
384 return resourceAction;
385 }
386
387 protected ResourceAction toUnwrappedModel(ResourceAction resourceAction) {
388 if (resourceAction instanceof ResourceActionImpl) {
389 return resourceAction;
390 }
391
392 ResourceActionImpl resourceActionImpl = new ResourceActionImpl();
393
394 resourceActionImpl.setNew(resourceAction.isNew());
395 resourceActionImpl.setPrimaryKey(resourceAction.getPrimaryKey());
396
397 resourceActionImpl.setResourceActionId(resourceAction.getResourceActionId());
398 resourceActionImpl.setName(resourceAction.getName());
399 resourceActionImpl.setActionId(resourceAction.getActionId());
400 resourceActionImpl.setBitwiseValue(resourceAction.getBitwiseValue());
401
402 return resourceActionImpl;
403 }
404
405
413 @Override
414 public ResourceAction findByPrimaryKey(Serializable primaryKey)
415 throws NoSuchModelException, SystemException {
416 return findByPrimaryKey(((Long)primaryKey).longValue());
417 }
418
419
427 public ResourceAction findByPrimaryKey(long resourceActionId)
428 throws NoSuchResourceActionException, SystemException {
429 ResourceAction resourceAction = fetchByPrimaryKey(resourceActionId);
430
431 if (resourceAction == null) {
432 if (_log.isWarnEnabled()) {
433 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + resourceActionId);
434 }
435
436 throw new NoSuchResourceActionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
437 resourceActionId);
438 }
439
440 return resourceAction;
441 }
442
443
450 @Override
451 public ResourceAction fetchByPrimaryKey(Serializable primaryKey)
452 throws SystemException {
453 return fetchByPrimaryKey(((Long)primaryKey).longValue());
454 }
455
456
463 public ResourceAction fetchByPrimaryKey(long resourceActionId)
464 throws SystemException {
465 ResourceAction resourceAction = (ResourceAction)EntityCacheUtil.getResult(ResourceActionModelImpl.ENTITY_CACHE_ENABLED,
466 ResourceActionImpl.class, resourceActionId);
467
468 if (resourceAction == _nullResourceAction) {
469 return null;
470 }
471
472 if (resourceAction == null) {
473 Session session = null;
474
475 boolean hasException = false;
476
477 try {
478 session = openSession();
479
480 resourceAction = (ResourceAction)session.get(ResourceActionImpl.class,
481 Long.valueOf(resourceActionId));
482 }
483 catch (Exception e) {
484 hasException = true;
485
486 throw processException(e);
487 }
488 finally {
489 if (resourceAction != null) {
490 cacheResult(resourceAction);
491 }
492 else if (!hasException) {
493 EntityCacheUtil.putResult(ResourceActionModelImpl.ENTITY_CACHE_ENABLED,
494 ResourceActionImpl.class, resourceActionId,
495 _nullResourceAction);
496 }
497
498 closeSession(session);
499 }
500 }
501
502 return resourceAction;
503 }
504
505
512 public List<ResourceAction> findByName(String name)
513 throws SystemException {
514 return findByName(name, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
515 }
516
517
530 public List<ResourceAction> findByName(String name, int start, int end)
531 throws SystemException {
532 return findByName(name, start, end, null);
533 }
534
535
549 public List<ResourceAction> findByName(String name, int start, int end,
550 OrderByComparator orderByComparator) throws SystemException {
551 FinderPath finderPath = null;
552 Object[] finderArgs = null;
553
554 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
555 (orderByComparator == null)) {
556 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_NAME;
557 finderArgs = new Object[] { name };
558 }
559 else {
560 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_NAME;
561 finderArgs = new Object[] { name, start, end, orderByComparator };
562 }
563
564 List<ResourceAction> list = (List<ResourceAction>)FinderCacheUtil.getResult(finderPath,
565 finderArgs, this);
566
567 if ((list != null) && !list.isEmpty()) {
568 for (ResourceAction resourceAction : list) {
569 if (!Validator.equals(name, resourceAction.getName())) {
570 list = null;
571
572 break;
573 }
574 }
575 }
576
577 if (list == null) {
578 StringBundler query = null;
579
580 if (orderByComparator != null) {
581 query = new StringBundler(3 +
582 (orderByComparator.getOrderByFields().length * 3));
583 }
584 else {
585 query = new StringBundler(3);
586 }
587
588 query.append(_SQL_SELECT_RESOURCEACTION_WHERE);
589
590 if (name == null) {
591 query.append(_FINDER_COLUMN_NAME_NAME_1);
592 }
593 else {
594 if (name.equals(StringPool.BLANK)) {
595 query.append(_FINDER_COLUMN_NAME_NAME_3);
596 }
597 else {
598 query.append(_FINDER_COLUMN_NAME_NAME_2);
599 }
600 }
601
602 if (orderByComparator != null) {
603 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
604 orderByComparator);
605 }
606
607 else {
608 query.append(ResourceActionModelImpl.ORDER_BY_JPQL);
609 }
610
611 String sql = query.toString();
612
613 Session session = null;
614
615 try {
616 session = openSession();
617
618 Query q = session.createQuery(sql);
619
620 QueryPos qPos = QueryPos.getInstance(q);
621
622 if (name != null) {
623 qPos.add(name);
624 }
625
626 list = (List<ResourceAction>)QueryUtil.list(q, getDialect(),
627 start, end);
628 }
629 catch (Exception e) {
630 throw processException(e);
631 }
632 finally {
633 if (list == null) {
634 FinderCacheUtil.removeResult(finderPath, finderArgs);
635 }
636 else {
637 cacheResult(list);
638
639 FinderCacheUtil.putResult(finderPath, finderArgs, list);
640 }
641
642 closeSession(session);
643 }
644 }
645
646 return list;
647 }
648
649
662 public ResourceAction findByName_First(String name,
663 OrderByComparator orderByComparator)
664 throws NoSuchResourceActionException, SystemException {
665 List<ResourceAction> list = findByName(name, 0, 1, orderByComparator);
666
667 if (list.isEmpty()) {
668 StringBundler msg = new StringBundler(4);
669
670 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
671
672 msg.append("name=");
673 msg.append(name);
674
675 msg.append(StringPool.CLOSE_CURLY_BRACE);
676
677 throw new NoSuchResourceActionException(msg.toString());
678 }
679 else {
680 return list.get(0);
681 }
682 }
683
684
697 public ResourceAction findByName_Last(String name,
698 OrderByComparator orderByComparator)
699 throws NoSuchResourceActionException, SystemException {
700 int count = countByName(name);
701
702 List<ResourceAction> list = findByName(name, count - 1, count,
703 orderByComparator);
704
705 if (list.isEmpty()) {
706 StringBundler msg = new StringBundler(4);
707
708 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
709
710 msg.append("name=");
711 msg.append(name);
712
713 msg.append(StringPool.CLOSE_CURLY_BRACE);
714
715 throw new NoSuchResourceActionException(msg.toString());
716 }
717 else {
718 return list.get(0);
719 }
720 }
721
722
736 public ResourceAction[] findByName_PrevAndNext(long resourceActionId,
737 String name, OrderByComparator orderByComparator)
738 throws NoSuchResourceActionException, SystemException {
739 ResourceAction resourceAction = findByPrimaryKey(resourceActionId);
740
741 Session session = null;
742
743 try {
744 session = openSession();
745
746 ResourceAction[] array = new ResourceActionImpl[3];
747
748 array[0] = getByName_PrevAndNext(session, resourceAction, name,
749 orderByComparator, true);
750
751 array[1] = resourceAction;
752
753 array[2] = getByName_PrevAndNext(session, resourceAction, name,
754 orderByComparator, false);
755
756 return array;
757 }
758 catch (Exception e) {
759 throw processException(e);
760 }
761 finally {
762 closeSession(session);
763 }
764 }
765
766 protected ResourceAction getByName_PrevAndNext(Session session,
767 ResourceAction resourceAction, String name,
768 OrderByComparator orderByComparator, boolean previous) {
769 StringBundler query = null;
770
771 if (orderByComparator != null) {
772 query = new StringBundler(6 +
773 (orderByComparator.getOrderByFields().length * 6));
774 }
775 else {
776 query = new StringBundler(3);
777 }
778
779 query.append(_SQL_SELECT_RESOURCEACTION_WHERE);
780
781 if (name == null) {
782 query.append(_FINDER_COLUMN_NAME_NAME_1);
783 }
784 else {
785 if (name.equals(StringPool.BLANK)) {
786 query.append(_FINDER_COLUMN_NAME_NAME_3);
787 }
788 else {
789 query.append(_FINDER_COLUMN_NAME_NAME_2);
790 }
791 }
792
793 if (orderByComparator != null) {
794 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
795
796 if (orderByConditionFields.length > 0) {
797 query.append(WHERE_AND);
798 }
799
800 for (int i = 0; i < orderByConditionFields.length; i++) {
801 query.append(_ORDER_BY_ENTITY_ALIAS);
802 query.append(orderByConditionFields[i]);
803
804 if ((i + 1) < orderByConditionFields.length) {
805 if (orderByComparator.isAscending() ^ previous) {
806 query.append(WHERE_GREATER_THAN_HAS_NEXT);
807 }
808 else {
809 query.append(WHERE_LESSER_THAN_HAS_NEXT);
810 }
811 }
812 else {
813 if (orderByComparator.isAscending() ^ previous) {
814 query.append(WHERE_GREATER_THAN);
815 }
816 else {
817 query.append(WHERE_LESSER_THAN);
818 }
819 }
820 }
821
822 query.append(ORDER_BY_CLAUSE);
823
824 String[] orderByFields = orderByComparator.getOrderByFields();
825
826 for (int i = 0; i < orderByFields.length; i++) {
827 query.append(_ORDER_BY_ENTITY_ALIAS);
828 query.append(orderByFields[i]);
829
830 if ((i + 1) < orderByFields.length) {
831 if (orderByComparator.isAscending() ^ previous) {
832 query.append(ORDER_BY_ASC_HAS_NEXT);
833 }
834 else {
835 query.append(ORDER_BY_DESC_HAS_NEXT);
836 }
837 }
838 else {
839 if (orderByComparator.isAscending() ^ previous) {
840 query.append(ORDER_BY_ASC);
841 }
842 else {
843 query.append(ORDER_BY_DESC);
844 }
845 }
846 }
847 }
848
849 else {
850 query.append(ResourceActionModelImpl.ORDER_BY_JPQL);
851 }
852
853 String sql = query.toString();
854
855 Query q = session.createQuery(sql);
856
857 q.setFirstResult(0);
858 q.setMaxResults(2);
859
860 QueryPos qPos = QueryPos.getInstance(q);
861
862 if (name != null) {
863 qPos.add(name);
864 }
865
866 if (orderByComparator != null) {
867 Object[] values = orderByComparator.getOrderByConditionValues(resourceAction);
868
869 for (Object value : values) {
870 qPos.add(value);
871 }
872 }
873
874 List<ResourceAction> list = q.list();
875
876 if (list.size() == 2) {
877 return list.get(1);
878 }
879 else {
880 return null;
881 }
882 }
883
884
893 public ResourceAction findByN_A(String name, String actionId)
894 throws NoSuchResourceActionException, SystemException {
895 ResourceAction resourceAction = fetchByN_A(name, actionId);
896
897 if (resourceAction == null) {
898 StringBundler msg = new StringBundler(6);
899
900 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
901
902 msg.append("name=");
903 msg.append(name);
904
905 msg.append(", actionId=");
906 msg.append(actionId);
907
908 msg.append(StringPool.CLOSE_CURLY_BRACE);
909
910 if (_log.isWarnEnabled()) {
911 _log.warn(msg.toString());
912 }
913
914 throw new NoSuchResourceActionException(msg.toString());
915 }
916
917 return resourceAction;
918 }
919
920
928 public ResourceAction fetchByN_A(String name, String actionId)
929 throws SystemException {
930 return fetchByN_A(name, actionId, true);
931 }
932
933
942 public ResourceAction fetchByN_A(String name, String actionId,
943 boolean retrieveFromCache) throws SystemException {
944 Object[] finderArgs = new Object[] { name, actionId };
945
946 Object result = null;
947
948 if (retrieveFromCache) {
949 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_N_A,
950 finderArgs, this);
951 }
952
953 if (result instanceof ResourceAction) {
954 ResourceAction resourceAction = (ResourceAction)result;
955
956 if (!Validator.equals(name, resourceAction.getName()) ||
957 !Validator.equals(actionId, resourceAction.getActionId())) {
958 result = null;
959 }
960 }
961
962 if (result == null) {
963 StringBundler query = new StringBundler(4);
964
965 query.append(_SQL_SELECT_RESOURCEACTION_WHERE);
966
967 if (name == null) {
968 query.append(_FINDER_COLUMN_N_A_NAME_1);
969 }
970 else {
971 if (name.equals(StringPool.BLANK)) {
972 query.append(_FINDER_COLUMN_N_A_NAME_3);
973 }
974 else {
975 query.append(_FINDER_COLUMN_N_A_NAME_2);
976 }
977 }
978
979 if (actionId == null) {
980 query.append(_FINDER_COLUMN_N_A_ACTIONID_1);
981 }
982 else {
983 if (actionId.equals(StringPool.BLANK)) {
984 query.append(_FINDER_COLUMN_N_A_ACTIONID_3);
985 }
986 else {
987 query.append(_FINDER_COLUMN_N_A_ACTIONID_2);
988 }
989 }
990
991 query.append(ResourceActionModelImpl.ORDER_BY_JPQL);
992
993 String sql = query.toString();
994
995 Session session = null;
996
997 try {
998 session = openSession();
999
1000 Query q = session.createQuery(sql);
1001
1002 QueryPos qPos = QueryPos.getInstance(q);
1003
1004 if (name != null) {
1005 qPos.add(name);
1006 }
1007
1008 if (actionId != null) {
1009 qPos.add(actionId);
1010 }
1011
1012 List<ResourceAction> list = q.list();
1013
1014 result = list;
1015
1016 ResourceAction resourceAction = null;
1017
1018 if (list.isEmpty()) {
1019 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_A,
1020 finderArgs, list);
1021 }
1022 else {
1023 resourceAction = list.get(0);
1024
1025 cacheResult(resourceAction);
1026
1027 if ((resourceAction.getName() == null) ||
1028 !resourceAction.getName().equals(name) ||
1029 (resourceAction.getActionId() == null) ||
1030 !resourceAction.getActionId().equals(actionId)) {
1031 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_A,
1032 finderArgs, resourceAction);
1033 }
1034 }
1035
1036 return resourceAction;
1037 }
1038 catch (Exception e) {
1039 throw processException(e);
1040 }
1041 finally {
1042 if (result == null) {
1043 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_N_A,
1044 finderArgs);
1045 }
1046
1047 closeSession(session);
1048 }
1049 }
1050 else {
1051 if (result instanceof List<?>) {
1052 return null;
1053 }
1054 else {
1055 return (ResourceAction)result;
1056 }
1057 }
1058 }
1059
1060
1066 public List<ResourceAction> findAll() throws SystemException {
1067 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1068 }
1069
1070
1082 public List<ResourceAction> findAll(int start, int end)
1083 throws SystemException {
1084 return findAll(start, end, null);
1085 }
1086
1087
1100 public List<ResourceAction> findAll(int start, int end,
1101 OrderByComparator orderByComparator) throws SystemException {
1102 FinderPath finderPath = null;
1103 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1104
1105 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1106 (orderByComparator == null)) {
1107 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1108 finderArgs = FINDER_ARGS_EMPTY;
1109 }
1110 else {
1111 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1112 finderArgs = new Object[] { start, end, orderByComparator };
1113 }
1114
1115 List<ResourceAction> list = (List<ResourceAction>)FinderCacheUtil.getResult(finderPath,
1116 finderArgs, this);
1117
1118 if (list == null) {
1119 StringBundler query = null;
1120 String sql = null;
1121
1122 if (orderByComparator != null) {
1123 query = new StringBundler(2 +
1124 (orderByComparator.getOrderByFields().length * 3));
1125
1126 query.append(_SQL_SELECT_RESOURCEACTION);
1127
1128 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1129 orderByComparator);
1130
1131 sql = query.toString();
1132 }
1133 else {
1134 sql = _SQL_SELECT_RESOURCEACTION.concat(ResourceActionModelImpl.ORDER_BY_JPQL);
1135 }
1136
1137 Session session = null;
1138
1139 try {
1140 session = openSession();
1141
1142 Query q = session.createQuery(sql);
1143
1144 if (orderByComparator == null) {
1145 list = (List<ResourceAction>)QueryUtil.list(q,
1146 getDialect(), start, end, false);
1147
1148 Collections.sort(list);
1149 }
1150 else {
1151 list = (List<ResourceAction>)QueryUtil.list(q,
1152 getDialect(), start, end);
1153 }
1154 }
1155 catch (Exception e) {
1156 throw processException(e);
1157 }
1158 finally {
1159 if (list == null) {
1160 FinderCacheUtil.removeResult(finderPath, finderArgs);
1161 }
1162 else {
1163 cacheResult(list);
1164
1165 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1166 }
1167
1168 closeSession(session);
1169 }
1170 }
1171
1172 return list;
1173 }
1174
1175
1181 public void removeByName(String name) throws SystemException {
1182 for (ResourceAction resourceAction : findByName(name)) {
1183 remove(resourceAction);
1184 }
1185 }
1186
1187
1194 public void removeByN_A(String name, String actionId)
1195 throws NoSuchResourceActionException, SystemException {
1196 ResourceAction resourceAction = findByN_A(name, actionId);
1197
1198 remove(resourceAction);
1199 }
1200
1201
1206 public void removeAll() throws SystemException {
1207 for (ResourceAction resourceAction : findAll()) {
1208 remove(resourceAction);
1209 }
1210 }
1211
1212
1219 public int countByName(String name) throws SystemException {
1220 Object[] finderArgs = new Object[] { name };
1221
1222 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_NAME,
1223 finderArgs, this);
1224
1225 if (count == null) {
1226 StringBundler query = new StringBundler(2);
1227
1228 query.append(_SQL_COUNT_RESOURCEACTION_WHERE);
1229
1230 if (name == null) {
1231 query.append(_FINDER_COLUMN_NAME_NAME_1);
1232 }
1233 else {
1234 if (name.equals(StringPool.BLANK)) {
1235 query.append(_FINDER_COLUMN_NAME_NAME_3);
1236 }
1237 else {
1238 query.append(_FINDER_COLUMN_NAME_NAME_2);
1239 }
1240 }
1241
1242 String sql = query.toString();
1243
1244 Session session = null;
1245
1246 try {
1247 session = openSession();
1248
1249 Query q = session.createQuery(sql);
1250
1251 QueryPos qPos = QueryPos.getInstance(q);
1252
1253 if (name != null) {
1254 qPos.add(name);
1255 }
1256
1257 count = (Long)q.uniqueResult();
1258 }
1259 catch (Exception e) {
1260 throw processException(e);
1261 }
1262 finally {
1263 if (count == null) {
1264 count = Long.valueOf(0);
1265 }
1266
1267 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_NAME,
1268 finderArgs, count);
1269
1270 closeSession(session);
1271 }
1272 }
1273
1274 return count.intValue();
1275 }
1276
1277
1285 public int countByN_A(String name, String actionId)
1286 throws SystemException {
1287 Object[] finderArgs = new Object[] { name, actionId };
1288
1289 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_N_A,
1290 finderArgs, this);
1291
1292 if (count == null) {
1293 StringBundler query = new StringBundler(3);
1294
1295 query.append(_SQL_COUNT_RESOURCEACTION_WHERE);
1296
1297 if (name == null) {
1298 query.append(_FINDER_COLUMN_N_A_NAME_1);
1299 }
1300 else {
1301 if (name.equals(StringPool.BLANK)) {
1302 query.append(_FINDER_COLUMN_N_A_NAME_3);
1303 }
1304 else {
1305 query.append(_FINDER_COLUMN_N_A_NAME_2);
1306 }
1307 }
1308
1309 if (actionId == null) {
1310 query.append(_FINDER_COLUMN_N_A_ACTIONID_1);
1311 }
1312 else {
1313 if (actionId.equals(StringPool.BLANK)) {
1314 query.append(_FINDER_COLUMN_N_A_ACTIONID_3);
1315 }
1316 else {
1317 query.append(_FINDER_COLUMN_N_A_ACTIONID_2);
1318 }
1319 }
1320
1321 String sql = query.toString();
1322
1323 Session session = null;
1324
1325 try {
1326 session = openSession();
1327
1328 Query q = session.createQuery(sql);
1329
1330 QueryPos qPos = QueryPos.getInstance(q);
1331
1332 if (name != null) {
1333 qPos.add(name);
1334 }
1335
1336 if (actionId != null) {
1337 qPos.add(actionId);
1338 }
1339
1340 count = (Long)q.uniqueResult();
1341 }
1342 catch (Exception e) {
1343 throw processException(e);
1344 }
1345 finally {
1346 if (count == null) {
1347 count = Long.valueOf(0);
1348 }
1349
1350 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_A, finderArgs,
1351 count);
1352
1353 closeSession(session);
1354 }
1355 }
1356
1357 return count.intValue();
1358 }
1359
1360
1366 public int countAll() throws SystemException {
1367 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1368 FINDER_ARGS_EMPTY, this);
1369
1370 if (count == null) {
1371 Session session = null;
1372
1373 try {
1374 session = openSession();
1375
1376 Query q = session.createQuery(_SQL_COUNT_RESOURCEACTION);
1377
1378 count = (Long)q.uniqueResult();
1379 }
1380 catch (Exception e) {
1381 throw processException(e);
1382 }
1383 finally {
1384 if (count == null) {
1385 count = Long.valueOf(0);
1386 }
1387
1388 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1389 FINDER_ARGS_EMPTY, count);
1390
1391 closeSession(session);
1392 }
1393 }
1394
1395 return count.intValue();
1396 }
1397
1398
1401 public void afterPropertiesSet() {
1402 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1403 com.liferay.portal.util.PropsUtil.get(
1404 "value.object.listener.com.liferay.portal.model.ResourceAction")));
1405
1406 if (listenerClassNames.length > 0) {
1407 try {
1408 List<ModelListener<ResourceAction>> listenersList = new ArrayList<ModelListener<ResourceAction>>();
1409
1410 for (String listenerClassName : listenerClassNames) {
1411 listenersList.add((ModelListener<ResourceAction>)InstanceFactory.newInstance(
1412 listenerClassName));
1413 }
1414
1415 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1416 }
1417 catch (Exception e) {
1418 _log.error(e);
1419 }
1420 }
1421 }
1422
1423 public void destroy() {
1424 EntityCacheUtil.removeCache(ResourceActionImpl.class.getName());
1425 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1426 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1427 }
1428
1429 @BeanReference(type = AccountPersistence.class)
1430 protected AccountPersistence accountPersistence;
1431 @BeanReference(type = AddressPersistence.class)
1432 protected AddressPersistence addressPersistence;
1433 @BeanReference(type = BrowserTrackerPersistence.class)
1434 protected BrowserTrackerPersistence browserTrackerPersistence;
1435 @BeanReference(type = ClassNamePersistence.class)
1436 protected ClassNamePersistence classNamePersistence;
1437 @BeanReference(type = ClusterGroupPersistence.class)
1438 protected ClusterGroupPersistence clusterGroupPersistence;
1439 @BeanReference(type = CompanyPersistence.class)
1440 protected CompanyPersistence companyPersistence;
1441 @BeanReference(type = ContactPersistence.class)
1442 protected ContactPersistence contactPersistence;
1443 @BeanReference(type = CountryPersistence.class)
1444 protected CountryPersistence countryPersistence;
1445 @BeanReference(type = EmailAddressPersistence.class)
1446 protected EmailAddressPersistence emailAddressPersistence;
1447 @BeanReference(type = GroupPersistence.class)
1448 protected GroupPersistence groupPersistence;
1449 @BeanReference(type = ImagePersistence.class)
1450 protected ImagePersistence imagePersistence;
1451 @BeanReference(type = LayoutPersistence.class)
1452 protected LayoutPersistence layoutPersistence;
1453 @BeanReference(type = LayoutBranchPersistence.class)
1454 protected LayoutBranchPersistence layoutBranchPersistence;
1455 @BeanReference(type = LayoutPrototypePersistence.class)
1456 protected LayoutPrototypePersistence layoutPrototypePersistence;
1457 @BeanReference(type = LayoutRevisionPersistence.class)
1458 protected LayoutRevisionPersistence layoutRevisionPersistence;
1459 @BeanReference(type = LayoutSetPersistence.class)
1460 protected LayoutSetPersistence layoutSetPersistence;
1461 @BeanReference(type = LayoutSetBranchPersistence.class)
1462 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
1463 @BeanReference(type = LayoutSetPrototypePersistence.class)
1464 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1465 @BeanReference(type = ListTypePersistence.class)
1466 protected ListTypePersistence listTypePersistence;
1467 @BeanReference(type = LockPersistence.class)
1468 protected LockPersistence lockPersistence;
1469 @BeanReference(type = MembershipRequestPersistence.class)
1470 protected MembershipRequestPersistence membershipRequestPersistence;
1471 @BeanReference(type = OrganizationPersistence.class)
1472 protected OrganizationPersistence organizationPersistence;
1473 @BeanReference(type = OrgGroupPermissionPersistence.class)
1474 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1475 @BeanReference(type = OrgGroupRolePersistence.class)
1476 protected OrgGroupRolePersistence orgGroupRolePersistence;
1477 @BeanReference(type = OrgLaborPersistence.class)
1478 protected OrgLaborPersistence orgLaborPersistence;
1479 @BeanReference(type = PasswordPolicyPersistence.class)
1480 protected PasswordPolicyPersistence passwordPolicyPersistence;
1481 @BeanReference(type = PasswordPolicyRelPersistence.class)
1482 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1483 @BeanReference(type = PasswordTrackerPersistence.class)
1484 protected PasswordTrackerPersistence passwordTrackerPersistence;
1485 @BeanReference(type = PermissionPersistence.class)
1486 protected PermissionPersistence permissionPersistence;
1487 @BeanReference(type = PhonePersistence.class)
1488 protected PhonePersistence phonePersistence;
1489 @BeanReference(type = PluginSettingPersistence.class)
1490 protected PluginSettingPersistence pluginSettingPersistence;
1491 @BeanReference(type = PortalPreferencesPersistence.class)
1492 protected PortalPreferencesPersistence portalPreferencesPersistence;
1493 @BeanReference(type = PortletPersistence.class)
1494 protected PortletPersistence portletPersistence;
1495 @BeanReference(type = PortletItemPersistence.class)
1496 protected PortletItemPersistence portletItemPersistence;
1497 @BeanReference(type = PortletPreferencesPersistence.class)
1498 protected PortletPreferencesPersistence portletPreferencesPersistence;
1499 @BeanReference(type = RegionPersistence.class)
1500 protected RegionPersistence regionPersistence;
1501 @BeanReference(type = ReleasePersistence.class)
1502 protected ReleasePersistence releasePersistence;
1503 @BeanReference(type = RepositoryPersistence.class)
1504 protected RepositoryPersistence repositoryPersistence;
1505 @BeanReference(type = RepositoryEntryPersistence.class)
1506 protected RepositoryEntryPersistence repositoryEntryPersistence;
1507 @BeanReference(type = ResourcePersistence.class)
1508 protected ResourcePersistence resourcePersistence;
1509 @BeanReference(type = ResourceActionPersistence.class)
1510 protected ResourceActionPersistence resourceActionPersistence;
1511 @BeanReference(type = ResourceBlockPersistence.class)
1512 protected ResourceBlockPersistence resourceBlockPersistence;
1513 @BeanReference(type = ResourceBlockPermissionPersistence.class)
1514 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
1515 @BeanReference(type = ResourceCodePersistence.class)
1516 protected ResourceCodePersistence resourceCodePersistence;
1517 @BeanReference(type = ResourcePermissionPersistence.class)
1518 protected ResourcePermissionPersistence resourcePermissionPersistence;
1519 @BeanReference(type = ResourceTypePermissionPersistence.class)
1520 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
1521 @BeanReference(type = RolePersistence.class)
1522 protected RolePersistence rolePersistence;
1523 @BeanReference(type = ServiceComponentPersistence.class)
1524 protected ServiceComponentPersistence serviceComponentPersistence;
1525 @BeanReference(type = ShardPersistence.class)
1526 protected ShardPersistence shardPersistence;
1527 @BeanReference(type = SubscriptionPersistence.class)
1528 protected SubscriptionPersistence subscriptionPersistence;
1529 @BeanReference(type = TeamPersistence.class)
1530 protected TeamPersistence teamPersistence;
1531 @BeanReference(type = TicketPersistence.class)
1532 protected TicketPersistence ticketPersistence;
1533 @BeanReference(type = UserPersistence.class)
1534 protected UserPersistence userPersistence;
1535 @BeanReference(type = UserGroupPersistence.class)
1536 protected UserGroupPersistence userGroupPersistence;
1537 @BeanReference(type = UserGroupGroupRolePersistence.class)
1538 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1539 @BeanReference(type = UserGroupRolePersistence.class)
1540 protected UserGroupRolePersistence userGroupRolePersistence;
1541 @BeanReference(type = UserIdMapperPersistence.class)
1542 protected UserIdMapperPersistence userIdMapperPersistence;
1543 @BeanReference(type = UserNotificationEventPersistence.class)
1544 protected UserNotificationEventPersistence userNotificationEventPersistence;
1545 @BeanReference(type = UserTrackerPersistence.class)
1546 protected UserTrackerPersistence userTrackerPersistence;
1547 @BeanReference(type = UserTrackerPathPersistence.class)
1548 protected UserTrackerPathPersistence userTrackerPathPersistence;
1549 @BeanReference(type = VirtualHostPersistence.class)
1550 protected VirtualHostPersistence virtualHostPersistence;
1551 @BeanReference(type = WebDAVPropsPersistence.class)
1552 protected WebDAVPropsPersistence webDAVPropsPersistence;
1553 @BeanReference(type = WebsitePersistence.class)
1554 protected WebsitePersistence websitePersistence;
1555 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1556 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1557 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1558 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1559 private static final String _SQL_SELECT_RESOURCEACTION = "SELECT resourceAction FROM ResourceAction resourceAction";
1560 private static final String _SQL_SELECT_RESOURCEACTION_WHERE = "SELECT resourceAction FROM ResourceAction resourceAction WHERE ";
1561 private static final String _SQL_COUNT_RESOURCEACTION = "SELECT COUNT(resourceAction) FROM ResourceAction resourceAction";
1562 private static final String _SQL_COUNT_RESOURCEACTION_WHERE = "SELECT COUNT(resourceAction) FROM ResourceAction resourceAction WHERE ";
1563 private static final String _FINDER_COLUMN_NAME_NAME_1 = "resourceAction.name IS NULL";
1564 private static final String _FINDER_COLUMN_NAME_NAME_2 = "resourceAction.name = ?";
1565 private static final String _FINDER_COLUMN_NAME_NAME_3 = "(resourceAction.name IS NULL OR resourceAction.name = ?)";
1566 private static final String _FINDER_COLUMN_N_A_NAME_1 = "resourceAction.name IS NULL AND ";
1567 private static final String _FINDER_COLUMN_N_A_NAME_2 = "lower(resourceAction.name) = lower(CAST_TEXT(?)) AND ";
1568 private static final String _FINDER_COLUMN_N_A_NAME_3 = "(resourceAction.name IS NULL OR lower(resourceAction.name) = lower(CAST_TEXT(?))) AND ";
1569 private static final String _FINDER_COLUMN_N_A_ACTIONID_1 = "resourceAction.actionId IS NULL";
1570 private static final String _FINDER_COLUMN_N_A_ACTIONID_2 = "resourceAction.actionId = ?";
1571 private static final String _FINDER_COLUMN_N_A_ACTIONID_3 = "(resourceAction.actionId IS NULL OR resourceAction.actionId = ?)";
1572 private static final String _ORDER_BY_ENTITY_ALIAS = "resourceAction.";
1573 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No ResourceAction exists with the primary key ";
1574 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No ResourceAction exists with the key {";
1575 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1576 private static Log _log = LogFactoryUtil.getLog(ResourceActionPersistenceImpl.class);
1577 private static ResourceAction _nullResourceAction = new ResourceActionImpl() {
1578 @Override
1579 public Object clone() {
1580 return this;
1581 }
1582
1583 @Override
1584 public CacheModel<ResourceAction> toCacheModel() {
1585 return _nullResourceActionCacheModel;
1586 }
1587 };
1588
1589 private static CacheModel<ResourceAction> _nullResourceActionCacheModel = new CacheModel<ResourceAction>() {
1590 public ResourceAction toEntityModel() {
1591 return _nullResourceAction;
1592 }
1593 };
1594 }