1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.service.persistence;
24  
25  /**
26   * <a href="ImageUtil.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   *
30   */
31  public class ImageUtil {
32      public static com.liferay.portal.model.Image create(long imageId) {
33          return getPersistence().create(imageId);
34      }
35  
36      public static com.liferay.portal.model.Image remove(long imageId)
37          throws com.liferay.portal.SystemException,
38              com.liferay.portal.NoSuchImageException {
39          return getPersistence().remove(imageId);
40      }
41  
42      public static com.liferay.portal.model.Image remove(
43          com.liferay.portal.model.Image image)
44          throws com.liferay.portal.SystemException {
45          return getPersistence().remove(image);
46      }
47  
48      /**
49       * @deprecated Use <code>update(Image image, boolean merge)</code>.
50       */
51      public static com.liferay.portal.model.Image update(
52          com.liferay.portal.model.Image image)
53          throws com.liferay.portal.SystemException {
54          return getPersistence().update(image);
55      }
56  
57      /**
58       * Add, update, or merge, the entity. This method also calls the model
59       * listeners to trigger the proper events associated with adding, deleting,
60       * or updating an entity.
61       *
62       * @param        image the entity to add, update, or merge
63       * @param        merge boolean value for whether to merge the entity. The
64       *                default value is false. Setting merge to true is more
65       *                expensive and should only be true when image is
66       *                transient. See LEP-5473 for a detailed discussion of this
67       *                method.
68       * @return        true if the portlet can be displayed via Ajax
69       */
70      public static com.liferay.portal.model.Image update(
71          com.liferay.portal.model.Image image, boolean merge)
72          throws com.liferay.portal.SystemException {
73          return getPersistence().update(image, merge);
74      }
75  
76      public static com.liferay.portal.model.Image updateImpl(
77          com.liferay.portal.model.Image image, boolean merge)
78          throws com.liferay.portal.SystemException {
79          return getPersistence().updateImpl(image, merge);
80      }
81  
82      public static com.liferay.portal.model.Image findByPrimaryKey(long imageId)
83          throws com.liferay.portal.SystemException,
84              com.liferay.portal.NoSuchImageException {
85          return getPersistence().findByPrimaryKey(imageId);
86      }
87  
88      public static com.liferay.portal.model.Image fetchByPrimaryKey(long imageId)
89          throws com.liferay.portal.SystemException {
90          return getPersistence().fetchByPrimaryKey(imageId);
91      }
92  
93      public static java.util.List<com.liferay.portal.model.Image> findBySize(
94          int size) throws com.liferay.portal.SystemException {
95          return getPersistence().findBySize(size);
96      }
97  
98      public static java.util.List<com.liferay.portal.model.Image> findBySize(
99          int size, int begin, int end) throws com.liferay.portal.SystemException {
100         return getPersistence().findBySize(size, begin, end);
101     }
102 
103     public static java.util.List<com.liferay.portal.model.Image> findBySize(
104         int size, int begin, int end,
105         com.liferay.portal.kernel.util.OrderByComparator obc)
106         throws com.liferay.portal.SystemException {
107         return getPersistence().findBySize(size, begin, end, obc);
108     }
109 
110     public static com.liferay.portal.model.Image findBySize_First(int size,
111         com.liferay.portal.kernel.util.OrderByComparator obc)
112         throws com.liferay.portal.SystemException,
113             com.liferay.portal.NoSuchImageException {
114         return getPersistence().findBySize_First(size, obc);
115     }
116 
117     public static com.liferay.portal.model.Image findBySize_Last(int size,
118         com.liferay.portal.kernel.util.OrderByComparator obc)
119         throws com.liferay.portal.SystemException,
120             com.liferay.portal.NoSuchImageException {
121         return getPersistence().findBySize_Last(size, obc);
122     }
123 
124     public static com.liferay.portal.model.Image[] findBySize_PrevAndNext(
125         long imageId, int size,
126         com.liferay.portal.kernel.util.OrderByComparator obc)
127         throws com.liferay.portal.SystemException,
128             com.liferay.portal.NoSuchImageException {
129         return getPersistence().findBySize_PrevAndNext(imageId, size, obc);
130     }
131 
132     public static java.util.List<com.liferay.portal.model.Image> findWithDynamicQuery(
133         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer)
134         throws com.liferay.portal.SystemException {
135         return getPersistence().findWithDynamicQuery(queryInitializer);
136     }
137 
138     public static java.util.List<com.liferay.portal.model.Image> findWithDynamicQuery(
139         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer,
140         int begin, int end) throws com.liferay.portal.SystemException {
141         return getPersistence()
142                    .findWithDynamicQuery(queryInitializer, begin, end);
143     }
144 
145     public static java.util.List<com.liferay.portal.model.Image> findAll()
146         throws com.liferay.portal.SystemException {
147         return getPersistence().findAll();
148     }
149 
150     public static java.util.List<com.liferay.portal.model.Image> findAll(
151         int begin, int end) throws com.liferay.portal.SystemException {
152         return getPersistence().findAll(begin, end);
153     }
154 
155     public static java.util.List<com.liferay.portal.model.Image> findAll(
156         int begin, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
157         throws com.liferay.portal.SystemException {
158         return getPersistence().findAll(begin, end, obc);
159     }
160 
161     public static void removeBySize(int size)
162         throws com.liferay.portal.SystemException {
163         getPersistence().removeBySize(size);
164     }
165 
166     public static void removeAll() throws com.liferay.portal.SystemException {
167         getPersistence().removeAll();
168     }
169 
170     public static int countBySize(int size)
171         throws com.liferay.portal.SystemException {
172         return getPersistence().countBySize(size);
173     }
174 
175     public static int countAll() throws com.liferay.portal.SystemException {
176         return getPersistence().countAll();
177     }
178 
179     public static ImagePersistence getPersistence() {
180         return _getUtil()._persistence;
181     }
182 
183     public void setPersistence(ImagePersistence persistence) {
184         _persistence = persistence;
185     }
186 
187     private static ImageUtil _getUtil() {
188         if (_util == null) {
189             _util = (ImageUtil)com.liferay.portal.kernel.bean.BeanLocatorUtil.locate(_UTIL);
190         }
191 
192         return _util;
193     }
194 
195     private static final String _UTIL = ImageUtil.class.getName();
196     private static ImageUtil _util;
197     private ImagePersistence _persistence;
198 }