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