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