1   /**
2    * Copyright (c) 2000-2007 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.softwarecatalog.service.persistence;
24  
25  import com.liferay.portal.kernel.util.GetterUtil;
26  import com.liferay.portal.kernel.util.Validator;
27  import com.liferay.portal.model.ModelListener;
28  import com.liferay.portal.util.PropsUtil;
29  
30  import org.apache.commons.logging.Log;
31  import org.apache.commons.logging.LogFactory;
32  
33  /**
34   * <a href="SCFrameworkVersionUtil.java.html"><b><i>View Source</i></b></a>
35   *
36   * @author Brian Wing Shun Chan
37   *
38   */
39  public class SCFrameworkVersionUtil {
40      public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion create(
41          long frameworkVersionId) {
42          return getPersistence().create(frameworkVersionId);
43      }
44  
45      public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion remove(
46          long frameworkVersionId)
47          throws com.liferay.portal.SystemException, 
48              com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException {
49          ModelListener listener = _getListener();
50  
51          if (listener != null) {
52              listener.onBeforeRemove(findByPrimaryKey(frameworkVersionId));
53          }
54  
55          com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion =
56              getPersistence().remove(frameworkVersionId);
57  
58          if (listener != null) {
59              listener.onAfterRemove(scFrameworkVersion);
60          }
61  
62          return scFrameworkVersion;
63      }
64  
65      public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion remove(
66          com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion)
67          throws com.liferay.portal.SystemException {
68          ModelListener listener = _getListener();
69  
70          if (listener != null) {
71              listener.onBeforeRemove(scFrameworkVersion);
72          }
73  
74          scFrameworkVersion = getPersistence().remove(scFrameworkVersion);
75  
76          if (listener != null) {
77              listener.onAfterRemove(scFrameworkVersion);
78          }
79  
80          return scFrameworkVersion;
81      }
82  
83      public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion update(
84          com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion)
85          throws com.liferay.portal.SystemException {
86          ModelListener listener = _getListener();
87          boolean isNew = scFrameworkVersion.isNew();
88  
89          if (listener != null) {
90              if (isNew) {
91                  listener.onBeforeCreate(scFrameworkVersion);
92              }
93              else {
94                  listener.onBeforeUpdate(scFrameworkVersion);
95              }
96          }
97  
98          scFrameworkVersion = getPersistence().update(scFrameworkVersion);
99  
100         if (listener != null) {
101             if (isNew) {
102                 listener.onAfterCreate(scFrameworkVersion);
103             }
104             else {
105                 listener.onAfterUpdate(scFrameworkVersion);
106             }
107         }
108 
109         return scFrameworkVersion;
110     }
111 
112     public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion update(
113         com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion,
114         boolean merge) throws com.liferay.portal.SystemException {
115         ModelListener listener = _getListener();
116         boolean isNew = scFrameworkVersion.isNew();
117 
118         if (listener != null) {
119             if (isNew) {
120                 listener.onBeforeCreate(scFrameworkVersion);
121             }
122             else {
123                 listener.onBeforeUpdate(scFrameworkVersion);
124             }
125         }
126 
127         scFrameworkVersion = getPersistence().update(scFrameworkVersion, merge);
128 
129         if (listener != null) {
130             if (isNew) {
131                 listener.onAfterCreate(scFrameworkVersion);
132             }
133             else {
134                 listener.onAfterUpdate(scFrameworkVersion);
135             }
136         }
137 
138         return scFrameworkVersion;
139     }
140 
141     public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion findByPrimaryKey(
142         long frameworkVersionId)
143         throws com.liferay.portal.SystemException, 
144             com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException {
145         return getPersistence().findByPrimaryKey(frameworkVersionId);
146     }
147 
148     public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion fetchByPrimaryKey(
149         long frameworkVersionId) throws com.liferay.portal.SystemException {
150         return getPersistence().fetchByPrimaryKey(frameworkVersionId);
151     }
152 
153     public static java.util.List findByGroupId(long groupId)
154         throws com.liferay.portal.SystemException {
155         return getPersistence().findByGroupId(groupId);
156     }
157 
158     public static java.util.List findByGroupId(long groupId, int begin, int end)
159         throws com.liferay.portal.SystemException {
160         return getPersistence().findByGroupId(groupId, begin, end);
161     }
162 
163     public static java.util.List findByGroupId(long groupId, int begin,
164         int end, com.liferay.portal.kernel.util.OrderByComparator obc)
165         throws com.liferay.portal.SystemException {
166         return getPersistence().findByGroupId(groupId, begin, end, obc);
167     }
168 
169     public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion findByGroupId_First(
170         long groupId, com.liferay.portal.kernel.util.OrderByComparator obc)
171         throws com.liferay.portal.SystemException, 
172             com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException {
173         return getPersistence().findByGroupId_First(groupId, obc);
174     }
175 
176     public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion findByGroupId_Last(
177         long groupId, com.liferay.portal.kernel.util.OrderByComparator obc)
178         throws com.liferay.portal.SystemException, 
179             com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException {
180         return getPersistence().findByGroupId_Last(groupId, obc);
181     }
182 
183     public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion[] findByGroupId_PrevAndNext(
184         long frameworkVersionId, long groupId,
185         com.liferay.portal.kernel.util.OrderByComparator obc)
186         throws com.liferay.portal.SystemException, 
187             com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException {
188         return getPersistence().findByGroupId_PrevAndNext(frameworkVersionId,
189             groupId, obc);
190     }
191 
192     public static java.util.List findByCompanyId(long companyId)
193         throws com.liferay.portal.SystemException {
194         return getPersistence().findByCompanyId(companyId);
195     }
196 
197     public static java.util.List findByCompanyId(long companyId, int begin,
198         int end) throws com.liferay.portal.SystemException {
199         return getPersistence().findByCompanyId(companyId, begin, end);
200     }
201 
202     public static java.util.List findByCompanyId(long companyId, int begin,
203         int end, com.liferay.portal.kernel.util.OrderByComparator obc)
204         throws com.liferay.portal.SystemException {
205         return getPersistence().findByCompanyId(companyId, begin, end, obc);
206     }
207 
208     public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion findByCompanyId_First(
209         long companyId, com.liferay.portal.kernel.util.OrderByComparator obc)
210         throws com.liferay.portal.SystemException, 
211             com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException {
212         return getPersistence().findByCompanyId_First(companyId, obc);
213     }
214 
215     public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion findByCompanyId_Last(
216         long companyId, com.liferay.portal.kernel.util.OrderByComparator obc)
217         throws com.liferay.portal.SystemException, 
218             com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException {
219         return getPersistence().findByCompanyId_Last(companyId, obc);
220     }
221 
222     public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion[] findByCompanyId_PrevAndNext(
223         long frameworkVersionId, long companyId,
224         com.liferay.portal.kernel.util.OrderByComparator obc)
225         throws com.liferay.portal.SystemException, 
226             com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException {
227         return getPersistence().findByCompanyId_PrevAndNext(frameworkVersionId,
228             companyId, obc);
229     }
230 
231     public static java.util.List findByG_A(long groupId, boolean active)
232         throws com.liferay.portal.SystemException {
233         return getPersistence().findByG_A(groupId, active);
234     }
235 
236     public static java.util.List findByG_A(long groupId, boolean active,
237         int begin, int end) throws com.liferay.portal.SystemException {
238         return getPersistence().findByG_A(groupId, active, begin, end);
239     }
240 
241     public static java.util.List findByG_A(long groupId, boolean active,
242         int begin, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
243         throws com.liferay.portal.SystemException {
244         return getPersistence().findByG_A(groupId, active, begin, end, obc);
245     }
246 
247     public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion findByG_A_First(
248         long groupId, boolean active,
249         com.liferay.portal.kernel.util.OrderByComparator obc)
250         throws com.liferay.portal.SystemException, 
251             com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException {
252         return getPersistence().findByG_A_First(groupId, active, obc);
253     }
254 
255     public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion findByG_A_Last(
256         long groupId, boolean active,
257         com.liferay.portal.kernel.util.OrderByComparator obc)
258         throws com.liferay.portal.SystemException, 
259             com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException {
260         return getPersistence().findByG_A_Last(groupId, active, obc);
261     }
262 
263     public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion[] findByG_A_PrevAndNext(
264         long frameworkVersionId, long groupId, boolean active,
265         com.liferay.portal.kernel.util.OrderByComparator obc)
266         throws com.liferay.portal.SystemException, 
267             com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException {
268         return getPersistence().findByG_A_PrevAndNext(frameworkVersionId,
269             groupId, active, obc);
270     }
271 
272     public static java.util.List findWithDynamicQuery(
273         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer)
274         throws com.liferay.portal.SystemException {
275         return getPersistence().findWithDynamicQuery(queryInitializer);
276     }
277 
278     public static java.util.List findWithDynamicQuery(
279         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer,
280         int begin, int end) throws com.liferay.portal.SystemException {
281         return getPersistence().findWithDynamicQuery(queryInitializer, begin,
282             end);
283     }
284 
285     public static java.util.List findAll()
286         throws com.liferay.portal.SystemException {
287         return getPersistence().findAll();
288     }
289 
290     public static java.util.List findAll(int begin, int end)
291         throws com.liferay.portal.SystemException {
292         return getPersistence().findAll(begin, end);
293     }
294 
295     public static java.util.List findAll(int begin, int end,
296         com.liferay.portal.kernel.util.OrderByComparator obc)
297         throws com.liferay.portal.SystemException {
298         return getPersistence().findAll(begin, end, obc);
299     }
300 
301     public static void removeByGroupId(long groupId)
302         throws com.liferay.portal.SystemException {
303         getPersistence().removeByGroupId(groupId);
304     }
305 
306     public static void removeByCompanyId(long companyId)
307         throws com.liferay.portal.SystemException {
308         getPersistence().removeByCompanyId(companyId);
309     }
310 
311     public static void removeByG_A(long groupId, boolean active)
312         throws com.liferay.portal.SystemException {
313         getPersistence().removeByG_A(groupId, active);
314     }
315 
316     public static void removeAll() throws com.liferay.portal.SystemException {
317         getPersistence().removeAll();
318     }
319 
320     public static int countByGroupId(long groupId)
321         throws com.liferay.portal.SystemException {
322         return getPersistence().countByGroupId(groupId);
323     }
324 
325     public static int countByCompanyId(long companyId)
326         throws com.liferay.portal.SystemException {
327         return getPersistence().countByCompanyId(companyId);
328     }
329 
330     public static int countByG_A(long groupId, boolean active)
331         throws com.liferay.portal.SystemException {
332         return getPersistence().countByG_A(groupId, active);
333     }
334 
335     public static int countAll() throws com.liferay.portal.SystemException {
336         return getPersistence().countAll();
337     }
338 
339     public static SCFrameworkVersionPersistence getPersistence() {
340         return _getUtil()._persistence;
341     }
342 
343     public void setPersistence(SCFrameworkVersionPersistence persistence) {
344         _persistence = persistence;
345     }
346 
347     private static SCFrameworkVersionUtil _getUtil() {
348         if (_util == null) {
349             _util = (SCFrameworkVersionUtil)com.liferay.portal.kernel.bean.BeanLocatorUtil.locate(_UTIL);
350         }
351 
352         return _util;
353     }
354 
355     private static ModelListener _getListener() {
356         if (Validator.isNotNull(_LISTENER)) {
357             try {
358                 return (ModelListener)Class.forName(_LISTENER).newInstance();
359             }
360             catch (Exception e) {
361                 _log.error(e);
362             }
363         }
364 
365         return null;
366     }
367 
368     private static final String _UTIL = SCFrameworkVersionUtil.class.getName();
369     private static final String _LISTENER = GetterUtil.getString(PropsUtil.get(
370                 "value.object.listener.com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion"));
371     private static Log _log = LogFactory.getLog(SCFrameworkVersionUtil.class);
372     private static SCFrameworkVersionUtil _util;
373     private SCFrameworkVersionPersistence _persistence;
374 }