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="ResourceCodeUtil.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   *
30   */
31  public class ResourceCodeUtil {
32      public static com.liferay.portal.model.ResourceCode create(long codeId) {
33          return getPersistence().create(codeId);
34      }
35  
36      public static com.liferay.portal.model.ResourceCode remove(long codeId)
37          throws com.liferay.portal.SystemException,
38              com.liferay.portal.NoSuchResourceCodeException {
39          return getPersistence().remove(codeId);
40      }
41  
42      public static com.liferay.portal.model.ResourceCode remove(
43          com.liferay.portal.model.ResourceCode resourceCode)
44          throws com.liferay.portal.SystemException {
45          return getPersistence().remove(resourceCode);
46      }
47  
48      /**
49       * @deprecated Use <code>update(ResourceCode resourceCode, boolean merge)</code>.
50       */
51      public static com.liferay.portal.model.ResourceCode update(
52          com.liferay.portal.model.ResourceCode resourceCode)
53          throws com.liferay.portal.SystemException {
54          return getPersistence().update(resourceCode);
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        resourceCode 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 resourceCode 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.ResourceCode update(
71          com.liferay.portal.model.ResourceCode resourceCode, boolean merge)
72          throws com.liferay.portal.SystemException {
73          return getPersistence().update(resourceCode, merge);
74      }
75  
76      public static com.liferay.portal.model.ResourceCode updateImpl(
77          com.liferay.portal.model.ResourceCode resourceCode, boolean merge)
78          throws com.liferay.portal.SystemException {
79          return getPersistence().updateImpl(resourceCode, merge);
80      }
81  
82      public static com.liferay.portal.model.ResourceCode findByPrimaryKey(
83          long codeId)
84          throws com.liferay.portal.SystemException,
85              com.liferay.portal.NoSuchResourceCodeException {
86          return getPersistence().findByPrimaryKey(codeId);
87      }
88  
89      public static com.liferay.portal.model.ResourceCode fetchByPrimaryKey(
90          long codeId) throws com.liferay.portal.SystemException {
91          return getPersistence().fetchByPrimaryKey(codeId);
92      }
93  
94      public static java.util.List<com.liferay.portal.model.ResourceCode> findByCompanyId(
95          long companyId) throws com.liferay.portal.SystemException {
96          return getPersistence().findByCompanyId(companyId);
97      }
98  
99      public static java.util.List<com.liferay.portal.model.ResourceCode> findByCompanyId(
100         long companyId, int begin, int end)
101         throws com.liferay.portal.SystemException {
102         return getPersistence().findByCompanyId(companyId, begin, end);
103     }
104 
105     public static java.util.List<com.liferay.portal.model.ResourceCode> findByCompanyId(
106         long companyId, int begin, int end,
107         com.liferay.portal.kernel.util.OrderByComparator obc)
108         throws com.liferay.portal.SystemException {
109         return getPersistence().findByCompanyId(companyId, begin, end, obc);
110     }
111 
112     public static com.liferay.portal.model.ResourceCode findByCompanyId_First(
113         long companyId, com.liferay.portal.kernel.util.OrderByComparator obc)
114         throws com.liferay.portal.SystemException,
115             com.liferay.portal.NoSuchResourceCodeException {
116         return getPersistence().findByCompanyId_First(companyId, obc);
117     }
118 
119     public static com.liferay.portal.model.ResourceCode findByCompanyId_Last(
120         long companyId, com.liferay.portal.kernel.util.OrderByComparator obc)
121         throws com.liferay.portal.SystemException,
122             com.liferay.portal.NoSuchResourceCodeException {
123         return getPersistence().findByCompanyId_Last(companyId, obc);
124     }
125 
126     public static com.liferay.portal.model.ResourceCode[] findByCompanyId_PrevAndNext(
127         long codeId, long companyId,
128         com.liferay.portal.kernel.util.OrderByComparator obc)
129         throws com.liferay.portal.SystemException,
130             com.liferay.portal.NoSuchResourceCodeException {
131         return getPersistence()
132                    .findByCompanyId_PrevAndNext(codeId, companyId, obc);
133     }
134 
135     public static java.util.List<com.liferay.portal.model.ResourceCode> findByName(
136         java.lang.String name) throws com.liferay.portal.SystemException {
137         return getPersistence().findByName(name);
138     }
139 
140     public static java.util.List<com.liferay.portal.model.ResourceCode> findByName(
141         java.lang.String name, int begin, int end)
142         throws com.liferay.portal.SystemException {
143         return getPersistence().findByName(name, begin, end);
144     }
145 
146     public static java.util.List<com.liferay.portal.model.ResourceCode> findByName(
147         java.lang.String name, int begin, int end,
148         com.liferay.portal.kernel.util.OrderByComparator obc)
149         throws com.liferay.portal.SystemException {
150         return getPersistence().findByName(name, begin, end, obc);
151     }
152 
153     public static com.liferay.portal.model.ResourceCode findByName_First(
154         java.lang.String name,
155         com.liferay.portal.kernel.util.OrderByComparator obc)
156         throws com.liferay.portal.SystemException,
157             com.liferay.portal.NoSuchResourceCodeException {
158         return getPersistence().findByName_First(name, obc);
159     }
160 
161     public static com.liferay.portal.model.ResourceCode findByName_Last(
162         java.lang.String name,
163         com.liferay.portal.kernel.util.OrderByComparator obc)
164         throws com.liferay.portal.SystemException,
165             com.liferay.portal.NoSuchResourceCodeException {
166         return getPersistence().findByName_Last(name, obc);
167     }
168 
169     public static com.liferay.portal.model.ResourceCode[] findByName_PrevAndNext(
170         long codeId, java.lang.String name,
171         com.liferay.portal.kernel.util.OrderByComparator obc)
172         throws com.liferay.portal.SystemException,
173             com.liferay.portal.NoSuchResourceCodeException {
174         return getPersistence().findByName_PrevAndNext(codeId, name, obc);
175     }
176 
177     public static com.liferay.portal.model.ResourceCode findByC_N_S(
178         long companyId, java.lang.String name, int scope)
179         throws com.liferay.portal.SystemException,
180             com.liferay.portal.NoSuchResourceCodeException {
181         return getPersistence().findByC_N_S(companyId, name, scope);
182     }
183 
184     public static com.liferay.portal.model.ResourceCode fetchByC_N_S(
185         long companyId, java.lang.String name, int scope)
186         throws com.liferay.portal.SystemException {
187         return getPersistence().fetchByC_N_S(companyId, name, scope);
188     }
189 
190     public static java.util.List<com.liferay.portal.model.ResourceCode> findWithDynamicQuery(
191         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer)
192         throws com.liferay.portal.SystemException {
193         return getPersistence().findWithDynamicQuery(queryInitializer);
194     }
195 
196     public static java.util.List<com.liferay.portal.model.ResourceCode> findWithDynamicQuery(
197         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer,
198         int begin, int end) throws com.liferay.portal.SystemException {
199         return getPersistence()
200                    .findWithDynamicQuery(queryInitializer, begin, end);
201     }
202 
203     public static java.util.List<com.liferay.portal.model.ResourceCode> findAll()
204         throws com.liferay.portal.SystemException {
205         return getPersistence().findAll();
206     }
207 
208     public static java.util.List<com.liferay.portal.model.ResourceCode> findAll(
209         int begin, int end) throws com.liferay.portal.SystemException {
210         return getPersistence().findAll(begin, end);
211     }
212 
213     public static java.util.List<com.liferay.portal.model.ResourceCode> findAll(
214         int begin, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
215         throws com.liferay.portal.SystemException {
216         return getPersistence().findAll(begin, end, obc);
217     }
218 
219     public static void removeByCompanyId(long companyId)
220         throws com.liferay.portal.SystemException {
221         getPersistence().removeByCompanyId(companyId);
222     }
223 
224     public static void removeByName(java.lang.String name)
225         throws com.liferay.portal.SystemException {
226         getPersistence().removeByName(name);
227     }
228 
229     public static void removeByC_N_S(long companyId, java.lang.String name,
230         int scope)
231         throws com.liferay.portal.SystemException,
232             com.liferay.portal.NoSuchResourceCodeException {
233         getPersistence().removeByC_N_S(companyId, name, scope);
234     }
235 
236     public static void removeAll() throws com.liferay.portal.SystemException {
237         getPersistence().removeAll();
238     }
239 
240     public static int countByCompanyId(long companyId)
241         throws com.liferay.portal.SystemException {
242         return getPersistence().countByCompanyId(companyId);
243     }
244 
245     public static int countByName(java.lang.String name)
246         throws com.liferay.portal.SystemException {
247         return getPersistence().countByName(name);
248     }
249 
250     public static int countByC_N_S(long companyId, java.lang.String name,
251         int scope) throws com.liferay.portal.SystemException {
252         return getPersistence().countByC_N_S(companyId, name, scope);
253     }
254 
255     public static int countAll() throws com.liferay.portal.SystemException {
256         return getPersistence().countAll();
257     }
258 
259     public static ResourceCodePersistence getPersistence() {
260         return _getUtil()._persistence;
261     }
262 
263     public void setPersistence(ResourceCodePersistence persistence) {
264         _persistence = persistence;
265     }
266 
267     private static ResourceCodeUtil _getUtil() {
268         if (_util == null) {
269             _util = (ResourceCodeUtil)com.liferay.portal.kernel.bean.BeanLocatorUtil.locate(_UTIL);
270         }
271 
272         return _util;
273     }
274 
275     private static final String _UTIL = ResourceCodeUtil.class.getName();
276     private static ResourceCodeUtil _util;
277     private ResourceCodePersistence _persistence;
278 }