001 /** 002 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved. 003 * 004 * This library is free software; you can redistribute it and/or modify it under 005 * the terms of the GNU Lesser General Public License as published by the Free 006 * Software Foundation; either version 2.1 of the License, or (at your option) 007 * any later version. 008 * 009 * This library is distributed in the hope that it will be useful, but WITHOUT 010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 011 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 012 * details. 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#update(com.liferay.portal.model.BaseModel) 099 */ 100 public static Counter update(Counter counter) throws SystemException { 101 return getPersistence().update(counter); 102 } 103 104 /** 105 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, ServiceContext) 106 */ 107 public static Counter update(Counter counter, ServiceContext serviceContext) 108 throws SystemException { 109 return getPersistence().update(counter, serviceContext); 110 } 111 112 /** 113 * Caches the counter in the entity cache if it is enabled. 114 * 115 * @param counter the counter 116 */ 117 public static void cacheResult(com.liferay.counter.model.Counter counter) { 118 getPersistence().cacheResult(counter); 119 } 120 121 /** 122 * Caches the counters in the entity cache if it is enabled. 123 * 124 * @param counters the counters 125 */ 126 public static void cacheResult( 127 java.util.List<com.liferay.counter.model.Counter> counters) { 128 getPersistence().cacheResult(counters); 129 } 130 131 /** 132 * Creates a new counter with the primary key. Does not add the counter to the database. 133 * 134 * @param name the primary key for the new counter 135 * @return the new counter 136 */ 137 public static com.liferay.counter.model.Counter create( 138 java.lang.String name) { 139 return getPersistence().create(name); 140 } 141 142 /** 143 * Removes the counter with the primary key from the database. Also notifies the appropriate model listeners. 144 * 145 * @param name the primary key of the counter 146 * @return the counter that was removed 147 * @throws com.liferay.counter.NoSuchCounterException if a counter with the primary key could not be found 148 * @throws SystemException if a system exception occurred 149 */ 150 public static com.liferay.counter.model.Counter remove( 151 java.lang.String name) 152 throws com.liferay.counter.NoSuchCounterException, 153 com.liferay.portal.kernel.exception.SystemException { 154 return getPersistence().remove(name); 155 } 156 157 public static com.liferay.counter.model.Counter updateImpl( 158 com.liferay.counter.model.Counter counter) 159 throws com.liferay.portal.kernel.exception.SystemException { 160 return getPersistence().updateImpl(counter); 161 } 162 163 /** 164 * Returns the counter with the primary key or throws a {@link com.liferay.counter.NoSuchCounterException} if it could not be found. 165 * 166 * @param name the primary key of the counter 167 * @return the counter 168 * @throws com.liferay.counter.NoSuchCounterException if a counter with the primary key could not be found 169 * @throws SystemException if a system exception occurred 170 */ 171 public static com.liferay.counter.model.Counter findByPrimaryKey( 172 java.lang.String name) 173 throws com.liferay.counter.NoSuchCounterException, 174 com.liferay.portal.kernel.exception.SystemException { 175 return getPersistence().findByPrimaryKey(name); 176 } 177 178 /** 179 * Returns the counter with the primary key or returns <code>null</code> if it could not be found. 180 * 181 * @param name the primary key of the counter 182 * @return the counter, or <code>null</code> if a counter with the primary key could not be found 183 * @throws SystemException if a system exception occurred 184 */ 185 public static com.liferay.counter.model.Counter fetchByPrimaryKey( 186 java.lang.String name) 187 throws com.liferay.portal.kernel.exception.SystemException { 188 return getPersistence().fetchByPrimaryKey(name); 189 } 190 191 /** 192 * Returns all the counters. 193 * 194 * @return the counters 195 * @throws SystemException if a system exception occurred 196 */ 197 public static java.util.List<com.liferay.counter.model.Counter> findAll() 198 throws com.liferay.portal.kernel.exception.SystemException { 199 return getPersistence().findAll(); 200 } 201 202 /** 203 * Returns a range of all the counters. 204 * 205 * <p> 206 * 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. 207 * </p> 208 * 209 * @param start the lower bound of the range of counters 210 * @param end the upper bound of the range of counters (not inclusive) 211 * @return the range of counters 212 * @throws SystemException if a system exception occurred 213 */ 214 public static java.util.List<com.liferay.counter.model.Counter> findAll( 215 int start, int end) 216 throws com.liferay.portal.kernel.exception.SystemException { 217 return getPersistence().findAll(start, end); 218 } 219 220 /** 221 * Returns an ordered range of all the counters. 222 * 223 * <p> 224 * 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. 225 * </p> 226 * 227 * @param start the lower bound of the range of counters 228 * @param end the upper bound of the range of counters (not inclusive) 229 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 230 * @return the ordered range of counters 231 * @throws SystemException if a system exception occurred 232 */ 233 public static java.util.List<com.liferay.counter.model.Counter> findAll( 234 int start, int end, 235 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 236 throws com.liferay.portal.kernel.exception.SystemException { 237 return getPersistence().findAll(start, end, orderByComparator); 238 } 239 240 /** 241 * Removes all the counters from the database. 242 * 243 * @throws SystemException if a system exception occurred 244 */ 245 public static void removeAll() 246 throws com.liferay.portal.kernel.exception.SystemException { 247 getPersistence().removeAll(); 248 } 249 250 /** 251 * Returns the number of counters. 252 * 253 * @return the number of counters 254 * @throws SystemException if a system exception occurred 255 */ 256 public static int countAll() 257 throws com.liferay.portal.kernel.exception.SystemException { 258 return getPersistence().countAll(); 259 } 260 261 public static CounterPersistence getPersistence() { 262 if (_persistence == null) { 263 _persistence = (CounterPersistence)PortalBeanLocatorUtil.locate(CounterPersistence.class.getName()); 264 265 ReferenceRegistry.registerReference(CounterUtil.class, 266 "_persistence"); 267 } 268 269 return _persistence; 270 } 271 272 /** 273 * @deprecated 274 */ 275 public void setPersistence(CounterPersistence persistence) { 276 } 277 278 private static CounterPersistence _persistence; 279 }