1
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
39 public class SCLicenseUtil {
40 public static com.liferay.portlet.softwarecatalog.model.SCLicense create(
41 long licenseId) {
42 return getPersistence().create(licenseId);
43 }
44
45 public static com.liferay.portlet.softwarecatalog.model.SCLicense remove(
46 long licenseId)
47 throws com.liferay.portal.SystemException,
48 com.liferay.portlet.softwarecatalog.NoSuchLicenseException {
49 ModelListener listener = _getListener();
50
51 if (listener != null) {
52 listener.onBeforeRemove(findByPrimaryKey(licenseId));
53 }
54
55 com.liferay.portlet.softwarecatalog.model.SCLicense scLicense = getPersistence()
56 .remove(licenseId);
57
58 if (listener != null) {
59 listener.onAfterRemove(scLicense);
60 }
61
62 return scLicense;
63 }
64
65 public static com.liferay.portlet.softwarecatalog.model.SCLicense remove(
66 com.liferay.portlet.softwarecatalog.model.SCLicense scLicense)
67 throws com.liferay.portal.SystemException {
68 ModelListener listener = _getListener();
69
70 if (listener != null) {
71 listener.onBeforeRemove(scLicense);
72 }
73
74 scLicense = getPersistence().remove(scLicense);
75
76 if (listener != null) {
77 listener.onAfterRemove(scLicense);
78 }
79
80 return scLicense;
81 }
82
83 public static com.liferay.portlet.softwarecatalog.model.SCLicense update(
84 com.liferay.portlet.softwarecatalog.model.SCLicense scLicense)
85 throws com.liferay.portal.SystemException {
86 ModelListener listener = _getListener();
87 boolean isNew = scLicense.isNew();
88
89 if (listener != null) {
90 if (isNew) {
91 listener.onBeforeCreate(scLicense);
92 }
93 else {
94 listener.onBeforeUpdate(scLicense);
95 }
96 }
97
98 scLicense = getPersistence().update(scLicense);
99
100 if (listener != null) {
101 if (isNew) {
102 listener.onAfterCreate(scLicense);
103 }
104 else {
105 listener.onAfterUpdate(scLicense);
106 }
107 }
108
109 return scLicense;
110 }
111
112 public static com.liferay.portlet.softwarecatalog.model.SCLicense update(
113 com.liferay.portlet.softwarecatalog.model.SCLicense scLicense,
114 boolean merge) throws com.liferay.portal.SystemException {
115 ModelListener listener = _getListener();
116 boolean isNew = scLicense.isNew();
117
118 if (listener != null) {
119 if (isNew) {
120 listener.onBeforeCreate(scLicense);
121 }
122 else {
123 listener.onBeforeUpdate(scLicense);
124 }
125 }
126
127 scLicense = getPersistence().update(scLicense, merge);
128
129 if (listener != null) {
130 if (isNew) {
131 listener.onAfterCreate(scLicense);
132 }
133 else {
134 listener.onAfterUpdate(scLicense);
135 }
136 }
137
138 return scLicense;
139 }
140
141 public static com.liferay.portlet.softwarecatalog.model.SCLicense findByPrimaryKey(
142 long licenseId)
143 throws com.liferay.portal.SystemException,
144 com.liferay.portlet.softwarecatalog.NoSuchLicenseException {
145 return getPersistence().findByPrimaryKey(licenseId);
146 }
147
148 public static com.liferay.portlet.softwarecatalog.model.SCLicense fetchByPrimaryKey(
149 long licenseId) throws com.liferay.portal.SystemException {
150 return getPersistence().fetchByPrimaryKey(licenseId);
151 }
152
153 public static java.util.List findByActive(boolean active)
154 throws com.liferay.portal.SystemException {
155 return getPersistence().findByActive(active);
156 }
157
158 public static java.util.List findByActive(boolean active, int begin, int end)
159 throws com.liferay.portal.SystemException {
160 return getPersistence().findByActive(active, begin, end);
161 }
162
163 public static java.util.List findByActive(boolean active, int begin,
164 int end, com.liferay.portal.kernel.util.OrderByComparator obc)
165 throws com.liferay.portal.SystemException {
166 return getPersistence().findByActive(active, begin, end, obc);
167 }
168
169 public static com.liferay.portlet.softwarecatalog.model.SCLicense findByActive_First(
170 boolean active, com.liferay.portal.kernel.util.OrderByComparator obc)
171 throws com.liferay.portal.SystemException,
172 com.liferay.portlet.softwarecatalog.NoSuchLicenseException {
173 return getPersistence().findByActive_First(active, obc);
174 }
175
176 public static com.liferay.portlet.softwarecatalog.model.SCLicense findByActive_Last(
177 boolean active, com.liferay.portal.kernel.util.OrderByComparator obc)
178 throws com.liferay.portal.SystemException,
179 com.liferay.portlet.softwarecatalog.NoSuchLicenseException {
180 return getPersistence().findByActive_Last(active, obc);
181 }
182
183 public static com.liferay.portlet.softwarecatalog.model.SCLicense[] findByActive_PrevAndNext(
184 long licenseId, boolean active,
185 com.liferay.portal.kernel.util.OrderByComparator obc)
186 throws com.liferay.portal.SystemException,
187 com.liferay.portlet.softwarecatalog.NoSuchLicenseException {
188 return getPersistence().findByActive_PrevAndNext(licenseId, active, obc);
189 }
190
191 public static java.util.List findByA_R(boolean active, boolean recommended)
192 throws com.liferay.portal.SystemException {
193 return getPersistence().findByA_R(active, recommended);
194 }
195
196 public static java.util.List findByA_R(boolean active, boolean recommended,
197 int begin, int end) throws com.liferay.portal.SystemException {
198 return getPersistence().findByA_R(active, recommended, begin, end);
199 }
200
201 public static java.util.List findByA_R(boolean active, boolean recommended,
202 int begin, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
203 throws com.liferay.portal.SystemException {
204 return getPersistence().findByA_R(active, recommended, begin, end, obc);
205 }
206
207 public static com.liferay.portlet.softwarecatalog.model.SCLicense findByA_R_First(
208 boolean active, boolean recommended,
209 com.liferay.portal.kernel.util.OrderByComparator obc)
210 throws com.liferay.portal.SystemException,
211 com.liferay.portlet.softwarecatalog.NoSuchLicenseException {
212 return getPersistence().findByA_R_First(active, recommended, obc);
213 }
214
215 public static com.liferay.portlet.softwarecatalog.model.SCLicense findByA_R_Last(
216 boolean active, boolean recommended,
217 com.liferay.portal.kernel.util.OrderByComparator obc)
218 throws com.liferay.portal.SystemException,
219 com.liferay.portlet.softwarecatalog.NoSuchLicenseException {
220 return getPersistence().findByA_R_Last(active, recommended, obc);
221 }
222
223 public static com.liferay.portlet.softwarecatalog.model.SCLicense[] findByA_R_PrevAndNext(
224 long licenseId, boolean active, boolean recommended,
225 com.liferay.portal.kernel.util.OrderByComparator obc)
226 throws com.liferay.portal.SystemException,
227 com.liferay.portlet.softwarecatalog.NoSuchLicenseException {
228 return getPersistence().findByA_R_PrevAndNext(licenseId, active,
229 recommended, obc);
230 }
231
232 public static java.util.List findWithDynamicQuery(
233 com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer)
234 throws com.liferay.portal.SystemException {
235 return getPersistence().findWithDynamicQuery(queryInitializer);
236 }
237
238 public static java.util.List findWithDynamicQuery(
239 com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer,
240 int begin, int end) throws com.liferay.portal.SystemException {
241 return getPersistence().findWithDynamicQuery(queryInitializer, begin,
242 end);
243 }
244
245 public static java.util.List findAll()
246 throws com.liferay.portal.SystemException {
247 return getPersistence().findAll();
248 }
249
250 public static java.util.List findAll(int begin, int end)
251 throws com.liferay.portal.SystemException {
252 return getPersistence().findAll(begin, end);
253 }
254
255 public static java.util.List findAll(int begin, int end,
256 com.liferay.portal.kernel.util.OrderByComparator obc)
257 throws com.liferay.portal.SystemException {
258 return getPersistence().findAll(begin, end, obc);
259 }
260
261 public static void removeByActive(boolean active)
262 throws com.liferay.portal.SystemException {
263 getPersistence().removeByActive(active);
264 }
265
266 public static void removeByA_R(boolean active, boolean recommended)
267 throws com.liferay.portal.SystemException {
268 getPersistence().removeByA_R(active, recommended);
269 }
270
271 public static void removeAll() throws com.liferay.portal.SystemException {
272 getPersistence().removeAll();
273 }
274
275 public static int countByActive(boolean active)
276 throws com.liferay.portal.SystemException {
277 return getPersistence().countByActive(active);
278 }
279
280 public static int countByA_R(boolean active, boolean recommended)
281 throws com.liferay.portal.SystemException {
282 return getPersistence().countByA_R(active, recommended);
283 }
284
285 public static int countAll() throws com.liferay.portal.SystemException {
286 return getPersistence().countAll();
287 }
288
289 public static SCLicensePersistence getPersistence() {
290 return _getUtil()._persistence;
291 }
292
293 public void setPersistence(SCLicensePersistence persistence) {
294 _persistence = persistence;
295 }
296
297 private static SCLicenseUtil _getUtil() {
298 if (_util == null) {
299 _util = (SCLicenseUtil)com.liferay.portal.kernel.bean.BeanLocatorUtil.locate(_UTIL);
300 }
301
302 return _util;
303 }
304
305 private static ModelListener _getListener() {
306 if (Validator.isNotNull(_LISTENER)) {
307 try {
308 return (ModelListener)Class.forName(_LISTENER).newInstance();
309 }
310 catch (Exception e) {
311 _log.error(e);
312 }
313 }
314
315 return null;
316 }
317
318 private static final String _UTIL = SCLicenseUtil.class.getName();
319 private static final String _LISTENER = GetterUtil.getString(PropsUtil.get(
320 "value.object.listener.com.liferay.portlet.softwarecatalog.model.SCLicense"));
321 private static Log _log = LogFactory.getLog(SCLicenseUtil.class);
322 private static SCLicenseUtil _util;
323 private SCLicensePersistence _persistence;
324 }