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, 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            * <p>
242            * 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.
243            * </p>
244            *
245            * @param size the size
246            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
247            * @return the first matching image
248            * @throws com.liferay.portal.NoSuchImageException if a matching image could not be found
249            * @throws SystemException if a system exception occurred
250            */
251            public static com.liferay.portal.model.Image findByLtSize_First(int size,
252                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
253                    throws com.liferay.portal.NoSuchImageException,
254                            com.liferay.portal.kernel.exception.SystemException {
255                    return getPersistence().findByLtSize_First(size, orderByComparator);
256            }
257    
258            /**
259            * Returns the last image in the ordered set where size &lt; &#63;.
260            *
261            * <p>
262            * 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.
263            * </p>
264            *
265            * @param size the size
266            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
267            * @return the last matching image
268            * @throws com.liferay.portal.NoSuchImageException if a matching image could not be found
269            * @throws SystemException if a system exception occurred
270            */
271            public static com.liferay.portal.model.Image findByLtSize_Last(int size,
272                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
273                    throws com.liferay.portal.NoSuchImageException,
274                            com.liferay.portal.kernel.exception.SystemException {
275                    return getPersistence().findByLtSize_Last(size, orderByComparator);
276            }
277    
278            /**
279            * Returns the images before and after the current image in the ordered set where size &lt; &#63;.
280            *
281            * <p>
282            * 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.
283            * </p>
284            *
285            * @param imageId the primary key of the current image
286            * @param size the size
287            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
288            * @return the previous, current, and next image
289            * @throws com.liferay.portal.NoSuchImageException if a image with the primary key could not be found
290            * @throws SystemException if a system exception occurred
291            */
292            public static com.liferay.portal.model.Image[] findByLtSize_PrevAndNext(
293                    long imageId, int size,
294                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
295                    throws com.liferay.portal.NoSuchImageException,
296                            com.liferay.portal.kernel.exception.SystemException {
297                    return getPersistence()
298                                       .findByLtSize_PrevAndNext(imageId, size, orderByComparator);
299            }
300    
301            /**
302            * Returns all the images.
303            *
304            * @return the images
305            * @throws SystemException if a system exception occurred
306            */
307            public static java.util.List<com.liferay.portal.model.Image> findAll()
308                    throws com.liferay.portal.kernel.exception.SystemException {
309                    return getPersistence().findAll();
310            }
311    
312            /**
313            * Returns a range of all the images.
314            *
315            * <p>
316            * 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.
317            * </p>
318            *
319            * @param start the lower bound of the range of images
320            * @param end the upper bound of the range of images (not inclusive)
321            * @return the range of images
322            * @throws SystemException if a system exception occurred
323            */
324            public static java.util.List<com.liferay.portal.model.Image> findAll(
325                    int start, int end)
326                    throws com.liferay.portal.kernel.exception.SystemException {
327                    return getPersistence().findAll(start, end);
328            }
329    
330            /**
331            * Returns an ordered range of all the images.
332            *
333            * <p>
334            * 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.
335            * </p>
336            *
337            * @param start the lower bound of the range of images
338            * @param end the upper bound of the range of images (not inclusive)
339            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
340            * @return the ordered range of images
341            * @throws SystemException if a system exception occurred
342            */
343            public static java.util.List<com.liferay.portal.model.Image> findAll(
344                    int start, int end,
345                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
346                    throws com.liferay.portal.kernel.exception.SystemException {
347                    return getPersistence().findAll(start, end, orderByComparator);
348            }
349    
350            /**
351            * Removes all the images where size &lt; &#63; from the database.
352            *
353            * @param size the size
354            * @throws SystemException if a system exception occurred
355            */
356            public static void removeByLtSize(int size)
357                    throws com.liferay.portal.kernel.exception.SystemException {
358                    getPersistence().removeByLtSize(size);
359            }
360    
361            /**
362            * Removes all the images from the database.
363            *
364            * @throws SystemException if a system exception occurred
365            */
366            public static void removeAll()
367                    throws com.liferay.portal.kernel.exception.SystemException {
368                    getPersistence().removeAll();
369            }
370    
371            /**
372            * Returns the number of images where size &lt; &#63;.
373            *
374            * @param size the size
375            * @return the number of matching images
376            * @throws SystemException if a system exception occurred
377            */
378            public static int countByLtSize(int size)
379                    throws com.liferay.portal.kernel.exception.SystemException {
380                    return getPersistence().countByLtSize(size);
381            }
382    
383            /**
384            * Returns the number of images.
385            *
386            * @return the number of images
387            * @throws SystemException if a system exception occurred
388            */
389            public static int countAll()
390                    throws com.liferay.portal.kernel.exception.SystemException {
391                    return getPersistence().countAll();
392            }
393    
394            public static ImagePersistence getPersistence() {
395                    if (_persistence == null) {
396                            _persistence = (ImagePersistence)PortalBeanLocatorUtil.locate(ImagePersistence.class.getName());
397    
398                            ReferenceRegistry.registerReference(ImageUtil.class, "_persistence");
399                    }
400    
401                    return _persistence;
402            }
403    
404            public void setPersistence(ImagePersistence persistence) {
405                    _persistence = persistence;
406    
407                    ReferenceRegistry.registerReference(ImageUtil.class, "_persistence");
408            }
409    
410            private static ImagePersistence _persistence;
411    }