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