001 /** 002 * Copyright (c) 2000-2010 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.portal.service.persistence; 016 017 import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil; 018 import com.liferay.portal.kernel.dao.orm.DynamicQuery; 019 import com.liferay.portal.kernel.exception.SystemException; 020 import com.liferay.portal.kernel.util.OrderByComparator; 021 import com.liferay.portal.model.ClassName; 022 import com.liferay.portal.service.ServiceContext; 023 024 import java.util.List; 025 026 /** 027 * The persistence utility for the class name service. This utility wraps {@link ClassNamePersistenceImpl} 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. 028 * 029 * <p> 030 * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class. 031 * </p> 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 ClassNamePersistence 039 * @see ClassNamePersistenceImpl 040 * @generated 041 */ 042 public class ClassNameUtil { 043 /** 044 * @see com.liferay.portal.service.persistence.BasePersistence#clearCache() 045 */ 046 public static void clearCache() { 047 getPersistence().clearCache(); 048 } 049 050 /** 051 * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel) 052 */ 053 public static void clearCache(ClassName className) { 054 getPersistence().clearCache(className); 055 } 056 057 /** 058 * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery) 059 */ 060 public long countWithDynamicQuery(DynamicQuery dynamicQuery) 061 throws SystemException { 062 return getPersistence().countWithDynamicQuery(dynamicQuery); 063 } 064 065 /** 066 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery) 067 */ 068 public static List<ClassName> findWithDynamicQuery( 069 DynamicQuery dynamicQuery) throws SystemException { 070 return getPersistence().findWithDynamicQuery(dynamicQuery); 071 } 072 073 /** 074 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int) 075 */ 076 public static List<ClassName> findWithDynamicQuery( 077 DynamicQuery dynamicQuery, int start, int end) 078 throws SystemException { 079 return getPersistence().findWithDynamicQuery(dynamicQuery, start, end); 080 } 081 082 /** 083 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator) 084 */ 085 public static List<ClassName> findWithDynamicQuery( 086 DynamicQuery dynamicQuery, int start, int end, 087 OrderByComparator orderByComparator) throws SystemException { 088 return getPersistence() 089 .findWithDynamicQuery(dynamicQuery, start, end, 090 orderByComparator); 091 } 092 093 /** 094 * @see com.liferay.portal.service.persistence.BasePersistence#remove(com.liferay.portal.model.BaseModel) 095 */ 096 public static ClassName remove(ClassName className) 097 throws SystemException { 098 return getPersistence().remove(className); 099 } 100 101 /** 102 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean) 103 */ 104 public static ClassName update(ClassName className, boolean merge) 105 throws SystemException { 106 return getPersistence().update(className, merge); 107 } 108 109 /** 110 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean, ServiceContext) 111 */ 112 public static ClassName update(ClassName className, boolean merge, 113 ServiceContext serviceContext) throws SystemException { 114 return getPersistence().update(className, merge, serviceContext); 115 } 116 117 /** 118 * Caches the class name in the entity cache if it is enabled. 119 * 120 * @param className the class name to cache 121 */ 122 public static void cacheResult(com.liferay.portal.model.ClassName className) { 123 getPersistence().cacheResult(className); 124 } 125 126 /** 127 * Caches the class names in the entity cache if it is enabled. 128 * 129 * @param classNames the class names to cache 130 */ 131 public static void cacheResult( 132 java.util.List<com.liferay.portal.model.ClassName> classNames) { 133 getPersistence().cacheResult(classNames); 134 } 135 136 /** 137 * Creates a new class name with the primary key. Does not add the class name to the database. 138 * 139 * @param classNameId the primary key for the new class name 140 * @return the new class name 141 */ 142 public static com.liferay.portal.model.ClassName create(long classNameId) { 143 return getPersistence().create(classNameId); 144 } 145 146 /** 147 * Removes the class name with the primary key from the database. Also notifies the appropriate model listeners. 148 * 149 * @param classNameId the primary key of the class name to remove 150 * @return the class name that was removed 151 * @throws com.liferay.portal.NoSuchClassNameException if a class name with the primary key could not be found 152 * @throws SystemException if a system exception occurred 153 */ 154 public static com.liferay.portal.model.ClassName remove(long classNameId) 155 throws com.liferay.portal.NoSuchClassNameException, 156 com.liferay.portal.kernel.exception.SystemException { 157 return getPersistence().remove(classNameId); 158 } 159 160 public static com.liferay.portal.model.ClassName updateImpl( 161 com.liferay.portal.model.ClassName className, boolean merge) 162 throws com.liferay.portal.kernel.exception.SystemException { 163 return getPersistence().updateImpl(className, merge); 164 } 165 166 /** 167 * Finds the class name with the primary key or throws a {@link com.liferay.portal.NoSuchClassNameException} if it could not be found. 168 * 169 * @param classNameId the primary key of the class name to find 170 * @return the class name 171 * @throws com.liferay.portal.NoSuchClassNameException if a class name with the primary key could not be found 172 * @throws SystemException if a system exception occurred 173 */ 174 public static com.liferay.portal.model.ClassName findByPrimaryKey( 175 long classNameId) 176 throws com.liferay.portal.NoSuchClassNameException, 177 com.liferay.portal.kernel.exception.SystemException { 178 return getPersistence().findByPrimaryKey(classNameId); 179 } 180 181 /** 182 * Finds the class name with the primary key or returns <code>null</code> if it could not be found. 183 * 184 * @param classNameId the primary key of the class name to find 185 * @return the class name, or <code>null</code> if a class name with the primary key could not be found 186 * @throws SystemException if a system exception occurred 187 */ 188 public static com.liferay.portal.model.ClassName fetchByPrimaryKey( 189 long classNameId) 190 throws com.liferay.portal.kernel.exception.SystemException { 191 return getPersistence().fetchByPrimaryKey(classNameId); 192 } 193 194 /** 195 * Finds the class name where value = ? or throws a {@link com.liferay.portal.NoSuchClassNameException} if it could not be found. 196 * 197 * @param value the value to search with 198 * @return the matching class name 199 * @throws com.liferay.portal.NoSuchClassNameException if a matching class name could not be found 200 * @throws SystemException if a system exception occurred 201 */ 202 public static com.liferay.portal.model.ClassName findByValue( 203 java.lang.String value) 204 throws com.liferay.portal.NoSuchClassNameException, 205 com.liferay.portal.kernel.exception.SystemException { 206 return getPersistence().findByValue(value); 207 } 208 209 /** 210 * Finds the class name where value = ? or returns <code>null</code> if it could not be found. Uses the finder cache. 211 * 212 * @param value the value to search with 213 * @return the matching class name, or <code>null</code> if a matching class name could not be found 214 * @throws SystemException if a system exception occurred 215 */ 216 public static com.liferay.portal.model.ClassName fetchByValue( 217 java.lang.String value) 218 throws com.liferay.portal.kernel.exception.SystemException { 219 return getPersistence().fetchByValue(value); 220 } 221 222 /** 223 * Finds the class name where value = ? or returns <code>null</code> if it could not be found, optionally using the finder cache. 224 * 225 * @param value the value to search with 226 * @return the matching class name, or <code>null</code> if a matching class name could not be found 227 * @throws SystemException if a system exception occurred 228 */ 229 public static com.liferay.portal.model.ClassName fetchByValue( 230 java.lang.String value, boolean retrieveFromCache) 231 throws com.liferay.portal.kernel.exception.SystemException { 232 return getPersistence().fetchByValue(value, retrieveFromCache); 233 } 234 235 /** 236 * Finds all the class names. 237 * 238 * @return the class names 239 * @throws SystemException if a system exception occurred 240 */ 241 public static java.util.List<com.liferay.portal.model.ClassName> findAll() 242 throws com.liferay.portal.kernel.exception.SystemException { 243 return getPersistence().findAll(); 244 } 245 246 /** 247 * Finds a range of all the class names. 248 * 249 * <p> 250 * 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. 251 * </p> 252 * 253 * @param start the lower bound of the range of class names to return 254 * @param end the upper bound of the range of class names to return (not inclusive) 255 * @return the range of class names 256 * @throws SystemException if a system exception occurred 257 */ 258 public static java.util.List<com.liferay.portal.model.ClassName> findAll( 259 int start, int end) 260 throws com.liferay.portal.kernel.exception.SystemException { 261 return getPersistence().findAll(start, end); 262 } 263 264 /** 265 * Finds an ordered range of all the class names. 266 * 267 * <p> 268 * 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. 269 * </p> 270 * 271 * @param start the lower bound of the range of class names to return 272 * @param end the upper bound of the range of class names to return (not inclusive) 273 * @param orderByComparator the comparator to order the results by 274 * @return the ordered range of class names 275 * @throws SystemException if a system exception occurred 276 */ 277 public static java.util.List<com.liferay.portal.model.ClassName> findAll( 278 int start, int end, 279 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 280 throws com.liferay.portal.kernel.exception.SystemException { 281 return getPersistence().findAll(start, end, orderByComparator); 282 } 283 284 /** 285 * Removes the class name where value = ? from the database. 286 * 287 * @param value the value to search with 288 * @throws SystemException if a system exception occurred 289 */ 290 public static void removeByValue(java.lang.String value) 291 throws com.liferay.portal.NoSuchClassNameException, 292 com.liferay.portal.kernel.exception.SystemException { 293 getPersistence().removeByValue(value); 294 } 295 296 /** 297 * Removes all the class names from the database. 298 * 299 * @throws SystemException if a system exception occurred 300 */ 301 public static void removeAll() 302 throws com.liferay.portal.kernel.exception.SystemException { 303 getPersistence().removeAll(); 304 } 305 306 /** 307 * Counts all the class names where value = ?. 308 * 309 * @param value the value to search with 310 * @return the number of matching class names 311 * @throws SystemException if a system exception occurred 312 */ 313 public static int countByValue(java.lang.String value) 314 throws com.liferay.portal.kernel.exception.SystemException { 315 return getPersistence().countByValue(value); 316 } 317 318 /** 319 * Counts all the class names. 320 * 321 * @return the number of class names 322 * @throws SystemException if a system exception occurred 323 */ 324 public static int countAll() 325 throws com.liferay.portal.kernel.exception.SystemException { 326 return getPersistence().countAll(); 327 } 328 329 public static ClassNamePersistence getPersistence() { 330 if (_persistence == null) { 331 _persistence = (ClassNamePersistence)PortalBeanLocatorUtil.locate(ClassNamePersistence.class.getName()); 332 } 333 334 return _persistence; 335 } 336 337 public void setPersistence(ClassNamePersistence persistence) { 338 _persistence = persistence; 339 } 340 341 private static ClassNamePersistence _persistence; 342 }