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.Image; 024 import com.liferay.portal.service.ServiceContext; 025 026 import java.util.List; 027 028 /** 029 * The persistence utility for the image service. This utility wraps {@link com.liferay.portal.service.persistence.impl.ImagePersistenceImpl} 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 ImagePersistence 037 * @see com.liferay.portal.service.persistence.impl.ImagePersistenceImpl 038 * @generated 039 */ 040 @ProviderType 041 public class ImageUtil { 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(Image image) { 059 getPersistence().clearCache(image); 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<Image> findWithDynamicQuery(DynamicQuery dynamicQuery) { 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<Image> findWithDynamicQuery(DynamicQuery dynamicQuery, 080 int start, int end) { 081 return getPersistence().findWithDynamicQuery(dynamicQuery, start, end); 082 } 083 084 /** 085 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator) 086 */ 087 public static List<Image> findWithDynamicQuery(DynamicQuery dynamicQuery, 088 int start, int end, OrderByComparator<Image> orderByComparator) { 089 return getPersistence() 090 .findWithDynamicQuery(dynamicQuery, start, end, 091 orderByComparator); 092 } 093 094 /** 095 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel) 096 */ 097 public static Image update(Image image) { 098 return getPersistence().update(image); 099 } 100 101 /** 102 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, ServiceContext) 103 */ 104 public static Image update(Image image, ServiceContext serviceContext) { 105 return getPersistence().update(image, serviceContext); 106 } 107 108 /** 109 * Returns all the images where size < ?. 110 * 111 * @param size the size 112 * @return the matching images 113 */ 114 public static List<Image> findByLtSize(int size) { 115 return getPersistence().findByLtSize(size); 116 } 117 118 /** 119 * Returns a range of all the images where size < ?. 120 * 121 * <p> 122 * 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 ImageModelImpl}. 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. 123 * </p> 124 * 125 * @param size the size 126 * @param start the lower bound of the range of images 127 * @param end the upper bound of the range of images (not inclusive) 128 * @return the range of matching images 129 */ 130 public static List<Image> findByLtSize(int size, int start, int end) { 131 return getPersistence().findByLtSize(size, start, end); 132 } 133 134 /** 135 * Returns an ordered range of all the images where size < ?. 136 * 137 * <p> 138 * 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 ImageModelImpl}. 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. 139 * </p> 140 * 141 * @param size the size 142 * @param start the lower bound of the range of images 143 * @param end the upper bound of the range of images (not inclusive) 144 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 145 * @return the ordered range of matching images 146 */ 147 public static List<Image> findByLtSize(int size, int start, int end, 148 OrderByComparator<Image> orderByComparator) { 149 return getPersistence().findByLtSize(size, start, end, orderByComparator); 150 } 151 152 /** 153 * Returns the first image in the ordered set where size < ?. 154 * 155 * @param size the size 156 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) 157 * @return the first matching image 158 * @throws NoSuchImageException if a matching image could not be found 159 */ 160 public static Image findByLtSize_First(int size, 161 OrderByComparator<Image> orderByComparator) 162 throws com.liferay.portal.NoSuchImageException { 163 return getPersistence().findByLtSize_First(size, orderByComparator); 164 } 165 166 /** 167 * Returns the first image in the ordered set where size < ?. 168 * 169 * @param size the size 170 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) 171 * @return the first matching image, or <code>null</code> if a matching image could not be found 172 */ 173 public static Image fetchByLtSize_First(int size, 174 OrderByComparator<Image> orderByComparator) { 175 return getPersistence().fetchByLtSize_First(size, orderByComparator); 176 } 177 178 /** 179 * Returns the last image in the ordered set where size < ?. 180 * 181 * @param size the size 182 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) 183 * @return the last matching image 184 * @throws NoSuchImageException if a matching image could not be found 185 */ 186 public static Image findByLtSize_Last(int size, 187 OrderByComparator<Image> orderByComparator) 188 throws com.liferay.portal.NoSuchImageException { 189 return getPersistence().findByLtSize_Last(size, orderByComparator); 190 } 191 192 /** 193 * Returns the last image in the ordered set where size < ?. 194 * 195 * @param size the size 196 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) 197 * @return the last matching image, or <code>null</code> if a matching image could not be found 198 */ 199 public static Image fetchByLtSize_Last(int size, 200 OrderByComparator<Image> orderByComparator) { 201 return getPersistence().fetchByLtSize_Last(size, orderByComparator); 202 } 203 204 /** 205 * Returns the images before and after the current image in the ordered set where size < ?. 206 * 207 * @param imageId the primary key of the current image 208 * @param size the size 209 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) 210 * @return the previous, current, and next image 211 * @throws NoSuchImageException if a image with the primary key could not be found 212 */ 213 public static Image[] findByLtSize_PrevAndNext(long imageId, int size, 214 OrderByComparator<Image> orderByComparator) 215 throws com.liferay.portal.NoSuchImageException { 216 return getPersistence() 217 .findByLtSize_PrevAndNext(imageId, size, orderByComparator); 218 } 219 220 /** 221 * Removes all the images where size < ? from the database. 222 * 223 * @param size the size 224 */ 225 public static void removeByLtSize(int size) { 226 getPersistence().removeByLtSize(size); 227 } 228 229 /** 230 * Returns the number of images where size < ?. 231 * 232 * @param size the size 233 * @return the number of matching images 234 */ 235 public static int countByLtSize(int size) { 236 return getPersistence().countByLtSize(size); 237 } 238 239 /** 240 * Caches the image in the entity cache if it is enabled. 241 * 242 * @param image the image 243 */ 244 public static void cacheResult(Image image) { 245 getPersistence().cacheResult(image); 246 } 247 248 /** 249 * Caches the images in the entity cache if it is enabled. 250 * 251 * @param images the images 252 */ 253 public static void cacheResult(List<Image> images) { 254 getPersistence().cacheResult(images); 255 } 256 257 /** 258 * Creates a new image with the primary key. Does not add the image to the database. 259 * 260 * @param imageId the primary key for the new image 261 * @return the new image 262 */ 263 public static Image create(long imageId) { 264 return getPersistence().create(imageId); 265 } 266 267 /** 268 * Removes the image with the primary key from the database. Also notifies the appropriate model listeners. 269 * 270 * @param imageId the primary key of the image 271 * @return the image that was removed 272 * @throws NoSuchImageException if a image with the primary key could not be found 273 */ 274 public static Image remove(long imageId) 275 throws com.liferay.portal.NoSuchImageException { 276 return getPersistence().remove(imageId); 277 } 278 279 public static Image updateImpl(Image image) { 280 return getPersistence().updateImpl(image); 281 } 282 283 /** 284 * Returns the image with the primary key or throws a {@link NoSuchImageException} if it could not be found. 285 * 286 * @param imageId the primary key of the image 287 * @return the image 288 * @throws NoSuchImageException if a image with the primary key could not be found 289 */ 290 public static Image findByPrimaryKey(long imageId) 291 throws com.liferay.portal.NoSuchImageException { 292 return getPersistence().findByPrimaryKey(imageId); 293 } 294 295 /** 296 * Returns the image with the primary key or returns <code>null</code> if it could not be found. 297 * 298 * @param imageId the primary key of the image 299 * @return the image, or <code>null</code> if a image with the primary key could not be found 300 */ 301 public static Image fetchByPrimaryKey(long imageId) { 302 return getPersistence().fetchByPrimaryKey(imageId); 303 } 304 305 public static java.util.Map<java.io.Serializable, Image> fetchByPrimaryKeys( 306 java.util.Set<java.io.Serializable> primaryKeys) { 307 return getPersistence().fetchByPrimaryKeys(primaryKeys); 308 } 309 310 /** 311 * Returns all the images. 312 * 313 * @return the images 314 */ 315 public static List<Image> findAll() { 316 return getPersistence().findAll(); 317 } 318 319 /** 320 * Returns a range of all the images. 321 * 322 * <p> 323 * 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 ImageModelImpl}. 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. 324 * </p> 325 * 326 * @param start the lower bound of the range of images 327 * @param end the upper bound of the range of images (not inclusive) 328 * @return the range of images 329 */ 330 public static List<Image> findAll(int start, int end) { 331 return getPersistence().findAll(start, end); 332 } 333 334 /** 335 * Returns an ordered range of all the images. 336 * 337 * <p> 338 * 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 ImageModelImpl}. 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. 339 * </p> 340 * 341 * @param start the lower bound of the range of images 342 * @param end the upper bound of the range of images (not inclusive) 343 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 344 * @return the ordered range of images 345 */ 346 public static List<Image> findAll(int start, int end, 347 OrderByComparator<Image> orderByComparator) { 348 return getPersistence().findAll(start, end, orderByComparator); 349 } 350 351 /** 352 * Removes all the images from the database. 353 */ 354 public static void removeAll() { 355 getPersistence().removeAll(); 356 } 357 358 /** 359 * Returns the number of images. 360 * 361 * @return the number of images 362 */ 363 public static int countAll() { 364 return getPersistence().countAll(); 365 } 366 367 public static ImagePersistence getPersistence() { 368 if (_persistence == null) { 369 _persistence = (ImagePersistence)PortalBeanLocatorUtil.locate(ImagePersistence.class.getName()); 370 371 ReferenceRegistry.registerReference(ImageUtil.class, "_persistence"); 372 } 373 374 return _persistence; 375 } 376 377 /** 378 * @deprecated As of 6.2.0 379 */ 380 @Deprecated 381 public void setPersistence(ImagePersistence persistence) { 382 } 383 384 private static ImagePersistence _persistence; 385 }