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.portlet.shopping.service.persistence;
24  
25  /**
26   * <a href="ShoppingCategoryUtil.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   *
30   */
31  public class ShoppingCategoryUtil {
32      public static com.liferay.portlet.shopping.model.ShoppingCategory create(
33          long categoryId) {
34          return getPersistence().create(categoryId);
35      }
36  
37      public static com.liferay.portlet.shopping.model.ShoppingCategory remove(
38          long categoryId)
39          throws com.liferay.portal.SystemException,
40              com.liferay.portlet.shopping.NoSuchCategoryException {
41          return getPersistence().remove(categoryId);
42      }
43  
44      public static com.liferay.portlet.shopping.model.ShoppingCategory remove(
45          com.liferay.portlet.shopping.model.ShoppingCategory shoppingCategory)
46          throws com.liferay.portal.SystemException {
47          return getPersistence().remove(shoppingCategory);
48      }
49  
50      /**
51       * @deprecated Use <code>update(ShoppingCategory shoppingCategory, boolean merge)</code>.
52       */
53      public static com.liferay.portlet.shopping.model.ShoppingCategory update(
54          com.liferay.portlet.shopping.model.ShoppingCategory shoppingCategory)
55          throws com.liferay.portal.SystemException {
56          return getPersistence().update(shoppingCategory);
57      }
58  
59      /**
60       * Add, update, or merge, the entity. This method also calls the model
61       * listeners to trigger the proper events associated with adding, deleting,
62       * or updating an entity.
63       *
64       * @param        shoppingCategory the entity to add, update, or merge
65       * @param        merge boolean value for whether to merge the entity. The
66       *                default value is false. Setting merge to true is more
67       *                expensive and should only be true when shoppingCategory is
68       *                transient. See LEP-5473 for a detailed discussion of this
69       *                method.
70       * @return        true if the portlet can be displayed via Ajax
71       */
72      public static com.liferay.portlet.shopping.model.ShoppingCategory update(
73          com.liferay.portlet.shopping.model.ShoppingCategory shoppingCategory,
74          boolean merge) throws com.liferay.portal.SystemException {
75          return getPersistence().update(shoppingCategory, merge);
76      }
77  
78      public static com.liferay.portlet.shopping.model.ShoppingCategory updateImpl(
79          com.liferay.portlet.shopping.model.ShoppingCategory shoppingCategory,
80          boolean merge) throws com.liferay.portal.SystemException {
81          return getPersistence().updateImpl(shoppingCategory, merge);
82      }
83  
84      public static com.liferay.portlet.shopping.model.ShoppingCategory findByPrimaryKey(
85          long categoryId)
86          throws com.liferay.portal.SystemException,
87              com.liferay.portlet.shopping.NoSuchCategoryException {
88          return getPersistence().findByPrimaryKey(categoryId);
89      }
90  
91      public static com.liferay.portlet.shopping.model.ShoppingCategory fetchByPrimaryKey(
92          long categoryId) throws com.liferay.portal.SystemException {
93          return getPersistence().fetchByPrimaryKey(categoryId);
94      }
95  
96      public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCategory> findByGroupId(
97          long groupId) throws com.liferay.portal.SystemException {
98          return getPersistence().findByGroupId(groupId);
99      }
100 
101     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCategory> findByGroupId(
102         long groupId, int begin, int end)
103         throws com.liferay.portal.SystemException {
104         return getPersistence().findByGroupId(groupId, begin, end);
105     }
106 
107     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCategory> findByGroupId(
108         long groupId, int begin, int end,
109         com.liferay.portal.kernel.util.OrderByComparator obc)
110         throws com.liferay.portal.SystemException {
111         return getPersistence().findByGroupId(groupId, begin, end, obc);
112     }
113 
114     public static com.liferay.portlet.shopping.model.ShoppingCategory findByGroupId_First(
115         long groupId, com.liferay.portal.kernel.util.OrderByComparator obc)
116         throws com.liferay.portal.SystemException,
117             com.liferay.portlet.shopping.NoSuchCategoryException {
118         return getPersistence().findByGroupId_First(groupId, obc);
119     }
120 
121     public static com.liferay.portlet.shopping.model.ShoppingCategory findByGroupId_Last(
122         long groupId, com.liferay.portal.kernel.util.OrderByComparator obc)
123         throws com.liferay.portal.SystemException,
124             com.liferay.portlet.shopping.NoSuchCategoryException {
125         return getPersistence().findByGroupId_Last(groupId, obc);
126     }
127 
128     public static com.liferay.portlet.shopping.model.ShoppingCategory[] findByGroupId_PrevAndNext(
129         long categoryId, long groupId,
130         com.liferay.portal.kernel.util.OrderByComparator obc)
131         throws com.liferay.portal.SystemException,
132             com.liferay.portlet.shopping.NoSuchCategoryException {
133         return getPersistence()
134                    .findByGroupId_PrevAndNext(categoryId, groupId, obc);
135     }
136 
137     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCategory> findByG_P(
138         long groupId, long parentCategoryId)
139         throws com.liferay.portal.SystemException {
140         return getPersistence().findByG_P(groupId, parentCategoryId);
141     }
142 
143     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCategory> findByG_P(
144         long groupId, long parentCategoryId, int begin, int end)
145         throws com.liferay.portal.SystemException {
146         return getPersistence().findByG_P(groupId, parentCategoryId, begin, end);
147     }
148 
149     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCategory> findByG_P(
150         long groupId, long parentCategoryId, int begin, int end,
151         com.liferay.portal.kernel.util.OrderByComparator obc)
152         throws com.liferay.portal.SystemException {
153         return getPersistence()
154                    .findByG_P(groupId, parentCategoryId, begin, end, obc);
155     }
156 
157     public static com.liferay.portlet.shopping.model.ShoppingCategory findByG_P_First(
158         long groupId, long parentCategoryId,
159         com.liferay.portal.kernel.util.OrderByComparator obc)
160         throws com.liferay.portal.SystemException,
161             com.liferay.portlet.shopping.NoSuchCategoryException {
162         return getPersistence().findByG_P_First(groupId, parentCategoryId, obc);
163     }
164 
165     public static com.liferay.portlet.shopping.model.ShoppingCategory findByG_P_Last(
166         long groupId, long parentCategoryId,
167         com.liferay.portal.kernel.util.OrderByComparator obc)
168         throws com.liferay.portal.SystemException,
169             com.liferay.portlet.shopping.NoSuchCategoryException {
170         return getPersistence().findByG_P_Last(groupId, parentCategoryId, obc);
171     }
172 
173     public static com.liferay.portlet.shopping.model.ShoppingCategory[] findByG_P_PrevAndNext(
174         long categoryId, long groupId, long parentCategoryId,
175         com.liferay.portal.kernel.util.OrderByComparator obc)
176         throws com.liferay.portal.SystemException,
177             com.liferay.portlet.shopping.NoSuchCategoryException {
178         return getPersistence()
179                    .findByG_P_PrevAndNext(categoryId, groupId,
180             parentCategoryId, obc);
181     }
182 
183     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCategory> findWithDynamicQuery(
184         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer)
185         throws com.liferay.portal.SystemException {
186         return getPersistence().findWithDynamicQuery(queryInitializer);
187     }
188 
189     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCategory> findWithDynamicQuery(
190         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer,
191         int begin, int end) throws com.liferay.portal.SystemException {
192         return getPersistence()
193                    .findWithDynamicQuery(queryInitializer, begin, end);
194     }
195 
196     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCategory> findAll()
197         throws com.liferay.portal.SystemException {
198         return getPersistence().findAll();
199     }
200 
201     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCategory> findAll(
202         int begin, int end) throws com.liferay.portal.SystemException {
203         return getPersistence().findAll(begin, end);
204     }
205 
206     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCategory> findAll(
207         int begin, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
208         throws com.liferay.portal.SystemException {
209         return getPersistence().findAll(begin, end, obc);
210     }
211 
212     public static void removeByGroupId(long groupId)
213         throws com.liferay.portal.SystemException {
214         getPersistence().removeByGroupId(groupId);
215     }
216 
217     public static void removeByG_P(long groupId, long parentCategoryId)
218         throws com.liferay.portal.SystemException {
219         getPersistence().removeByG_P(groupId, parentCategoryId);
220     }
221 
222     public static void removeAll() throws com.liferay.portal.SystemException {
223         getPersistence().removeAll();
224     }
225 
226     public static int countByGroupId(long groupId)
227         throws com.liferay.portal.SystemException {
228         return getPersistence().countByGroupId(groupId);
229     }
230 
231     public static int countByG_P(long groupId, long parentCategoryId)
232         throws com.liferay.portal.SystemException {
233         return getPersistence().countByG_P(groupId, parentCategoryId);
234     }
235 
236     public static int countAll() throws com.liferay.portal.SystemException {
237         return getPersistence().countAll();
238     }
239 
240     public static ShoppingCategoryPersistence getPersistence() {
241         return _getUtil()._persistence;
242     }
243 
244     public void setPersistence(ShoppingCategoryPersistence persistence) {
245         _persistence = persistence;
246     }
247 
248     private static ShoppingCategoryUtil _getUtil() {
249         if (_util == null) {
250             _util = (ShoppingCategoryUtil)com.liferay.portal.kernel.bean.BeanLocatorUtil.locate(_UTIL);
251         }
252 
253         return _util;
254     }
255 
256     private static final String _UTIL = ShoppingCategoryUtil.class.getName();
257     private static ShoppingCategoryUtil _util;
258     private ShoppingCategoryPersistence _persistence;
259 }