1   /**
2    * Copyright (c) 2000-2009 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="RegionUtil.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   *
30   */
31  public class RegionUtil {
32      public static void cacheResult(com.liferay.portal.model.Region region) {
33          getPersistence().cacheResult(region);
34      }
35  
36      public static void cacheResult(
37          java.util.List<com.liferay.portal.model.Region> regions) {
38          getPersistence().cacheResult(regions);
39      }
40  
41      public static void clearCache() {
42          getPersistence().clearCache();
43      }
44  
45      public static com.liferay.portal.model.Region create(long regionId) {
46          return getPersistence().create(regionId);
47      }
48  
49      public static com.liferay.portal.model.Region remove(long regionId)
50          throws com.liferay.portal.NoSuchRegionException,
51              com.liferay.portal.SystemException {
52          return getPersistence().remove(regionId);
53      }
54  
55      public static com.liferay.portal.model.Region remove(
56          com.liferay.portal.model.Region region)
57          throws com.liferay.portal.SystemException {
58          return getPersistence().remove(region);
59      }
60  
61      /**
62       * @deprecated Use <code>update(Region region, boolean merge)</code>.
63       */
64      public static com.liferay.portal.model.Region update(
65          com.liferay.portal.model.Region region)
66          throws com.liferay.portal.SystemException {
67          return getPersistence().update(region);
68      }
69  
70      /**
71       * Add, update, or merge, the entity. This method also calls the model
72       * listeners to trigger the proper events associated with adding, deleting,
73       * or updating an entity.
74       *
75       * @param        region the entity to add, update, or merge
76       * @param        merge boolean value for whether to merge the entity. The
77       *                default value is false. Setting merge to true is more
78       *                expensive and should only be true when region is
79       *                transient. See LEP-5473 for a detailed discussion of this
80       *                method.
81       * @return        true if the portlet can be displayed via Ajax
82       */
83      public static com.liferay.portal.model.Region update(
84          com.liferay.portal.model.Region region, boolean merge)
85          throws com.liferay.portal.SystemException {
86          return getPersistence().update(region, merge);
87      }
88  
89      public static com.liferay.portal.model.Region updateImpl(
90          com.liferay.portal.model.Region region, boolean merge)
91          throws com.liferay.portal.SystemException {
92          return getPersistence().updateImpl(region, merge);
93      }
94  
95      public static com.liferay.portal.model.Region findByPrimaryKey(
96          long regionId)
97          throws com.liferay.portal.NoSuchRegionException,
98              com.liferay.portal.SystemException {
99          return getPersistence().findByPrimaryKey(regionId);
100     }
101 
102     public static com.liferay.portal.model.Region fetchByPrimaryKey(
103         long regionId) throws com.liferay.portal.SystemException {
104         return getPersistence().fetchByPrimaryKey(regionId);
105     }
106 
107     public static java.util.List<com.liferay.portal.model.Region> findByCountryId(
108         long countryId) throws com.liferay.portal.SystemException {
109         return getPersistence().findByCountryId(countryId);
110     }
111 
112     public static java.util.List<com.liferay.portal.model.Region> findByCountryId(
113         long countryId, int start, int end)
114         throws com.liferay.portal.SystemException {
115         return getPersistence().findByCountryId(countryId, start, end);
116     }
117 
118     public static java.util.List<com.liferay.portal.model.Region> findByCountryId(
119         long countryId, int start, int end,
120         com.liferay.portal.kernel.util.OrderByComparator obc)
121         throws com.liferay.portal.SystemException {
122         return getPersistence().findByCountryId(countryId, start, end, obc);
123     }
124 
125     public static com.liferay.portal.model.Region findByCountryId_First(
126         long countryId, com.liferay.portal.kernel.util.OrderByComparator obc)
127         throws com.liferay.portal.NoSuchRegionException,
128             com.liferay.portal.SystemException {
129         return getPersistence().findByCountryId_First(countryId, obc);
130     }
131 
132     public static com.liferay.portal.model.Region findByCountryId_Last(
133         long countryId, com.liferay.portal.kernel.util.OrderByComparator obc)
134         throws com.liferay.portal.NoSuchRegionException,
135             com.liferay.portal.SystemException {
136         return getPersistence().findByCountryId_Last(countryId, obc);
137     }
138 
139     public static com.liferay.portal.model.Region[] findByCountryId_PrevAndNext(
140         long regionId, long countryId,
141         com.liferay.portal.kernel.util.OrderByComparator obc)
142         throws com.liferay.portal.NoSuchRegionException,
143             com.liferay.portal.SystemException {
144         return getPersistence()
145                    .findByCountryId_PrevAndNext(regionId, countryId, obc);
146     }
147 
148     public static java.util.List<com.liferay.portal.model.Region> findByActive(
149         boolean active) throws com.liferay.portal.SystemException {
150         return getPersistence().findByActive(active);
151     }
152 
153     public static java.util.List<com.liferay.portal.model.Region> findByActive(
154         boolean active, int start, int end)
155         throws com.liferay.portal.SystemException {
156         return getPersistence().findByActive(active, start, end);
157     }
158 
159     public static java.util.List<com.liferay.portal.model.Region> findByActive(
160         boolean active, int start, int end,
161         com.liferay.portal.kernel.util.OrderByComparator obc)
162         throws com.liferay.portal.SystemException {
163         return getPersistence().findByActive(active, start, end, obc);
164     }
165 
166     public static com.liferay.portal.model.Region findByActive_First(
167         boolean active, com.liferay.portal.kernel.util.OrderByComparator obc)
168         throws com.liferay.portal.NoSuchRegionException,
169             com.liferay.portal.SystemException {
170         return getPersistence().findByActive_First(active, obc);
171     }
172 
173     public static com.liferay.portal.model.Region findByActive_Last(
174         boolean active, com.liferay.portal.kernel.util.OrderByComparator obc)
175         throws com.liferay.portal.NoSuchRegionException,
176             com.liferay.portal.SystemException {
177         return getPersistence().findByActive_Last(active, obc);
178     }
179 
180     public static com.liferay.portal.model.Region[] findByActive_PrevAndNext(
181         long regionId, boolean active,
182         com.liferay.portal.kernel.util.OrderByComparator obc)
183         throws com.liferay.portal.NoSuchRegionException,
184             com.liferay.portal.SystemException {
185         return getPersistence().findByActive_PrevAndNext(regionId, active, obc);
186     }
187 
188     public static java.util.List<com.liferay.portal.model.Region> findByC_A(
189         long countryId, boolean active)
190         throws com.liferay.portal.SystemException {
191         return getPersistence().findByC_A(countryId, active);
192     }
193 
194     public static java.util.List<com.liferay.portal.model.Region> findByC_A(
195         long countryId, boolean active, int start, int end)
196         throws com.liferay.portal.SystemException {
197         return getPersistence().findByC_A(countryId, active, start, end);
198     }
199 
200     public static java.util.List<com.liferay.portal.model.Region> findByC_A(
201         long countryId, boolean active, int start, int end,
202         com.liferay.portal.kernel.util.OrderByComparator obc)
203         throws com.liferay.portal.SystemException {
204         return getPersistence().findByC_A(countryId, active, start, end, obc);
205     }
206 
207     public static com.liferay.portal.model.Region findByC_A_First(
208         long countryId, boolean active,
209         com.liferay.portal.kernel.util.OrderByComparator obc)
210         throws com.liferay.portal.NoSuchRegionException,
211             com.liferay.portal.SystemException {
212         return getPersistence().findByC_A_First(countryId, active, obc);
213     }
214 
215     public static com.liferay.portal.model.Region findByC_A_Last(
216         long countryId, boolean active,
217         com.liferay.portal.kernel.util.OrderByComparator obc)
218         throws com.liferay.portal.NoSuchRegionException,
219             com.liferay.portal.SystemException {
220         return getPersistence().findByC_A_Last(countryId, active, obc);
221     }
222 
223     public static com.liferay.portal.model.Region[] findByC_A_PrevAndNext(
224         long regionId, long countryId, boolean active,
225         com.liferay.portal.kernel.util.OrderByComparator obc)
226         throws com.liferay.portal.NoSuchRegionException,
227             com.liferay.portal.SystemException {
228         return getPersistence()
229                    .findByC_A_PrevAndNext(regionId, countryId, active, obc);
230     }
231 
232     public static java.util.List<Object> findWithDynamicQuery(
233         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
234         throws com.liferay.portal.SystemException {
235         return getPersistence().findWithDynamicQuery(dynamicQuery);
236     }
237 
238     public static java.util.List<Object> findWithDynamicQuery(
239         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
240         int end) throws com.liferay.portal.SystemException {
241         return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
242     }
243 
244     public static java.util.List<com.liferay.portal.model.Region> findAll()
245         throws com.liferay.portal.SystemException {
246         return getPersistence().findAll();
247     }
248 
249     public static java.util.List<com.liferay.portal.model.Region> findAll(
250         int start, int end) throws com.liferay.portal.SystemException {
251         return getPersistence().findAll(start, end);
252     }
253 
254     public static java.util.List<com.liferay.portal.model.Region> findAll(
255         int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
256         throws com.liferay.portal.SystemException {
257         return getPersistence().findAll(start, end, obc);
258     }
259 
260     public static void removeByCountryId(long countryId)
261         throws com.liferay.portal.SystemException {
262         getPersistence().removeByCountryId(countryId);
263     }
264 
265     public static void removeByActive(boolean active)
266         throws com.liferay.portal.SystemException {
267         getPersistence().removeByActive(active);
268     }
269 
270     public static void removeByC_A(long countryId, boolean active)
271         throws com.liferay.portal.SystemException {
272         getPersistence().removeByC_A(countryId, active);
273     }
274 
275     public static void removeAll() throws com.liferay.portal.SystemException {
276         getPersistence().removeAll();
277     }
278 
279     public static int countByCountryId(long countryId)
280         throws com.liferay.portal.SystemException {
281         return getPersistence().countByCountryId(countryId);
282     }
283 
284     public static int countByActive(boolean active)
285         throws com.liferay.portal.SystemException {
286         return getPersistence().countByActive(active);
287     }
288 
289     public static int countByC_A(long countryId, boolean active)
290         throws com.liferay.portal.SystemException {
291         return getPersistence().countByC_A(countryId, active);
292     }
293 
294     public static int countAll() throws com.liferay.portal.SystemException {
295         return getPersistence().countAll();
296     }
297 
298     public static RegionPersistence getPersistence() {
299         return _persistence;
300     }
301 
302     public void setPersistence(RegionPersistence persistence) {
303         _persistence = persistence;
304     }
305 
306     private static RegionPersistence _persistence;
307 }