001 /** 002 * Copyright (c) 2000-2012 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 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 * Caches the image in the entity cache if it is enabled. 112 * 113 * @param image the image 114 */ 115 public static void cacheResult(com.liferay.portal.model.Image image) { 116 getPersistence().cacheResult(image); 117 } 118 119 /** 120 * Caches the images in the entity cache if it is enabled. 121 * 122 * @param images the images 123 */ 124 public static void cacheResult( 125 java.util.List<com.liferay.portal.model.Image> images) { 126 getPersistence().cacheResult(images); 127 } 128 129 /** 130 * Creates a new image with the primary key. Does not add the image to the database. 131 * 132 * @param imageId the primary key for the new image 133 * @return the new image 134 */ 135 public static com.liferay.portal.model.Image create(long imageId) { 136 return getPersistence().create(imageId); 137 } 138 139 /** 140 * Removes the image with the primary key from the database. Also notifies the appropriate model listeners. 141 * 142 * @param imageId the primary key of the image 143 * @return the image that was removed 144 * @throws com.liferay.portal.NoSuchImageException if a image with the primary key could not be found 145 * @throws SystemException if a system exception occurred 146 */ 147 public static com.liferay.portal.model.Image remove(long imageId) 148 throws com.liferay.portal.NoSuchImageException, 149 com.liferay.portal.kernel.exception.SystemException { 150 return getPersistence().remove(imageId); 151 } 152 153 public static com.liferay.portal.model.Image updateImpl( 154 com.liferay.portal.model.Image image) 155 throws com.liferay.portal.kernel.exception.SystemException { 156 return getPersistence().updateImpl(image); 157 } 158 159 /** 160 * Returns the image with the primary key or throws a {@link com.liferay.portal.NoSuchImageException} if it could not be found. 161 * 162 * @param imageId the primary key of the image 163 * @return the image 164 * @throws com.liferay.portal.NoSuchImageException if a image with the primary key could not be found 165 * @throws SystemException if a system exception occurred 166 */ 167 public static com.liferay.portal.model.Image findByPrimaryKey(long imageId) 168 throws com.liferay.portal.NoSuchImageException, 169 com.liferay.portal.kernel.exception.SystemException { 170 return getPersistence().findByPrimaryKey(imageId); 171 } 172 173 /** 174 * Returns the image with the primary key or returns <code>null</code> if it could not be found. 175 * 176 * @param imageId the primary key of the image 177 * @return the image, or <code>null</code> if a image with the primary key could not be found 178 * @throws SystemException if a system exception occurred 179 */ 180 public static com.liferay.portal.model.Image fetchByPrimaryKey(long imageId) 181 throws com.liferay.portal.kernel.exception.SystemException { 182 return getPersistence().fetchByPrimaryKey(imageId); 183 } 184 185 /** 186 * Returns all the images where size < ?. 187 * 188 * @param size the size 189 * @return the matching images 190 * @throws SystemException if a system exception occurred 191 */ 192 public static java.util.List<com.liferay.portal.model.Image> findByLtSize( 193 int size) throws com.liferay.portal.kernel.exception.SystemException { 194 return getPersistence().findByLtSize(size); 195 } 196 197 /** 198 * Returns a range of all the images where size < ?. 199 * 200 * <p> 201 * 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. 202 * </p> 203 * 204 * @param size the size 205 * @param start the lower bound of the range of images 206 * @param end the upper bound of the range of images (not inclusive) 207 * @return the range of matching images 208 * @throws SystemException if a system exception occurred 209 */ 210 public static java.util.List<com.liferay.portal.model.Image> findByLtSize( 211 int size, int start, int end) 212 throws com.liferay.portal.kernel.exception.SystemException { 213 return getPersistence().findByLtSize(size, start, end); 214 } 215 216 /** 217 * Returns an ordered range of all the images where size < ?. 218 * 219 * <p> 220 * 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. 221 * </p> 222 * 223 * @param size the size 224 * @param start the lower bound of the range of images 225 * @param end the upper bound of the range of images (not inclusive) 226 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 227 * @return the ordered range of matching images 228 * @throws SystemException if a system exception occurred 229 */ 230 public static java.util.List<com.liferay.portal.model.Image> findByLtSize( 231 int size, int start, int end, 232 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 233 throws com.liferay.portal.kernel.exception.SystemException { 234 return getPersistence().findByLtSize(size, start, end, orderByComparator); 235 } 236 237 /** 238 * Returns the first image in the ordered set where size < ?. 239 * 240 * @param size the size 241 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) 242 * @return the first matching image 243 * @throws com.liferay.portal.NoSuchImageException if a matching image could not be found 244 * @throws SystemException if a system exception occurred 245 */ 246 public static com.liferay.portal.model.Image findByLtSize_First(int size, 247 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 248 throws com.liferay.portal.NoSuchImageException, 249 com.liferay.portal.kernel.exception.SystemException { 250 return getPersistence().findByLtSize_First(size, orderByComparator); 251 } 252 253 /** 254 * Returns the first image in the ordered set where size < ?. 255 * 256 * @param size the size 257 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) 258 * @return the first matching image, or <code>null</code> if a matching image could not be found 259 * @throws SystemException if a system exception occurred 260 */ 261 public static com.liferay.portal.model.Image fetchByLtSize_First(int size, 262 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 263 throws com.liferay.portal.kernel.exception.SystemException { 264 return getPersistence().fetchByLtSize_First(size, orderByComparator); 265 } 266 267 /** 268 * Returns the last image in the ordered set where size < ?. 269 * 270 * @param size the size 271 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) 272 * @return the last matching image 273 * @throws com.liferay.portal.NoSuchImageException if a matching image could not be found 274 * @throws SystemException if a system exception occurred 275 */ 276 public static com.liferay.portal.model.Image findByLtSize_Last(int size, 277 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 278 throws com.liferay.portal.NoSuchImageException, 279 com.liferay.portal.kernel.exception.SystemException { 280 return getPersistence().findByLtSize_Last(size, orderByComparator); 281 } 282 283 /** 284 * Returns the last image in the ordered set where size < ?. 285 * 286 * @param size the size 287 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) 288 * @return the last matching image, or <code>null</code> if a matching image could not be found 289 * @throws SystemException if a system exception occurred 290 */ 291 public static com.liferay.portal.model.Image fetchByLtSize_Last(int size, 292 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 293 throws com.liferay.portal.kernel.exception.SystemException { 294 return getPersistence().fetchByLtSize_Last(size, orderByComparator); 295 } 296 297 /** 298 * Returns the images before and after the current image in the ordered set where size < ?. 299 * 300 * @param imageId the primary key of the current image 301 * @param size the size 302 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) 303 * @return the previous, current, and next image 304 * @throws com.liferay.portal.NoSuchImageException if a image with the primary key could not be found 305 * @throws SystemException if a system exception occurred 306 */ 307 public static com.liferay.portal.model.Image[] findByLtSize_PrevAndNext( 308 long imageId, int size, 309 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 310 throws com.liferay.portal.NoSuchImageException, 311 com.liferay.portal.kernel.exception.SystemException { 312 return getPersistence() 313 .findByLtSize_PrevAndNext(imageId, size, orderByComparator); 314 } 315 316 /** 317 * Returns all the images. 318 * 319 * @return the images 320 * @throws SystemException if a system exception occurred 321 */ 322 public static java.util.List<com.liferay.portal.model.Image> findAll() 323 throws com.liferay.portal.kernel.exception.SystemException { 324 return getPersistence().findAll(); 325 } 326 327 /** 328 * Returns a range of all the images. 329 * 330 * <p> 331 * 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. 332 * </p> 333 * 334 * @param start the lower bound of the range of images 335 * @param end the upper bound of the range of images (not inclusive) 336 * @return the range of images 337 * @throws SystemException if a system exception occurred 338 */ 339 public static java.util.List<com.liferay.portal.model.Image> findAll( 340 int start, int end) 341 throws com.liferay.portal.kernel.exception.SystemException { 342 return getPersistence().findAll(start, end); 343 } 344 345 /** 346 * Returns an ordered range of all the images. 347 * 348 * <p> 349 * 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. 350 * </p> 351 * 352 * @param start the lower bound of the range of images 353 * @param end the upper bound of the range of images (not inclusive) 354 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 355 * @return the ordered range of images 356 * @throws SystemException if a system exception occurred 357 */ 358 public static java.util.List<com.liferay.portal.model.Image> findAll( 359 int start, int end, 360 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 361 throws com.liferay.portal.kernel.exception.SystemException { 362 return getPersistence().findAll(start, end, orderByComparator); 363 } 364 365 /** 366 * Removes all the images where size < ? from the database. 367 * 368 * @param size the size 369 * @throws SystemException if a system exception occurred 370 */ 371 public static void removeByLtSize(int size) 372 throws com.liferay.portal.kernel.exception.SystemException { 373 getPersistence().removeByLtSize(size); 374 } 375 376 /** 377 * Removes all the images from the database. 378 * 379 * @throws SystemException if a system exception occurred 380 */ 381 public static void removeAll() 382 throws com.liferay.portal.kernel.exception.SystemException { 383 getPersistence().removeAll(); 384 } 385 386 /** 387 * Returns the number of images where size < ?. 388 * 389 * @param size the size 390 * @return the number of matching images 391 * @throws SystemException if a system exception occurred 392 */ 393 public static int countByLtSize(int size) 394 throws com.liferay.portal.kernel.exception.SystemException { 395 return getPersistence().countByLtSize(size); 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 421 */ 422 public void setPersistence(ImagePersistence persistence) { 423 } 424 425 private static ImagePersistence _persistence; 426 }