001
014
015 package com.liferay.portal.kernel.dao.orm;
016
017 import com.liferay.portal.kernel.log.Log;
018 import com.liferay.portal.kernel.log.LogFactoryUtil;
019 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
020
021
024 public class FinderCacheUtil {
025
026 public static void clearCache() {
027 getFinderCache().clearCache();
028 }
029
030 public static void clearCache(String className) {
031 getFinderCache().clearCache(className);
032 }
033
034 public static void clearLocalCache() {
035 getFinderCache().clearLocalCache();
036 }
037
038 public static FinderCache getFinderCache() {
039 PortalRuntimePermission.checkGetBeanProperty(FinderCacheUtil.class);
040
041 return _finderCache;
042 }
043
044 public static Object getResult(
045 FinderPath finderPath, Object[] args, SessionFactory sessionFactory) {
046
047 return getFinderCache().getResult(finderPath, args, sessionFactory);
048 }
049
050
053 public static Object getResult(
054 String className, String methodName, String[] params, Object[] args,
055 SessionFactory sessionFactory) {
056
057 _log.error(
058 "Regenerate " + className +
059 " via \"ant build-service\" or else caching will not work");
060
061 return null;
062 }
063
064 public static void invalidate() {
065 getFinderCache().invalidate();
066 }
067
068
071 public static void putResult(
072 boolean classNameCacheEnabled, String className, String methodName,
073 String[] params, Object[] args, Object result) {
074
075 _log.error(
076 "Regenerate " + className +
077 " via \"ant build-service\" or else caching will not work");
078 }
079
080 public static void putResult(
081 FinderPath finderPath, Object[] args, Object result) {
082
083 getFinderCache().putResult(finderPath, args, result);
084 }
085
086 public static void removeCache(String className) {
087 getFinderCache().removeCache(className);
088 }
089
090 public static void removeResult(FinderPath finderPath, Object[] args) {
091 getFinderCache().removeResult(finderPath, args);
092 }
093
094 public void setFinderCache(FinderCache finderCache) {
095 PortalRuntimePermission.checkSetBeanProperty(getClass());
096
097 _finderCache = finderCache;
098 }
099
100 private static Log _log = LogFactoryUtil.getLog(FinderCacheUtil.class);
101
102 private static FinderCache _finderCache;
103
104 }