1
22
23 package com.liferay.portal.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 UserGroupRoleUtil {
40 public static com.liferay.portal.model.UserGroupRole create(
41 com.liferay.portal.service.persistence.UserGroupRolePK userGroupRolePK) {
42 return getPersistence().create(userGroupRolePK);
43 }
44
45 public static com.liferay.portal.model.UserGroupRole remove(
46 com.liferay.portal.service.persistence.UserGroupRolePK userGroupRolePK)
47 throws com.liferay.portal.SystemException,
48 com.liferay.portal.NoSuchUserGroupRoleException {
49 ModelListener listener = _getListener();
50
51 if (listener != null) {
52 listener.onBeforeRemove(findByPrimaryKey(userGroupRolePK));
53 }
54
55 com.liferay.portal.model.UserGroupRole userGroupRole = getPersistence()
56 .remove(userGroupRolePK);
57
58 if (listener != null) {
59 listener.onAfterRemove(userGroupRole);
60 }
61
62 return userGroupRole;
63 }
64
65 public static com.liferay.portal.model.UserGroupRole remove(
66 com.liferay.portal.model.UserGroupRole userGroupRole)
67 throws com.liferay.portal.SystemException {
68 ModelListener listener = _getListener();
69
70 if (listener != null) {
71 listener.onBeforeRemove(userGroupRole);
72 }
73
74 userGroupRole = getPersistence().remove(userGroupRole);
75
76 if (listener != null) {
77 listener.onAfterRemove(userGroupRole);
78 }
79
80 return userGroupRole;
81 }
82
83 public static com.liferay.portal.model.UserGroupRole update(
84 com.liferay.portal.model.UserGroupRole userGroupRole)
85 throws com.liferay.portal.SystemException {
86 ModelListener listener = _getListener();
87 boolean isNew = userGroupRole.isNew();
88
89 if (listener != null) {
90 if (isNew) {
91 listener.onBeforeCreate(userGroupRole);
92 }
93 else {
94 listener.onBeforeUpdate(userGroupRole);
95 }
96 }
97
98 userGroupRole = getPersistence().update(userGroupRole);
99
100 if (listener != null) {
101 if (isNew) {
102 listener.onAfterCreate(userGroupRole);
103 }
104 else {
105 listener.onAfterUpdate(userGroupRole);
106 }
107 }
108
109 return userGroupRole;
110 }
111
112 public static com.liferay.portal.model.UserGroupRole update(
113 com.liferay.portal.model.UserGroupRole userGroupRole, boolean merge)
114 throws com.liferay.portal.SystemException {
115 ModelListener listener = _getListener();
116 boolean isNew = userGroupRole.isNew();
117
118 if (listener != null) {
119 if (isNew) {
120 listener.onBeforeCreate(userGroupRole);
121 }
122 else {
123 listener.onBeforeUpdate(userGroupRole);
124 }
125 }
126
127 userGroupRole = getPersistence().update(userGroupRole, merge);
128
129 if (listener != null) {
130 if (isNew) {
131 listener.onAfterCreate(userGroupRole);
132 }
133 else {
134 listener.onAfterUpdate(userGroupRole);
135 }
136 }
137
138 return userGroupRole;
139 }
140
141 public static com.liferay.portal.model.UserGroupRole findByPrimaryKey(
142 com.liferay.portal.service.persistence.UserGroupRolePK userGroupRolePK)
143 throws com.liferay.portal.SystemException,
144 com.liferay.portal.NoSuchUserGroupRoleException {
145 return getPersistence().findByPrimaryKey(userGroupRolePK);
146 }
147
148 public static com.liferay.portal.model.UserGroupRole fetchByPrimaryKey(
149 com.liferay.portal.service.persistence.UserGroupRolePK userGroupRolePK)
150 throws com.liferay.portal.SystemException {
151 return getPersistence().fetchByPrimaryKey(userGroupRolePK);
152 }
153
154 public static java.util.List findByU_G(long userId, long groupId)
155 throws com.liferay.portal.SystemException {
156 return getPersistence().findByU_G(userId, groupId);
157 }
158
159 public static java.util.List findByU_G(long userId, long groupId,
160 int begin, int end) throws com.liferay.portal.SystemException {
161 return getPersistence().findByU_G(userId, groupId, begin, end);
162 }
163
164 public static java.util.List findByU_G(long userId, long groupId,
165 int begin, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
166 throws com.liferay.portal.SystemException {
167 return getPersistence().findByU_G(userId, groupId, begin, end, obc);
168 }
169
170 public static com.liferay.portal.model.UserGroupRole findByU_G_First(
171 long userId, long groupId,
172 com.liferay.portal.kernel.util.OrderByComparator obc)
173 throws com.liferay.portal.SystemException,
174 com.liferay.portal.NoSuchUserGroupRoleException {
175 return getPersistence().findByU_G_First(userId, groupId, obc);
176 }
177
178 public static com.liferay.portal.model.UserGroupRole findByU_G_Last(
179 long userId, long groupId,
180 com.liferay.portal.kernel.util.OrderByComparator obc)
181 throws com.liferay.portal.SystemException,
182 com.liferay.portal.NoSuchUserGroupRoleException {
183 return getPersistence().findByU_G_Last(userId, groupId, obc);
184 }
185
186 public static com.liferay.portal.model.UserGroupRole[] findByU_G_PrevAndNext(
187 com.liferay.portal.service.persistence.UserGroupRolePK userGroupRolePK,
188 long userId, long groupId,
189 com.liferay.portal.kernel.util.OrderByComparator obc)
190 throws com.liferay.portal.SystemException,
191 com.liferay.portal.NoSuchUserGroupRoleException {
192 return getPersistence().findByU_G_PrevAndNext(userGroupRolePK, userId,
193 groupId, obc);
194 }
195
196 public static java.util.List findByUserId(long userId)
197 throws com.liferay.portal.SystemException {
198 return getPersistence().findByUserId(userId);
199 }
200
201 public static java.util.List findByUserId(long userId, int begin, int end)
202 throws com.liferay.portal.SystemException {
203 return getPersistence().findByUserId(userId, begin, end);
204 }
205
206 public static java.util.List findByUserId(long userId, int begin, int end,
207 com.liferay.portal.kernel.util.OrderByComparator obc)
208 throws com.liferay.portal.SystemException {
209 return getPersistence().findByUserId(userId, begin, end, obc);
210 }
211
212 public static com.liferay.portal.model.UserGroupRole findByUserId_First(
213 long userId, com.liferay.portal.kernel.util.OrderByComparator obc)
214 throws com.liferay.portal.SystemException,
215 com.liferay.portal.NoSuchUserGroupRoleException {
216 return getPersistence().findByUserId_First(userId, obc);
217 }
218
219 public static com.liferay.portal.model.UserGroupRole findByUserId_Last(
220 long userId, com.liferay.portal.kernel.util.OrderByComparator obc)
221 throws com.liferay.portal.SystemException,
222 com.liferay.portal.NoSuchUserGroupRoleException {
223 return getPersistence().findByUserId_Last(userId, obc);
224 }
225
226 public static com.liferay.portal.model.UserGroupRole[] findByUserId_PrevAndNext(
227 com.liferay.portal.service.persistence.UserGroupRolePK userGroupRolePK,
228 long userId, com.liferay.portal.kernel.util.OrderByComparator obc)
229 throws com.liferay.portal.SystemException,
230 com.liferay.portal.NoSuchUserGroupRoleException {
231 return getPersistence().findByUserId_PrevAndNext(userGroupRolePK,
232 userId, obc);
233 }
234
235 public static java.util.List findByGroupId(long groupId)
236 throws com.liferay.portal.SystemException {
237 return getPersistence().findByGroupId(groupId);
238 }
239
240 public static java.util.List findByGroupId(long groupId, int begin, int end)
241 throws com.liferay.portal.SystemException {
242 return getPersistence().findByGroupId(groupId, begin, end);
243 }
244
245 public static java.util.List findByGroupId(long groupId, int begin,
246 int end, com.liferay.portal.kernel.util.OrderByComparator obc)
247 throws com.liferay.portal.SystemException {
248 return getPersistence().findByGroupId(groupId, begin, end, obc);
249 }
250
251 public static com.liferay.portal.model.UserGroupRole findByGroupId_First(
252 long groupId, com.liferay.portal.kernel.util.OrderByComparator obc)
253 throws com.liferay.portal.SystemException,
254 com.liferay.portal.NoSuchUserGroupRoleException {
255 return getPersistence().findByGroupId_First(groupId, obc);
256 }
257
258 public static com.liferay.portal.model.UserGroupRole findByGroupId_Last(
259 long groupId, com.liferay.portal.kernel.util.OrderByComparator obc)
260 throws com.liferay.portal.SystemException,
261 com.liferay.portal.NoSuchUserGroupRoleException {
262 return getPersistence().findByGroupId_Last(groupId, obc);
263 }
264
265 public static com.liferay.portal.model.UserGroupRole[] findByGroupId_PrevAndNext(
266 com.liferay.portal.service.persistence.UserGroupRolePK userGroupRolePK,
267 long groupId, com.liferay.portal.kernel.util.OrderByComparator obc)
268 throws com.liferay.portal.SystemException,
269 com.liferay.portal.NoSuchUserGroupRoleException {
270 return getPersistence().findByGroupId_PrevAndNext(userGroupRolePK,
271 groupId, obc);
272 }
273
274 public static java.util.List findByRoleId(long roleId)
275 throws com.liferay.portal.SystemException {
276 return getPersistence().findByRoleId(roleId);
277 }
278
279 public static java.util.List findByRoleId(long roleId, int begin, int end)
280 throws com.liferay.portal.SystemException {
281 return getPersistence().findByRoleId(roleId, begin, end);
282 }
283
284 public static java.util.List findByRoleId(long roleId, int begin, int end,
285 com.liferay.portal.kernel.util.OrderByComparator obc)
286 throws com.liferay.portal.SystemException {
287 return getPersistence().findByRoleId(roleId, begin, end, obc);
288 }
289
290 public static com.liferay.portal.model.UserGroupRole findByRoleId_First(
291 long roleId, com.liferay.portal.kernel.util.OrderByComparator obc)
292 throws com.liferay.portal.SystemException,
293 com.liferay.portal.NoSuchUserGroupRoleException {
294 return getPersistence().findByRoleId_First(roleId, obc);
295 }
296
297 public static com.liferay.portal.model.UserGroupRole findByRoleId_Last(
298 long roleId, com.liferay.portal.kernel.util.OrderByComparator obc)
299 throws com.liferay.portal.SystemException,
300 com.liferay.portal.NoSuchUserGroupRoleException {
301 return getPersistence().findByRoleId_Last(roleId, obc);
302 }
303
304 public static com.liferay.portal.model.UserGroupRole[] findByRoleId_PrevAndNext(
305 com.liferay.portal.service.persistence.UserGroupRolePK userGroupRolePK,
306 long roleId, com.liferay.portal.kernel.util.OrderByComparator obc)
307 throws com.liferay.portal.SystemException,
308 com.liferay.portal.NoSuchUserGroupRoleException {
309 return getPersistence().findByRoleId_PrevAndNext(userGroupRolePK,
310 roleId, obc);
311 }
312
313 public static java.util.List findWithDynamicQuery(
314 com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer)
315 throws com.liferay.portal.SystemException {
316 return getPersistence().findWithDynamicQuery(queryInitializer);
317 }
318
319 public static java.util.List findWithDynamicQuery(
320 com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer,
321 int begin, int end) throws com.liferay.portal.SystemException {
322 return getPersistence().findWithDynamicQuery(queryInitializer, begin,
323 end);
324 }
325
326 public static java.util.List findAll()
327 throws com.liferay.portal.SystemException {
328 return getPersistence().findAll();
329 }
330
331 public static java.util.List findAll(int begin, int end)
332 throws com.liferay.portal.SystemException {
333 return getPersistence().findAll(begin, end);
334 }
335
336 public static java.util.List findAll(int begin, int end,
337 com.liferay.portal.kernel.util.OrderByComparator obc)
338 throws com.liferay.portal.SystemException {
339 return getPersistence().findAll(begin, end, obc);
340 }
341
342 public static void removeByU_G(long userId, long groupId)
343 throws com.liferay.portal.SystemException {
344 getPersistence().removeByU_G(userId, groupId);
345 }
346
347 public static void removeByUserId(long userId)
348 throws com.liferay.portal.SystemException {
349 getPersistence().removeByUserId(userId);
350 }
351
352 public static void removeByGroupId(long groupId)
353 throws com.liferay.portal.SystemException {
354 getPersistence().removeByGroupId(groupId);
355 }
356
357 public static void removeByRoleId(long roleId)
358 throws com.liferay.portal.SystemException {
359 getPersistence().removeByRoleId(roleId);
360 }
361
362 public static void removeAll() throws com.liferay.portal.SystemException {
363 getPersistence().removeAll();
364 }
365
366 public static int countByU_G(long userId, long groupId)
367 throws com.liferay.portal.SystemException {
368 return getPersistence().countByU_G(userId, groupId);
369 }
370
371 public static int countByUserId(long userId)
372 throws com.liferay.portal.SystemException {
373 return getPersistence().countByUserId(userId);
374 }
375
376 public static int countByGroupId(long groupId)
377 throws com.liferay.portal.SystemException {
378 return getPersistence().countByGroupId(groupId);
379 }
380
381 public static int countByRoleId(long roleId)
382 throws com.liferay.portal.SystemException {
383 return getPersistence().countByRoleId(roleId);
384 }
385
386 public static int countAll() throws com.liferay.portal.SystemException {
387 return getPersistence().countAll();
388 }
389
390 public static UserGroupRolePersistence getPersistence() {
391 return _getUtil()._persistence;
392 }
393
394 public void setPersistence(UserGroupRolePersistence persistence) {
395 _persistence = persistence;
396 }
397
398 private static UserGroupRoleUtil _getUtil() {
399 if (_util == null) {
400 _util = (UserGroupRoleUtil)com.liferay.portal.kernel.bean.BeanLocatorUtil.locate(_UTIL);
401 }
402
403 return _util;
404 }
405
406 private static ModelListener _getListener() {
407 if (Validator.isNotNull(_LISTENER)) {
408 try {
409 return (ModelListener)Class.forName(_LISTENER).newInstance();
410 }
411 catch (Exception e) {
412 _log.error(e);
413 }
414 }
415
416 return null;
417 }
418
419 private static final String _UTIL = UserGroupRoleUtil.class.getName();
420 private static final String _LISTENER = GetterUtil.getString(PropsUtil.get(
421 "value.object.listener.com.liferay.portal.model.UserGroupRole"));
422 private static Log _log = LogFactory.getLog(UserGroupRoleUtil.class);
423 private static UserGroupRoleUtil _util;
424 private UserGroupRolePersistence _persistence;
425 }