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