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