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.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#update(com.liferay.portal.model.BaseModel) 098 */ 099 public static ClassName update(ClassName className) 100 throws SystemException { 101 return getPersistence().update(className); 102 } 103 104 /** 105 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, ServiceContext) 106 */ 107 public static ClassName update(ClassName className, 108 ServiceContext serviceContext) throws SystemException { 109 return getPersistence().update(className, serviceContext); 110 } 111 112 /** 113 * Returns the class name where value = ? or throws a {@link com.liferay.portal.NoSuchClassNameException} if it could not be found. 114 * 115 * @param value the value 116 * @return the matching class name 117 * @throws com.liferay.portal.NoSuchClassNameException if a matching class name could not be found 118 * @throws SystemException if a system exception occurred 119 */ 120 public static com.liferay.portal.model.ClassName findByValue( 121 java.lang.String value) 122 throws com.liferay.portal.NoSuchClassNameException, 123 com.liferay.portal.kernel.exception.SystemException { 124 return getPersistence().findByValue(value); 125 } 126 127 /** 128 * Returns the class name where value = ? or returns <code>null</code> if it could not be found. Uses the finder cache. 129 * 130 * @param value the value 131 * @return the matching class name, or <code>null</code> if a matching class name could not be found 132 * @throws SystemException if a system exception occurred 133 */ 134 public static com.liferay.portal.model.ClassName fetchByValue( 135 java.lang.String value) 136 throws com.liferay.portal.kernel.exception.SystemException { 137 return getPersistence().fetchByValue(value); 138 } 139 140 /** 141 * Returns the class name where value = ? or returns <code>null</code> if it could not be found, optionally using the finder cache. 142 * 143 * @param value the value 144 * @param retrieveFromCache whether to use the finder cache 145 * @return the matching class name, or <code>null</code> if a matching class name could not be found 146 * @throws SystemException if a system exception occurred 147 */ 148 public static com.liferay.portal.model.ClassName fetchByValue( 149 java.lang.String value, boolean retrieveFromCache) 150 throws com.liferay.portal.kernel.exception.SystemException { 151 return getPersistence().fetchByValue(value, retrieveFromCache); 152 } 153 154 /** 155 * Removes the class name where value = ? from the database. 156 * 157 * @param value the value 158 * @return the class name that was removed 159 * @throws SystemException if a system exception occurred 160 */ 161 public static com.liferay.portal.model.ClassName removeByValue( 162 java.lang.String value) 163 throws com.liferay.portal.NoSuchClassNameException, 164 com.liferay.portal.kernel.exception.SystemException { 165 return getPersistence().removeByValue(value); 166 } 167 168 /** 169 * Returns the number of class names where value = ?. 170 * 171 * @param value the value 172 * @return the number of matching class names 173 * @throws SystemException if a system exception occurred 174 */ 175 public static int countByValue(java.lang.String value) 176 throws com.liferay.portal.kernel.exception.SystemException { 177 return getPersistence().countByValue(value); 178 } 179 180 /** 181 * Caches the class name in the entity cache if it is enabled. 182 * 183 * @param className the class name 184 */ 185 public static void cacheResult(com.liferay.portal.model.ClassName className) { 186 getPersistence().cacheResult(className); 187 } 188 189 /** 190 * Caches the class names in the entity cache if it is enabled. 191 * 192 * @param classNames the class names 193 */ 194 public static void cacheResult( 195 java.util.List<com.liferay.portal.model.ClassName> classNames) { 196 getPersistence().cacheResult(classNames); 197 } 198 199 /** 200 * Creates a new class name with the primary key. Does not add the class name to the database. 201 * 202 * @param classNameId the primary key for the new class name 203 * @return the new class name 204 */ 205 public static com.liferay.portal.model.ClassName create(long classNameId) { 206 return getPersistence().create(classNameId); 207 } 208 209 /** 210 * Removes the class name with the primary key from the database. Also notifies the appropriate model listeners. 211 * 212 * @param classNameId the primary key of the class name 213 * @return the class name that was removed 214 * @throws com.liferay.portal.NoSuchClassNameException if a class name with the primary key could not be found 215 * @throws SystemException if a system exception occurred 216 */ 217 public static com.liferay.portal.model.ClassName remove(long classNameId) 218 throws com.liferay.portal.NoSuchClassNameException, 219 com.liferay.portal.kernel.exception.SystemException { 220 return getPersistence().remove(classNameId); 221 } 222 223 public static com.liferay.portal.model.ClassName updateImpl( 224 com.liferay.portal.model.ClassName className) 225 throws com.liferay.portal.kernel.exception.SystemException { 226 return getPersistence().updateImpl(className); 227 } 228 229 /** 230 * Returns the class name with the primary key or throws a {@link com.liferay.portal.NoSuchClassNameException} if it could not be found. 231 * 232 * @param classNameId the primary key of the class name 233 * @return the class name 234 * @throws com.liferay.portal.NoSuchClassNameException if a class name with the primary key could not be found 235 * @throws SystemException if a system exception occurred 236 */ 237 public static com.liferay.portal.model.ClassName findByPrimaryKey( 238 long classNameId) 239 throws com.liferay.portal.NoSuchClassNameException, 240 com.liferay.portal.kernel.exception.SystemException { 241 return getPersistence().findByPrimaryKey(classNameId); 242 } 243 244 /** 245 * Returns the class name with the primary key or returns <code>null</code> if it could not be found. 246 * 247 * @param classNameId the primary key of the class name 248 * @return the class name, or <code>null</code> if a class name with the primary key could not be found 249 * @throws SystemException if a system exception occurred 250 */ 251 public static com.liferay.portal.model.ClassName fetchByPrimaryKey( 252 long classNameId) 253 throws com.liferay.portal.kernel.exception.SystemException { 254 return getPersistence().fetchByPrimaryKey(classNameId); 255 } 256 257 /** 258 * Returns all the class names. 259 * 260 * @return the class names 261 * @throws SystemException if a system exception occurred 262 */ 263 public static java.util.List<com.liferay.portal.model.ClassName> findAll() 264 throws com.liferay.portal.kernel.exception.SystemException { 265 return getPersistence().findAll(); 266 } 267 268 /** 269 * Returns a range of all the class names. 270 * 271 * <p> 272 * 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.portal.model.impl.ClassNameModelImpl}. 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. 273 * </p> 274 * 275 * @param start the lower bound of the range of class names 276 * @param end the upper bound of the range of class names (not inclusive) 277 * @return the 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 throws com.liferay.portal.kernel.exception.SystemException { 283 return getPersistence().findAll(start, end); 284 } 285 286 /** 287 * Returns an ordered range of all the class names. 288 * 289 * <p> 290 * 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.portal.model.impl.ClassNameModelImpl}. 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. 291 * </p> 292 * 293 * @param start the lower bound of the range of class names 294 * @param end the upper bound of the range of class names (not inclusive) 295 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 296 * @return the ordered range of class names 297 * @throws SystemException if a system exception occurred 298 */ 299 public static java.util.List<com.liferay.portal.model.ClassName> findAll( 300 int start, int end, 301 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 302 throws com.liferay.portal.kernel.exception.SystemException { 303 return getPersistence().findAll(start, end, orderByComparator); 304 } 305 306 /** 307 * Removes all the class names from the database. 308 * 309 * @throws SystemException if a system exception occurred 310 */ 311 public static void removeAll() 312 throws com.liferay.portal.kernel.exception.SystemException { 313 getPersistence().removeAll(); 314 } 315 316 /** 317 * Returns the number of class names. 318 * 319 * @return the number of class names 320 * @throws SystemException if a system exception occurred 321 */ 322 public static int countAll() 323 throws com.liferay.portal.kernel.exception.SystemException { 324 return getPersistence().countAll(); 325 } 326 327 public static ClassNamePersistence getPersistence() { 328 if (_persistence == null) { 329 _persistence = (ClassNamePersistence)PortalBeanLocatorUtil.locate(ClassNamePersistence.class.getName()); 330 331 ReferenceRegistry.registerReference(ClassNameUtil.class, 332 "_persistence"); 333 } 334 335 return _persistence; 336 } 337 338 /** 339 * @deprecated 340 */ 341 public void setPersistence(ClassNamePersistence persistence) { 342 } 343 344 private static ClassNamePersistence _persistence; 345 }