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