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