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