001 /** 002 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved. 003 * 004 * The contents of this file are subject to the terms of the Liferay Enterprise 005 * Subscription License ("License"). You may not use this file except in 006 * compliance with the License. You can obtain a copy of the License by 007 * contacting Liferay, Inc. See the License for the specific language governing 008 * permissions and limitations under the License, including but not limited to 009 * distribution rights of the Software. 010 * 011 * 012 * 013 */ 014 015 package com.liferay.counter.service.persistence; 016 017 import com.liferay.counter.model.Counter; 018 019 import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil; 020 import com.liferay.portal.kernel.dao.orm.DynamicQuery; 021 import com.liferay.portal.kernel.exception.SystemException; 022 import com.liferay.portal.kernel.util.OrderByComparator; 023 import com.liferay.portal.kernel.util.ReferenceRegistry; 024 import com.liferay.portal.service.ServiceContext; 025 026 import java.util.List; 027 028 /** 029 * The persistence utility for the counter service. This utility wraps {@link CounterPersistenceImpl} and provides direct access to the database for CRUD operations. This utility should only be used by the service layer, as it must operate within a transaction. Never access this utility in a JSP, controller, model, or other front-end class. 030 * 031 * <p> 032 * Caching information and settings can be found in <code>portal.properties</code> 033 * </p> 034 * 035 * @author Brian Wing Shun Chan 036 * @see CounterPersistence 037 * @see CounterPersistenceImpl 038 * @generated 039 */ 040 public class CounterUtil { 041 /* 042 * NOTE FOR DEVELOPERS: 043 * 044 * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class. 045 */ 046 047 /** 048 * @see com.liferay.portal.service.persistence.BasePersistence#clearCache() 049 */ 050 public static void clearCache() { 051 getPersistence().clearCache(); 052 } 053 054 /** 055 * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel) 056 */ 057 public static void clearCache(Counter counter) { 058 getPersistence().clearCache(counter); 059 } 060 061 /** 062 * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery) 063 */ 064 public long countWithDynamicQuery(DynamicQuery dynamicQuery) 065 throws SystemException { 066 return getPersistence().countWithDynamicQuery(dynamicQuery); 067 } 068 069 /** 070 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery) 071 */ 072 public static List<Counter> findWithDynamicQuery(DynamicQuery dynamicQuery) 073 throws SystemException { 074 return getPersistence().findWithDynamicQuery(dynamicQuery); 075 } 076 077 /** 078 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int) 079 */ 080 public static List<Counter> findWithDynamicQuery( 081 DynamicQuery dynamicQuery, int start, int end) 082 throws SystemException { 083 return getPersistence().findWithDynamicQuery(dynamicQuery, start, end); 084 } 085 086 /** 087 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator) 088 */ 089 public static List<Counter> findWithDynamicQuery( 090 DynamicQuery dynamicQuery, int start, int end, 091 OrderByComparator orderByComparator) throws SystemException { 092 return getPersistence() 093 .findWithDynamicQuery(dynamicQuery, start, end, 094 orderByComparator); 095 } 096 097 /** 098 * @see com.liferay.portal.service.persistence.BasePersistence#remove(com.liferay.portal.model.BaseModel) 099 */ 100 public static Counter remove(Counter counter) throws SystemException { 101 return getPersistence().remove(counter); 102 } 103 104 /** 105 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean) 106 */ 107 public static Counter update(Counter counter, boolean merge) 108 throws SystemException { 109 return getPersistence().update(counter, merge); 110 } 111 112 /** 113 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean, ServiceContext) 114 */ 115 public static Counter update(Counter counter, boolean merge, 116 ServiceContext serviceContext) throws SystemException { 117 return getPersistence().update(counter, merge, serviceContext); 118 } 119 120 /** 121 * Caches the counter in the entity cache if it is enabled. 122 * 123 * @param counter the counter 124 */ 125 public static void cacheResult(com.liferay.counter.model.Counter counter) { 126 getPersistence().cacheResult(counter); 127 } 128 129 /** 130 * Caches the counters in the entity cache if it is enabled. 131 * 132 * @param counters the counters 133 */ 134 public static void cacheResult( 135 java.util.List<com.liferay.counter.model.Counter> counters) { 136 getPersistence().cacheResult(counters); 137 } 138 139 /** 140 * Creates a new counter with the primary key. Does not add the counter to the database. 141 * 142 * @param name the primary key for the new counter 143 * @return the new counter 144 */ 145 public static com.liferay.counter.model.Counter create( 146 java.lang.String name) { 147 return getPersistence().create(name); 148 } 149 150 /** 151 * Removes the counter with the primary key from the database. Also notifies the appropriate model listeners. 152 * 153 * @param name the primary key of the counter 154 * @return the counter that was removed 155 * @throws com.liferay.counter.NoSuchCounterException if a counter with the primary key could not be found 156 * @throws SystemException if a system exception occurred 157 */ 158 public static com.liferay.counter.model.Counter remove( 159 java.lang.String name) 160 throws com.liferay.counter.NoSuchCounterException, 161 com.liferay.portal.kernel.exception.SystemException { 162 return getPersistence().remove(name); 163 } 164 165 public static com.liferay.counter.model.Counter updateImpl( 166 com.liferay.counter.model.Counter counter, boolean merge) 167 throws com.liferay.portal.kernel.exception.SystemException { 168 return getPersistence().updateImpl(counter, merge); 169 } 170 171 /** 172 * Returns the counter with the primary key or throws a {@link com.liferay.counter.NoSuchCounterException} if it could not be found. 173 * 174 * @param name the primary key of the counter 175 * @return the counter 176 * @throws com.liferay.counter.NoSuchCounterException if a counter with the primary key could not be found 177 * @throws SystemException if a system exception occurred 178 */ 179 public static com.liferay.counter.model.Counter findByPrimaryKey( 180 java.lang.String name) 181 throws com.liferay.counter.NoSuchCounterException, 182 com.liferay.portal.kernel.exception.SystemException { 183 return getPersistence().findByPrimaryKey(name); 184 } 185 186 /** 187 * Returns the counter with the primary key or returns <code>null</code> if it could not be found. 188 * 189 * @param name the primary key of the counter 190 * @return the counter, or <code>null</code> if a counter with the primary key could not be found 191 * @throws SystemException if a system exception occurred 192 */ 193 public static com.liferay.counter.model.Counter fetchByPrimaryKey( 194 java.lang.String name) 195 throws com.liferay.portal.kernel.exception.SystemException { 196 return getPersistence().fetchByPrimaryKey(name); 197 } 198 199 /** 200 * Returns all the counters. 201 * 202 * @return the counters 203 * @throws SystemException if a system exception occurred 204 */ 205 public static java.util.List<com.liferay.counter.model.Counter> findAll() 206 throws com.liferay.portal.kernel.exception.SystemException { 207 return getPersistence().findAll(); 208 } 209 210 /** 211 * Returns a range of all the counters. 212 * 213 * <p> 214 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. 215 * </p> 216 * 217 * @param start the lower bound of the range of counters 218 * @param end the upper bound of the range of counters (not inclusive) 219 * @return the range of counters 220 * @throws SystemException if a system exception occurred 221 */ 222 public static java.util.List<com.liferay.counter.model.Counter> findAll( 223 int start, int end) 224 throws com.liferay.portal.kernel.exception.SystemException { 225 return getPersistence().findAll(start, end); 226 } 227 228 /** 229 * Returns an ordered range of all the counters. 230 * 231 * <p> 232 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. 233 * </p> 234 * 235 * @param start the lower bound of the range of counters 236 * @param end the upper bound of the range of counters (not inclusive) 237 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 238 * @return the ordered range of counters 239 * @throws SystemException if a system exception occurred 240 */ 241 public static java.util.List<com.liferay.counter.model.Counter> findAll( 242 int start, int end, 243 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 244 throws com.liferay.portal.kernel.exception.SystemException { 245 return getPersistence().findAll(start, end, orderByComparator); 246 } 247 248 /** 249 * Removes all the counters from the database. 250 * 251 * @throws SystemException if a system exception occurred 252 */ 253 public static void removeAll() 254 throws com.liferay.portal.kernel.exception.SystemException { 255 getPersistence().removeAll(); 256 } 257 258 /** 259 * Returns the number of counters. 260 * 261 * @return the number of counters 262 * @throws SystemException if a system exception occurred 263 */ 264 public static int countAll() 265 throws com.liferay.portal.kernel.exception.SystemException { 266 return getPersistence().countAll(); 267 } 268 269 public static CounterPersistence getPersistence() { 270 if (_persistence == null) { 271 _persistence = (CounterPersistence)PortalBeanLocatorUtil.locate(CounterPersistence.class.getName()); 272 273 ReferenceRegistry.registerReference(CounterUtil.class, 274 "_persistence"); 275 } 276 277 return _persistence; 278 } 279 280 public void setPersistence(CounterPersistence persistence) { 281 _persistence = persistence; 282 283 ReferenceRegistry.registerReference(CounterUtil.class, "_persistence"); 284 } 285 286 private static CounterPersistence _persistence; 287 }