001 /** 002 * Copyright (c) 2000-2010 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.service.ServiceContext; 024 025 import java.util.List; 026 027 /** 028 * The persistence utility for the counter service. 029 * 030 * <p> 031 * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regnerate this class. 032 * </p> 033 * 034 * @author Brian Wing Shun Chan 035 * @see CounterPersistence 036 * @see CounterPersistenceImpl 037 * @generated 038 */ 039 public class CounterUtil { 040 /** 041 * @see com.liferay.portal.service.persistence.BasePersistence#clearCache() 042 */ 043 public static void clearCache() { 044 getPersistence().clearCache(); 045 } 046 047 /** 048 * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel) 049 */ 050 public static void clearCache(Counter counter) { 051 getPersistence().clearCache(counter); 052 } 053 054 /** 055 * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery) 056 */ 057 public long countWithDynamicQuery(DynamicQuery dynamicQuery) 058 throws SystemException { 059 return getPersistence().countWithDynamicQuery(dynamicQuery); 060 } 061 062 /** 063 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery) 064 */ 065 public static List<Counter> findWithDynamicQuery(DynamicQuery dynamicQuery) 066 throws SystemException { 067 return getPersistence().findWithDynamicQuery(dynamicQuery); 068 } 069 070 /** 071 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int) 072 */ 073 public static List<Counter> findWithDynamicQuery( 074 DynamicQuery dynamicQuery, int start, int end) 075 throws SystemException { 076 return getPersistence().findWithDynamicQuery(dynamicQuery, start, end); 077 } 078 079 /** 080 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator) 081 */ 082 public static List<Counter> findWithDynamicQuery( 083 DynamicQuery dynamicQuery, int start, int end, 084 OrderByComparator orderByComparator) throws SystemException { 085 return getPersistence() 086 .findWithDynamicQuery(dynamicQuery, start, end, 087 orderByComparator); 088 } 089 090 /** 091 * @see com.liferay.portal.service.persistence.BasePersistence#remove(com.liferay.portal.model.BaseModel) 092 */ 093 public static Counter remove(Counter counter) throws SystemException { 094 return getPersistence().remove(counter); 095 } 096 097 /** 098 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean) 099 */ 100 public static Counter update(Counter counter, boolean merge) 101 throws SystemException { 102 return getPersistence().update(counter, merge); 103 } 104 105 /** 106 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean, ServiceContext) 107 */ 108 public static Counter update(Counter counter, boolean merge, 109 ServiceContext serviceContext) throws SystemException { 110 return getPersistence().update(counter, merge, serviceContext); 111 } 112 113 /** 114 * Caches the counter in the entity cache if it is enabled. 115 * 116 * @param counter the counter to cache 117 */ 118 public static void cacheResult(com.liferay.counter.model.Counter counter) { 119 getPersistence().cacheResult(counter); 120 } 121 122 /** 123 * Caches the counters in the entity cache if it is enabled. 124 * 125 * @param counters the counters to cache 126 */ 127 public static void cacheResult( 128 java.util.List<com.liferay.counter.model.Counter> counters) { 129 getPersistence().cacheResult(counters); 130 } 131 132 /** 133 * Creates a new counter with the primary key. 134 * 135 * @param name the primary key for the new counter 136 * @return the new counter 137 */ 138 public static com.liferay.counter.model.Counter create( 139 java.lang.String name) { 140 return getPersistence().create(name); 141 } 142 143 /** 144 * Removes the counter with the primary key from the database. Also notifies the appropriate model listeners. 145 * 146 * @param name the primary key of the counter to remove 147 * @return the counter that was removed 148 * @throws com.liferay.counter.NoSuchCounterException if a counter with the primary key could not be found 149 * @throws SystemException if a system exception occurred 150 */ 151 public static com.liferay.counter.model.Counter remove( 152 java.lang.String name) 153 throws com.liferay.counter.NoSuchCounterException, 154 com.liferay.portal.kernel.exception.SystemException { 155 return getPersistence().remove(name); 156 } 157 158 public static com.liferay.counter.model.Counter updateImpl( 159 com.liferay.counter.model.Counter counter, boolean merge) 160 throws com.liferay.portal.kernel.exception.SystemException { 161 return getPersistence().updateImpl(counter, merge); 162 } 163 164 /** 165 * Finds the counter with the primary key or throws a {@link com.liferay.counter.NoSuchCounterException} if it could not be found. 166 * 167 * @param name the primary key of the counter to find 168 * @return the counter 169 * @throws com.liferay.counter.NoSuchCounterException if a counter with the primary key could not be found 170 * @throws SystemException if a system exception occurred 171 */ 172 public static com.liferay.counter.model.Counter findByPrimaryKey( 173 java.lang.String name) 174 throws com.liferay.counter.NoSuchCounterException, 175 com.liferay.portal.kernel.exception.SystemException { 176 return getPersistence().findByPrimaryKey(name); 177 } 178 179 /** 180 * Finds the counter with the primary key or returns <code>null</code> if it could not be found. 181 * 182 * @param name the primary key of the counter to find 183 * @return the counter, or <code>null</code> if a counter with the primary key could not be found 184 * @throws SystemException if a system exception occurred 185 */ 186 public static com.liferay.counter.model.Counter fetchByPrimaryKey( 187 java.lang.String name) 188 throws com.liferay.portal.kernel.exception.SystemException { 189 return getPersistence().fetchByPrimaryKey(name); 190 } 191 192 /** 193 * Finds all the counters. 194 * 195 * @return the counters 196 * @throws SystemException if a system exception occurred 197 */ 198 public static java.util.List<com.liferay.counter.model.Counter> findAll() 199 throws com.liferay.portal.kernel.exception.SystemException { 200 return getPersistence().findAll(); 201 } 202 203 /** 204 * Finds a range of all the counters. 205 * 206 * <p> 207 * 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. 208 * </p> 209 * 210 * @param start the lower bound of the range of counters to return 211 * @param end the upper bound of the range of counters to return (not inclusive) 212 * @return the range of counters 213 * @throws SystemException if a system exception occurred 214 */ 215 public static java.util.List<com.liferay.counter.model.Counter> findAll( 216 int start, int end) 217 throws com.liferay.portal.kernel.exception.SystemException { 218 return getPersistence().findAll(start, end); 219 } 220 221 /** 222 * Finds an ordered range of all the counters. 223 * 224 * <p> 225 * 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. 226 * </p> 227 * 228 * @param start the lower bound of the range of counters to return 229 * @param end the upper bound of the range of counters to return (not inclusive) 230 * @param orderByComparator the comparator to order the results by 231 * @return the ordered range of counters 232 * @throws SystemException if a system exception occurred 233 */ 234 public static java.util.List<com.liferay.counter.model.Counter> findAll( 235 int start, int end, 236 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 237 throws com.liferay.portal.kernel.exception.SystemException { 238 return getPersistence().findAll(start, end, orderByComparator); 239 } 240 241 /** 242 * Removes all the counters from the database. 243 * 244 * @throws SystemException if a system exception occurred 245 */ 246 public static void removeAll() 247 throws com.liferay.portal.kernel.exception.SystemException { 248 getPersistence().removeAll(); 249 } 250 251 /** 252 * Counts all the counters. 253 * 254 * @return the number of counters 255 * @throws SystemException if a system exception occurred 256 */ 257 public static int countAll() 258 throws com.liferay.portal.kernel.exception.SystemException { 259 return getPersistence().countAll(); 260 } 261 262 public static CounterPersistence getPersistence() { 263 if (_persistence == null) { 264 _persistence = (CounterPersistence)PortalBeanLocatorUtil.locate(CounterPersistence.class.getName()); 265 } 266 267 return _persistence; 268 } 269 270 public void setPersistence(CounterPersistence persistence) { 271 _persistence = persistence; 272 } 273 274 private static CounterPersistence _persistence; 275 }