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="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 com.liferay.portal.model.Region create(long regionId) {
33          return getPersistence().create(regionId);
34      }
35  
36      public static com.liferay.portal.model.Region remove(long regionId)
37          throws com.liferay.portal.SystemException,
38              com.liferay.portal.NoSuchRegionException {
39          return getPersistence().remove(regionId);
40      }
41  
42      public static com.liferay.portal.model.Region remove(
43          com.liferay.portal.model.Region region)
44          throws com.liferay.portal.SystemException {
45          return getPersistence().remove(region);
46      }
47  
48      /**
49       * @deprecated Use <code>update(Region region, boolean merge)</code>.
50       */
51      public static com.liferay.portal.model.Region update(
52          com.liferay.portal.model.Region region)
53          throws com.liferay.portal.SystemException {
54          return getPersistence().update(region);
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        region 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 region 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.Region update(
71          com.liferay.portal.model.Region region, boolean merge)
72          throws com.liferay.portal.SystemException {
73          return getPersistence().update(region, merge);
74      }
75  
76      public static com.liferay.portal.model.Region updateImpl(
77          com.liferay.portal.model.Region region, boolean merge)
78          throws com.liferay.portal.SystemException {
79          return getPersistence().updateImpl(region, merge);
80      }
81  
82      public static com.liferay.portal.model.Region findByPrimaryKey(
83          long regionId)
84          throws com.liferay.portal.SystemException,
85              com.liferay.portal.NoSuchRegionException {
86          return getPersistence().findByPrimaryKey(regionId);
87      }
88  
89      public static com.liferay.portal.model.Region fetchByPrimaryKey(
90          long regionId) throws com.liferay.portal.SystemException {
91          return getPersistence().fetchByPrimaryKey(regionId);
92      }
93  
94      public static java.util.List<com.liferay.portal.model.Region> findByCountryId(
95          long countryId) throws com.liferay.portal.SystemException {
96          return getPersistence().findByCountryId(countryId);
97      }
98  
99      public static java.util.List<com.liferay.portal.model.Region> findByCountryId(
100         long countryId, int begin, int end)
101         throws com.liferay.portal.SystemException {
102         return getPersistence().findByCountryId(countryId, begin, end);
103     }
104 
105     public static java.util.List<com.liferay.portal.model.Region> findByCountryId(
106         long countryId, int begin, int end,
107         com.liferay.portal.kernel.util.OrderByComparator obc)
108         throws com.liferay.portal.SystemException {
109         return getPersistence().findByCountryId(countryId, begin, end, obc);
110     }
111 
112     public static com.liferay.portal.model.Region findByCountryId_First(
113         long countryId, com.liferay.portal.kernel.util.OrderByComparator obc)
114         throws com.liferay.portal.SystemException,
115             com.liferay.portal.NoSuchRegionException {
116         return getPersistence().findByCountryId_First(countryId, obc);
117     }
118 
119     public static com.liferay.portal.model.Region findByCountryId_Last(
120         long countryId, com.liferay.portal.kernel.util.OrderByComparator obc)
121         throws com.liferay.portal.SystemException,
122             com.liferay.portal.NoSuchRegionException {
123         return getPersistence().findByCountryId_Last(countryId, obc);
124     }
125 
126     public static com.liferay.portal.model.Region[] findByCountryId_PrevAndNext(
127         long regionId, long countryId,
128         com.liferay.portal.kernel.util.OrderByComparator obc)
129         throws com.liferay.portal.SystemException,
130             com.liferay.portal.NoSuchRegionException {
131         return getPersistence()
132                    .findByCountryId_PrevAndNext(regionId, countryId, obc);
133     }
134 
135     public static java.util.List<com.liferay.portal.model.Region> findByActive(
136         boolean active) throws com.liferay.portal.SystemException {
137         return getPersistence().findByActive(active);
138     }
139 
140     public static java.util.List<com.liferay.portal.model.Region> findByActive(
141         boolean active, int begin, int end)
142         throws com.liferay.portal.SystemException {
143         return getPersistence().findByActive(active, begin, end);
144     }
145 
146     public static java.util.List<com.liferay.portal.model.Region> findByActive(
147         boolean active, int begin, int end,
148         com.liferay.portal.kernel.util.OrderByComparator obc)
149         throws com.liferay.portal.SystemException {
150         return getPersistence().findByActive(active, begin, end, obc);
151     }
152 
153     public static com.liferay.portal.model.Region findByActive_First(
154         boolean active, com.liferay.portal.kernel.util.OrderByComparator obc)
155         throws com.liferay.portal.SystemException,
156             com.liferay.portal.NoSuchRegionException {
157         return getPersistence().findByActive_First(active, obc);
158     }
159 
160     public static com.liferay.portal.model.Region findByActive_Last(
161         boolean active, com.liferay.portal.kernel.util.OrderByComparator obc)
162         throws com.liferay.portal.SystemException,
163             com.liferay.portal.NoSuchRegionException {
164         return getPersistence().findByActive_Last(active, obc);
165     }
166 
167     public static com.liferay.portal.model.Region[] findByActive_PrevAndNext(
168         long regionId, boolean active,
169         com.liferay.portal.kernel.util.OrderByComparator obc)
170         throws com.liferay.portal.SystemException,
171             com.liferay.portal.NoSuchRegionException {
172         return getPersistence().findByActive_PrevAndNext(regionId, active, obc);
173     }
174 
175     public static java.util.List<com.liferay.portal.model.Region> findByC_A(
176         long countryId, boolean active)
177         throws com.liferay.portal.SystemException {
178         return getPersistence().findByC_A(countryId, active);
179     }
180 
181     public static java.util.List<com.liferay.portal.model.Region> findByC_A(
182         long countryId, boolean active, int begin, int end)
183         throws com.liferay.portal.SystemException {
184         return getPersistence().findByC_A(countryId, active, begin, end);
185     }
186 
187     public static java.util.List<com.liferay.portal.model.Region> findByC_A(
188         long countryId, boolean active, int begin, int end,
189         com.liferay.portal.kernel.util.OrderByComparator obc)
190         throws com.liferay.portal.SystemException {
191         return getPersistence().findByC_A(countryId, active, begin, end, obc);
192     }
193 
194     public static com.liferay.portal.model.Region findByC_A_First(
195         long countryId, boolean active,
196         com.liferay.portal.kernel.util.OrderByComparator obc)
197         throws com.liferay.portal.SystemException,
198             com.liferay.portal.NoSuchRegionException {
199         return getPersistence().findByC_A_First(countryId, active, obc);
200     }
201 
202     public static com.liferay.portal.model.Region findByC_A_Last(
203         long countryId, boolean active,
204         com.liferay.portal.kernel.util.OrderByComparator obc)
205         throws com.liferay.portal.SystemException,
206             com.liferay.portal.NoSuchRegionException {
207         return getPersistence().findByC_A_Last(countryId, active, obc);
208     }
209 
210     public static com.liferay.portal.model.Region[] findByC_A_PrevAndNext(
211         long regionId, long countryId, boolean active,
212         com.liferay.portal.kernel.util.OrderByComparator obc)
213         throws com.liferay.portal.SystemException,
214             com.liferay.portal.NoSuchRegionException {
215         return getPersistence()
216                    .findByC_A_PrevAndNext(regionId, countryId, active, obc);
217     }
218 
219     public static java.util.List<com.liferay.portal.model.Region> findWithDynamicQuery(
220         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer)
221         throws com.liferay.portal.SystemException {
222         return getPersistence().findWithDynamicQuery(queryInitializer);
223     }
224 
225     public static java.util.List<com.liferay.portal.model.Region> findWithDynamicQuery(
226         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer,
227         int begin, int end) throws com.liferay.portal.SystemException {
228         return getPersistence()
229                    .findWithDynamicQuery(queryInitializer, begin, end);
230     }
231 
232     public static java.util.List<com.liferay.portal.model.Region> findAll()
233         throws com.liferay.portal.SystemException {
234         return getPersistence().findAll();
235     }
236 
237     public static java.util.List<com.liferay.portal.model.Region> findAll(
238         int begin, int end) throws com.liferay.portal.SystemException {
239         return getPersistence().findAll(begin, end);
240     }
241 
242     public static java.util.List<com.liferay.portal.model.Region> findAll(
243         int begin, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
244         throws com.liferay.portal.SystemException {
245         return getPersistence().findAll(begin, end, obc);
246     }
247 
248     public static void removeByCountryId(long countryId)
249         throws com.liferay.portal.SystemException {
250         getPersistence().removeByCountryId(countryId);
251     }
252 
253     public static void removeByActive(boolean active)
254         throws com.liferay.portal.SystemException {
255         getPersistence().removeByActive(active);
256     }
257 
258     public static void removeByC_A(long countryId, boolean active)
259         throws com.liferay.portal.SystemException {
260         getPersistence().removeByC_A(countryId, active);
261     }
262 
263     public static void removeAll() throws com.liferay.portal.SystemException {
264         getPersistence().removeAll();
265     }
266 
267     public static int countByCountryId(long countryId)
268         throws com.liferay.portal.SystemException {
269         return getPersistence().countByCountryId(countryId);
270     }
271 
272     public static int countByActive(boolean active)
273         throws com.liferay.portal.SystemException {
274         return getPersistence().countByActive(active);
275     }
276 
277     public static int countByC_A(long countryId, boolean active)
278         throws com.liferay.portal.SystemException {
279         return getPersistence().countByC_A(countryId, active);
280     }
281 
282     public static int countAll() throws com.liferay.portal.SystemException {
283         return getPersistence().countAll();
284     }
285 
286     public static RegionPersistence getPersistence() {
287         return _getUtil()._persistence;
288     }
289 
290     public void setPersistence(RegionPersistence persistence) {
291         _persistence = persistence;
292     }
293 
294     private static RegionUtil _getUtil() {
295         if (_util == null) {
296             _util = (RegionUtil)com.liferay.portal.kernel.bean.BeanLocatorUtil.locate(_UTIL);
297         }
298 
299         return _util;
300     }
301 
302     private static final String _UTIL = RegionUtil.class.getName();
303     private static RegionUtil _util;
304     private RegionPersistence _persistence;
305 }