001    /**
002     * Copyright (c) 2000-2010 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.model.Image;
022    import com.liferay.portal.service.ServiceContext;
023    
024    import java.util.List;
025    
026    /**
027     * 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.
028     *
029     * <p>
030     * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
031     * </p>
032     *
033     * <p>
034     * Caching information and settings can be found in <code>portal.properties</code>
035     * </p>
036     *
037     * @author Brian Wing Shun Chan
038     * @see ImagePersistence
039     * @see ImagePersistenceImpl
040     * @generated
041     */
042    public class ImageUtil {
043            /**
044             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache()
045             */
046            public static void clearCache() {
047                    getPersistence().clearCache();
048            }
049    
050            /**
051             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel)
052             */
053            public static void clearCache(Image image) {
054                    getPersistence().clearCache(image);
055            }
056    
057            /**
058             * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery)
059             */
060            public long countWithDynamicQuery(DynamicQuery dynamicQuery)
061                    throws SystemException {
062                    return getPersistence().countWithDynamicQuery(dynamicQuery);
063            }
064    
065            /**
066             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery)
067             */
068            public static List<Image> findWithDynamicQuery(DynamicQuery dynamicQuery)
069                    throws SystemException {
070                    return getPersistence().findWithDynamicQuery(dynamicQuery);
071            }
072    
073            /**
074             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int)
075             */
076            public static List<Image> findWithDynamicQuery(DynamicQuery dynamicQuery,
077                    int start, int end) throws SystemException {
078                    return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
079            }
080    
081            /**
082             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)
083             */
084            public static List<Image> findWithDynamicQuery(DynamicQuery dynamicQuery,
085                    int start, int end, OrderByComparator orderByComparator)
086                    throws SystemException {
087                    return getPersistence()
088                                       .findWithDynamicQuery(dynamicQuery, start, end,
089                            orderByComparator);
090            }
091    
092            /**
093             * @see com.liferay.portal.service.persistence.BasePersistence#remove(com.liferay.portal.model.BaseModel)
094             */
095            public static Image remove(Image image) throws SystemException {
096                    return getPersistence().remove(image);
097            }
098    
099            /**
100             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)
101             */
102            public static Image update(Image image, boolean merge)
103                    throws SystemException {
104                    return getPersistence().update(image, merge);
105            }
106    
107            /**
108             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean, ServiceContext)
109             */
110            public static Image update(Image image, boolean merge,
111                    ServiceContext serviceContext) throws SystemException {
112                    return getPersistence().update(image, merge, serviceContext);
113            }
114    
115            /**
116            * Caches the image in the entity cache if it is enabled.
117            *
118            * @param image the image to cache
119            */
120            public static void cacheResult(com.liferay.portal.model.Image image) {
121                    getPersistence().cacheResult(image);
122            }
123    
124            /**
125            * Caches the images in the entity cache if it is enabled.
126            *
127            * @param images the images to cache
128            */
129            public static void cacheResult(
130                    java.util.List<com.liferay.portal.model.Image> images) {
131                    getPersistence().cacheResult(images);
132            }
133    
134            /**
135            * Creates a new image with the primary key. Does not add the image to the database.
136            *
137            * @param imageId the primary key for the new image
138            * @return the new image
139            */
140            public static com.liferay.portal.model.Image create(long imageId) {
141                    return getPersistence().create(imageId);
142            }
143    
144            /**
145            * Removes the image with the primary key from the database. Also notifies the appropriate model listeners.
146            *
147            * @param imageId the primary key of the image to remove
148            * @return the image that was removed
149            * @throws com.liferay.portal.NoSuchImageException if a image with the primary key could not be found
150            * @throws SystemException if a system exception occurred
151            */
152            public static com.liferay.portal.model.Image remove(long imageId)
153                    throws com.liferay.portal.NoSuchImageException,
154                            com.liferay.portal.kernel.exception.SystemException {
155                    return getPersistence().remove(imageId);
156            }
157    
158            public static com.liferay.portal.model.Image updateImpl(
159                    com.liferay.portal.model.Image image, boolean merge)
160                    throws com.liferay.portal.kernel.exception.SystemException {
161                    return getPersistence().updateImpl(image, merge);
162            }
163    
164            /**
165            * Finds the image with the primary key or throws a {@link com.liferay.portal.NoSuchImageException} if it could not be found.
166            *
167            * @param imageId the primary key of the image to find
168            * @return the image
169            * @throws com.liferay.portal.NoSuchImageException if a image with the primary key could not be found
170            * @throws SystemException if a system exception occurred
171            */
172            public static com.liferay.portal.model.Image findByPrimaryKey(long imageId)
173                    throws com.liferay.portal.NoSuchImageException,
174                            com.liferay.portal.kernel.exception.SystemException {
175                    return getPersistence().findByPrimaryKey(imageId);
176            }
177    
178            /**
179            * Finds the image with the primary key or returns <code>null</code> if it could not be found.
180            *
181            * @param imageId the primary key of the image to find
182            * @return the image, or <code>null</code> if a image with the primary key could not be found
183            * @throws SystemException if a system exception occurred
184            */
185            public static com.liferay.portal.model.Image fetchByPrimaryKey(long imageId)
186                    throws com.liferay.portal.kernel.exception.SystemException {
187                    return getPersistence().fetchByPrimaryKey(imageId);
188            }
189    
190            /**
191            * Finds all the images where size &lt; &#63;.
192            *
193            * @param size the size to search with
194            * @return the matching images
195            * @throws SystemException if a system exception occurred
196            */
197            public static java.util.List<com.liferay.portal.model.Image> findByLtSize(
198                    int size) throws com.liferay.portal.kernel.exception.SystemException {
199                    return getPersistence().findByLtSize(size);
200            }
201    
202            /**
203            * Finds a range of all the images where size &lt; &#63;.
204            *
205            * <p>
206            * 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.
207            * </p>
208            *
209            * @param size the size to search with
210            * @param start the lower bound of the range of images to return
211            * @param end the upper bound of the range of images to return (not inclusive)
212            * @return the range of matching images
213            * @throws SystemException if a system exception occurred
214            */
215            public static java.util.List<com.liferay.portal.model.Image> findByLtSize(
216                    int size, int start, int end)
217                    throws com.liferay.portal.kernel.exception.SystemException {
218                    return getPersistence().findByLtSize(size, start, end);
219            }
220    
221            /**
222            * Finds an ordered range of all the images where size &lt; &#63;.
223            *
224            * <p>
225            * 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.
226            * </p>
227            *
228            * @param size the size to search with
229            * @param start the lower bound of the range of images to return
230            * @param end the upper bound of the range of images to return (not inclusive)
231            * @param orderByComparator the comparator to order the results by
232            * @return the ordered range of matching images
233            * @throws SystemException if a system exception occurred
234            */
235            public static java.util.List<com.liferay.portal.model.Image> findByLtSize(
236                    int size, int start, int end,
237                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
238                    throws com.liferay.portal.kernel.exception.SystemException {
239                    return getPersistence().findByLtSize(size, start, end, orderByComparator);
240            }
241    
242            /**
243            * Finds the first image in the ordered set where size &lt; &#63;.
244            *
245            * <p>
246            * 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.
247            * </p>
248            *
249            * @param size the size to search with
250            * @param orderByComparator the comparator to order the set by
251            * @return the first matching image
252            * @throws com.liferay.portal.NoSuchImageException if a matching image could not be found
253            * @throws SystemException if a system exception occurred
254            */
255            public static com.liferay.portal.model.Image findByLtSize_First(int size,
256                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
257                    throws com.liferay.portal.NoSuchImageException,
258                            com.liferay.portal.kernel.exception.SystemException {
259                    return getPersistence().findByLtSize_First(size, orderByComparator);
260            }
261    
262            /**
263            * Finds the last image in the ordered set where size &lt; &#63;.
264            *
265            * <p>
266            * 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.
267            * </p>
268            *
269            * @param size the size to search with
270            * @param orderByComparator the comparator to order the set by
271            * @return the last matching image
272            * @throws com.liferay.portal.NoSuchImageException if a matching image could not be found
273            * @throws SystemException if a system exception occurred
274            */
275            public static com.liferay.portal.model.Image findByLtSize_Last(int size,
276                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
277                    throws com.liferay.portal.NoSuchImageException,
278                            com.liferay.portal.kernel.exception.SystemException {
279                    return getPersistence().findByLtSize_Last(size, orderByComparator);
280            }
281    
282            /**
283            * Finds the images before and after the current image in the ordered set where size &lt; &#63;.
284            *
285            * <p>
286            * 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.
287            * </p>
288            *
289            * @param imageId the primary key of the current image
290            * @param size the size to search with
291            * @param orderByComparator the comparator to order the set by
292            * @return the previous, current, and next image
293            * @throws com.liferay.portal.NoSuchImageException if a image with the primary key could not be found
294            * @throws SystemException if a system exception occurred
295            */
296            public static com.liferay.portal.model.Image[] findByLtSize_PrevAndNext(
297                    long imageId, int size,
298                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
299                    throws com.liferay.portal.NoSuchImageException,
300                            com.liferay.portal.kernel.exception.SystemException {
301                    return getPersistence()
302                                       .findByLtSize_PrevAndNext(imageId, size, orderByComparator);
303            }
304    
305            /**
306            * Finds all the images.
307            *
308            * @return the images
309            * @throws SystemException if a system exception occurred
310            */
311            public static java.util.List<com.liferay.portal.model.Image> findAll()
312                    throws com.liferay.portal.kernel.exception.SystemException {
313                    return getPersistence().findAll();
314            }
315    
316            /**
317            * Finds a range of all the images.
318            *
319            * <p>
320            * 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.
321            * </p>
322            *
323            * @param start the lower bound of the range of images to return
324            * @param end the upper bound of the range of images to return (not inclusive)
325            * @return the range of images
326            * @throws SystemException if a system exception occurred
327            */
328            public static java.util.List<com.liferay.portal.model.Image> findAll(
329                    int start, int end)
330                    throws com.liferay.portal.kernel.exception.SystemException {
331                    return getPersistence().findAll(start, end);
332            }
333    
334            /**
335            * Finds 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
339            * </p>
340            *
341            * @param start the lower bound of the range of images to return
342            * @param end the upper bound of the range of images to return (not inclusive)
343            * @param orderByComparator the comparator to order the results by
344            * @return the ordered range of images
345            * @throws SystemException if a system exception occurred
346            */
347            public static java.util.List<com.liferay.portal.model.Image> findAll(
348                    int start, int end,
349                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
350                    throws com.liferay.portal.kernel.exception.SystemException {
351                    return getPersistence().findAll(start, end, orderByComparator);
352            }
353    
354            /**
355            * Removes all the images where size &lt; &#63; from the database.
356            *
357            * @param size the size to search with
358            * @throws SystemException if a system exception occurred
359            */
360            public static void removeByLtSize(int size)
361                    throws com.liferay.portal.kernel.exception.SystemException {
362                    getPersistence().removeByLtSize(size);
363            }
364    
365            /**
366            * Removes all the images from the database.
367            *
368            * @throws SystemException if a system exception occurred
369            */
370            public static void removeAll()
371                    throws com.liferay.portal.kernel.exception.SystemException {
372                    getPersistence().removeAll();
373            }
374    
375            /**
376            * Counts all the images where size &lt; &#63;.
377            *
378            * @param size the size to search with
379            * @return the number of matching images
380            * @throws SystemException if a system exception occurred
381            */
382            public static int countByLtSize(int size)
383                    throws com.liferay.portal.kernel.exception.SystemException {
384                    return getPersistence().countByLtSize(size);
385            }
386    
387            /**
388            * Counts all the images.
389            *
390            * @return the number of images
391            * @throws SystemException if a system exception occurred
392            */
393            public static int countAll()
394                    throws com.liferay.portal.kernel.exception.SystemException {
395                    return getPersistence().countAll();
396            }
397    
398            public static ImagePersistence getPersistence() {
399                    if (_persistence == null) {
400                            _persistence = (ImagePersistence)PortalBeanLocatorUtil.locate(ImagePersistence.class.getName());
401                    }
402    
403                    return _persistence;
404            }
405    
406            public void setPersistence(ImagePersistence persistence) {
407                    _persistence = persistence;
408            }
409    
410            private static ImagePersistence _persistence;
411    }