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 OrgGroupRoleUtil {
40 public static com.liferay.portal.model.OrgGroupRole create(
41 com.liferay.portal.service.persistence.OrgGroupRolePK orgGroupRolePK) {
42 return getPersistence().create(orgGroupRolePK);
43 }
44
45 public static com.liferay.portal.model.OrgGroupRole remove(
46 com.liferay.portal.service.persistence.OrgGroupRolePK orgGroupRolePK)
47 throws com.liferay.portal.SystemException,
48 com.liferay.portal.NoSuchOrgGroupRoleException {
49 ModelListener listener = _getListener();
50
51 if (listener != null) {
52 listener.onBeforeRemove(findByPrimaryKey(orgGroupRolePK));
53 }
54
55 com.liferay.portal.model.OrgGroupRole orgGroupRole = getPersistence()
56 .remove(orgGroupRolePK);
57
58 if (listener != null) {
59 listener.onAfterRemove(orgGroupRole);
60 }
61
62 return orgGroupRole;
63 }
64
65 public static com.liferay.portal.model.OrgGroupRole remove(
66 com.liferay.portal.model.OrgGroupRole orgGroupRole)
67 throws com.liferay.portal.SystemException {
68 ModelListener listener = _getListener();
69
70 if (listener != null) {
71 listener.onBeforeRemove(orgGroupRole);
72 }
73
74 orgGroupRole = getPersistence().remove(orgGroupRole);
75
76 if (listener != null) {
77 listener.onAfterRemove(orgGroupRole);
78 }
79
80 return orgGroupRole;
81 }
82
83 public static com.liferay.portal.model.OrgGroupRole update(
84 com.liferay.portal.model.OrgGroupRole orgGroupRole)
85 throws com.liferay.portal.SystemException {
86 ModelListener listener = _getListener();
87 boolean isNew = orgGroupRole.isNew();
88
89 if (listener != null) {
90 if (isNew) {
91 listener.onBeforeCreate(orgGroupRole);
92 }
93 else {
94 listener.onBeforeUpdate(orgGroupRole);
95 }
96 }
97
98 orgGroupRole = getPersistence().update(orgGroupRole);
99
100 if (listener != null) {
101 if (isNew) {
102 listener.onAfterCreate(orgGroupRole);
103 }
104 else {
105 listener.onAfterUpdate(orgGroupRole);
106 }
107 }
108
109 return orgGroupRole;
110 }
111
112 public static com.liferay.portal.model.OrgGroupRole update(
113 com.liferay.portal.model.OrgGroupRole orgGroupRole, boolean merge)
114 throws com.liferay.portal.SystemException {
115 ModelListener listener = _getListener();
116 boolean isNew = orgGroupRole.isNew();
117
118 if (listener != null) {
119 if (isNew) {
120 listener.onBeforeCreate(orgGroupRole);
121 }
122 else {
123 listener.onBeforeUpdate(orgGroupRole);
124 }
125 }
126
127 orgGroupRole = getPersistence().update(orgGroupRole, merge);
128
129 if (listener != null) {
130 if (isNew) {
131 listener.onAfterCreate(orgGroupRole);
132 }
133 else {
134 listener.onAfterUpdate(orgGroupRole);
135 }
136 }
137
138 return orgGroupRole;
139 }
140
141 public static com.liferay.portal.model.OrgGroupRole findByPrimaryKey(
142 com.liferay.portal.service.persistence.OrgGroupRolePK orgGroupRolePK)
143 throws com.liferay.portal.SystemException,
144 com.liferay.portal.NoSuchOrgGroupRoleException {
145 return getPersistence().findByPrimaryKey(orgGroupRolePK);
146 }
147
148 public static com.liferay.portal.model.OrgGroupRole fetchByPrimaryKey(
149 com.liferay.portal.service.persistence.OrgGroupRolePK orgGroupRolePK)
150 throws com.liferay.portal.SystemException {
151 return getPersistence().fetchByPrimaryKey(orgGroupRolePK);
152 }
153
154 public static java.util.List findByGroupId(long groupId)
155 throws com.liferay.portal.SystemException {
156 return getPersistence().findByGroupId(groupId);
157 }
158
159 public static java.util.List findByGroupId(long groupId, int begin, int end)
160 throws com.liferay.portal.SystemException {
161 return getPersistence().findByGroupId(groupId, begin, end);
162 }
163
164 public static java.util.List findByGroupId(long groupId, int begin,
165 int end, com.liferay.portal.kernel.util.OrderByComparator obc)
166 throws com.liferay.portal.SystemException {
167 return getPersistence().findByGroupId(groupId, begin, end, obc);
168 }
169
170 public static com.liferay.portal.model.OrgGroupRole findByGroupId_First(
171 long groupId, com.liferay.portal.kernel.util.OrderByComparator obc)
172 throws com.liferay.portal.SystemException,
173 com.liferay.portal.NoSuchOrgGroupRoleException {
174 return getPersistence().findByGroupId_First(groupId, obc);
175 }
176
177 public static com.liferay.portal.model.OrgGroupRole findByGroupId_Last(
178 long groupId, com.liferay.portal.kernel.util.OrderByComparator obc)
179 throws com.liferay.portal.SystemException,
180 com.liferay.portal.NoSuchOrgGroupRoleException {
181 return getPersistence().findByGroupId_Last(groupId, obc);
182 }
183
184 public static com.liferay.portal.model.OrgGroupRole[] findByGroupId_PrevAndNext(
185 com.liferay.portal.service.persistence.OrgGroupRolePK orgGroupRolePK,
186 long groupId, com.liferay.portal.kernel.util.OrderByComparator obc)
187 throws com.liferay.portal.SystemException,
188 com.liferay.portal.NoSuchOrgGroupRoleException {
189 return getPersistence().findByGroupId_PrevAndNext(orgGroupRolePK,
190 groupId, obc);
191 }
192
193 public static java.util.List findByRoleId(long roleId)
194 throws com.liferay.portal.SystemException {
195 return getPersistence().findByRoleId(roleId);
196 }
197
198 public static java.util.List findByRoleId(long roleId, int begin, int end)
199 throws com.liferay.portal.SystemException {
200 return getPersistence().findByRoleId(roleId, begin, end);
201 }
202
203 public static java.util.List findByRoleId(long roleId, int begin, int end,
204 com.liferay.portal.kernel.util.OrderByComparator obc)
205 throws com.liferay.portal.SystemException {
206 return getPersistence().findByRoleId(roleId, begin, end, obc);
207 }
208
209 public static com.liferay.portal.model.OrgGroupRole findByRoleId_First(
210 long roleId, com.liferay.portal.kernel.util.OrderByComparator obc)
211 throws com.liferay.portal.SystemException,
212 com.liferay.portal.NoSuchOrgGroupRoleException {
213 return getPersistence().findByRoleId_First(roleId, obc);
214 }
215
216 public static com.liferay.portal.model.OrgGroupRole findByRoleId_Last(
217 long roleId, com.liferay.portal.kernel.util.OrderByComparator obc)
218 throws com.liferay.portal.SystemException,
219 com.liferay.portal.NoSuchOrgGroupRoleException {
220 return getPersistence().findByRoleId_Last(roleId, obc);
221 }
222
223 public static com.liferay.portal.model.OrgGroupRole[] findByRoleId_PrevAndNext(
224 com.liferay.portal.service.persistence.OrgGroupRolePK orgGroupRolePK,
225 long roleId, com.liferay.portal.kernel.util.OrderByComparator obc)
226 throws com.liferay.portal.SystemException,
227 com.liferay.portal.NoSuchOrgGroupRoleException {
228 return getPersistence().findByRoleId_PrevAndNext(orgGroupRolePK,
229 roleId, 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 removeByGroupId(long groupId)
262 throws com.liferay.portal.SystemException {
263 getPersistence().removeByGroupId(groupId);
264 }
265
266 public static void removeByRoleId(long roleId)
267 throws com.liferay.portal.SystemException {
268 getPersistence().removeByRoleId(roleId);
269 }
270
271 public static void removeAll() throws com.liferay.portal.SystemException {
272 getPersistence().removeAll();
273 }
274
275 public static int countByGroupId(long groupId)
276 throws com.liferay.portal.SystemException {
277 return getPersistence().countByGroupId(groupId);
278 }
279
280 public static int countByRoleId(long roleId)
281 throws com.liferay.portal.SystemException {
282 return getPersistence().countByRoleId(roleId);
283 }
284
285 public static int countAll() throws com.liferay.portal.SystemException {
286 return getPersistence().countAll();
287 }
288
289 public static OrgGroupRolePersistence getPersistence() {
290 return _getUtil()._persistence;
291 }
292
293 public void setPersistence(OrgGroupRolePersistence persistence) {
294 _persistence = persistence;
295 }
296
297 private static OrgGroupRoleUtil _getUtil() {
298 if (_util == null) {
299 _util = (OrgGroupRoleUtil)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 = OrgGroupRoleUtil.class.getName();
319 private static final String _LISTENER = GetterUtil.getString(PropsUtil.get(
320 "value.object.listener.com.liferay.portal.model.OrgGroupRole"));
321 private static Log _log = LogFactory.getLog(OrgGroupRoleUtil.class);
322 private static OrgGroupRoleUtil _util;
323 private OrgGroupRolePersistence _persistence;
324 }