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 OrganizationUtil {
40 public static com.liferay.portal.model.Organization create(
41 long organizationId) {
42 return getPersistence().create(organizationId);
43 }
44
45 public static com.liferay.portal.model.Organization remove(
46 long organizationId)
47 throws com.liferay.portal.SystemException,
48 com.liferay.portal.NoSuchOrganizationException {
49 ModelListener listener = _getListener();
50
51 if (listener != null) {
52 listener.onBeforeRemove(findByPrimaryKey(organizationId));
53 }
54
55 com.liferay.portal.model.Organization organization = getPersistence()
56 .remove(organizationId);
57
58 if (listener != null) {
59 listener.onAfterRemove(organization);
60 }
61
62 return organization;
63 }
64
65 public static com.liferay.portal.model.Organization remove(
66 com.liferay.portal.model.Organization organization)
67 throws com.liferay.portal.SystemException {
68 ModelListener listener = _getListener();
69
70 if (listener != null) {
71 listener.onBeforeRemove(organization);
72 }
73
74 organization = getPersistence().remove(organization);
75
76 if (listener != null) {
77 listener.onAfterRemove(organization);
78 }
79
80 return organization;
81 }
82
83 public static com.liferay.portal.model.Organization update(
84 com.liferay.portal.model.Organization organization)
85 throws com.liferay.portal.SystemException {
86 ModelListener listener = _getListener();
87 boolean isNew = organization.isNew();
88
89 if (listener != null) {
90 if (isNew) {
91 listener.onBeforeCreate(organization);
92 }
93 else {
94 listener.onBeforeUpdate(organization);
95 }
96 }
97
98 organization = getPersistence().update(organization);
99
100 if (listener != null) {
101 if (isNew) {
102 listener.onAfterCreate(organization);
103 }
104 else {
105 listener.onAfterUpdate(organization);
106 }
107 }
108
109 return organization;
110 }
111
112 public static com.liferay.portal.model.Organization update(
113 com.liferay.portal.model.Organization organization, boolean merge)
114 throws com.liferay.portal.SystemException {
115 ModelListener listener = _getListener();
116 boolean isNew = organization.isNew();
117
118 if (listener != null) {
119 if (isNew) {
120 listener.onBeforeCreate(organization);
121 }
122 else {
123 listener.onBeforeUpdate(organization);
124 }
125 }
126
127 organization = getPersistence().update(organization, merge);
128
129 if (listener != null) {
130 if (isNew) {
131 listener.onAfterCreate(organization);
132 }
133 else {
134 listener.onAfterUpdate(organization);
135 }
136 }
137
138 return organization;
139 }
140
141 public static com.liferay.portal.model.Organization findByPrimaryKey(
142 long organizationId)
143 throws com.liferay.portal.SystemException,
144 com.liferay.portal.NoSuchOrganizationException {
145 return getPersistence().findByPrimaryKey(organizationId);
146 }
147
148 public static com.liferay.portal.model.Organization fetchByPrimaryKey(
149 long organizationId) throws com.liferay.portal.SystemException {
150 return getPersistence().fetchByPrimaryKey(organizationId);
151 }
152
153 public static java.util.List findByCompanyId(long companyId)
154 throws com.liferay.portal.SystemException {
155 return getPersistence().findByCompanyId(companyId);
156 }
157
158 public static java.util.List findByCompanyId(long companyId, int begin,
159 int end) throws com.liferay.portal.SystemException {
160 return getPersistence().findByCompanyId(companyId, begin, end);
161 }
162
163 public static java.util.List findByCompanyId(long companyId, int begin,
164 int end, com.liferay.portal.kernel.util.OrderByComparator obc)
165 throws com.liferay.portal.SystemException {
166 return getPersistence().findByCompanyId(companyId, begin, end, obc);
167 }
168
169 public static com.liferay.portal.model.Organization findByCompanyId_First(
170 long companyId, com.liferay.portal.kernel.util.OrderByComparator obc)
171 throws com.liferay.portal.SystemException,
172 com.liferay.portal.NoSuchOrganizationException {
173 return getPersistence().findByCompanyId_First(companyId, obc);
174 }
175
176 public static com.liferay.portal.model.Organization findByCompanyId_Last(
177 long companyId, com.liferay.portal.kernel.util.OrderByComparator obc)
178 throws com.liferay.portal.SystemException,
179 com.liferay.portal.NoSuchOrganizationException {
180 return getPersistence().findByCompanyId_Last(companyId, obc);
181 }
182
183 public static com.liferay.portal.model.Organization[] findByCompanyId_PrevAndNext(
184 long organizationId, long companyId,
185 com.liferay.portal.kernel.util.OrderByComparator obc)
186 throws com.liferay.portal.SystemException,
187 com.liferay.portal.NoSuchOrganizationException {
188 return getPersistence().findByCompanyId_PrevAndNext(organizationId,
189 companyId, obc);
190 }
191
192 public static java.util.List findByLocations(long companyId)
193 throws com.liferay.portal.SystemException {
194 return getPersistence().findByLocations(companyId);
195 }
196
197 public static java.util.List findByLocations(long companyId, int begin,
198 int end) throws com.liferay.portal.SystemException {
199 return getPersistence().findByLocations(companyId, begin, end);
200 }
201
202 public static java.util.List findByLocations(long companyId, int begin,
203 int end, com.liferay.portal.kernel.util.OrderByComparator obc)
204 throws com.liferay.portal.SystemException {
205 return getPersistence().findByLocations(companyId, begin, end, obc);
206 }
207
208 public static com.liferay.portal.model.Organization findByLocations_First(
209 long companyId, com.liferay.portal.kernel.util.OrderByComparator obc)
210 throws com.liferay.portal.SystemException,
211 com.liferay.portal.NoSuchOrganizationException {
212 return getPersistence().findByLocations_First(companyId, obc);
213 }
214
215 public static com.liferay.portal.model.Organization findByLocations_Last(
216 long companyId, com.liferay.portal.kernel.util.OrderByComparator obc)
217 throws com.liferay.portal.SystemException,
218 com.liferay.portal.NoSuchOrganizationException {
219 return getPersistence().findByLocations_Last(companyId, obc);
220 }
221
222 public static com.liferay.portal.model.Organization[] findByLocations_PrevAndNext(
223 long organizationId, long companyId,
224 com.liferay.portal.kernel.util.OrderByComparator obc)
225 throws com.liferay.portal.SystemException,
226 com.liferay.portal.NoSuchOrganizationException {
227 return getPersistence().findByLocations_PrevAndNext(organizationId,
228 companyId, obc);
229 }
230
231 public static java.util.List findByC_P(long companyId,
232 long parentOrganizationId) throws com.liferay.portal.SystemException {
233 return getPersistence().findByC_P(companyId, parentOrganizationId);
234 }
235
236 public static java.util.List findByC_P(long companyId,
237 long parentOrganizationId, int begin, int end)
238 throws com.liferay.portal.SystemException {
239 return getPersistence().findByC_P(companyId, parentOrganizationId,
240 begin, end);
241 }
242
243 public static java.util.List findByC_P(long companyId,
244 long parentOrganizationId, int begin, int end,
245 com.liferay.portal.kernel.util.OrderByComparator obc)
246 throws com.liferay.portal.SystemException {
247 return getPersistence().findByC_P(companyId, parentOrganizationId,
248 begin, end, obc);
249 }
250
251 public static com.liferay.portal.model.Organization findByC_P_First(
252 long companyId, long parentOrganizationId,
253 com.liferay.portal.kernel.util.OrderByComparator obc)
254 throws com.liferay.portal.SystemException,
255 com.liferay.portal.NoSuchOrganizationException {
256 return getPersistence().findByC_P_First(companyId,
257 parentOrganizationId, obc);
258 }
259
260 public static com.liferay.portal.model.Organization findByC_P_Last(
261 long companyId, long parentOrganizationId,
262 com.liferay.portal.kernel.util.OrderByComparator obc)
263 throws com.liferay.portal.SystemException,
264 com.liferay.portal.NoSuchOrganizationException {
265 return getPersistence().findByC_P_Last(companyId, parentOrganizationId,
266 obc);
267 }
268
269 public static com.liferay.portal.model.Organization[] findByC_P_PrevAndNext(
270 long organizationId, long companyId, long parentOrganizationId,
271 com.liferay.portal.kernel.util.OrderByComparator obc)
272 throws com.liferay.portal.SystemException,
273 com.liferay.portal.NoSuchOrganizationException {
274 return getPersistence().findByC_P_PrevAndNext(organizationId,
275 companyId, parentOrganizationId, obc);
276 }
277
278 public static com.liferay.portal.model.Organization findByC_N(
279 long companyId, java.lang.String name)
280 throws com.liferay.portal.SystemException,
281 com.liferay.portal.NoSuchOrganizationException {
282 return getPersistence().findByC_N(companyId, name);
283 }
284
285 public static com.liferay.portal.model.Organization fetchByC_N(
286 long companyId, java.lang.String name)
287 throws com.liferay.portal.SystemException {
288 return getPersistence().fetchByC_N(companyId, name);
289 }
290
291 public static java.util.List findWithDynamicQuery(
292 com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer)
293 throws com.liferay.portal.SystemException {
294 return getPersistence().findWithDynamicQuery(queryInitializer);
295 }
296
297 public static java.util.List findWithDynamicQuery(
298 com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer,
299 int begin, int end) throws com.liferay.portal.SystemException {
300 return getPersistence().findWithDynamicQuery(queryInitializer, begin,
301 end);
302 }
303
304 public static java.util.List findAll()
305 throws com.liferay.portal.SystemException {
306 return getPersistence().findAll();
307 }
308
309 public static java.util.List findAll(int begin, int end)
310 throws com.liferay.portal.SystemException {
311 return getPersistence().findAll(begin, end);
312 }
313
314 public static java.util.List findAll(int begin, int end,
315 com.liferay.portal.kernel.util.OrderByComparator obc)
316 throws com.liferay.portal.SystemException {
317 return getPersistence().findAll(begin, end, obc);
318 }
319
320 public static void removeByCompanyId(long companyId)
321 throws com.liferay.portal.SystemException {
322 getPersistence().removeByCompanyId(companyId);
323 }
324
325 public static void removeByLocations(long companyId)
326 throws com.liferay.portal.SystemException {
327 getPersistence().removeByLocations(companyId);
328 }
329
330 public static void removeByC_P(long companyId, long parentOrganizationId)
331 throws com.liferay.portal.SystemException {
332 getPersistence().removeByC_P(companyId, parentOrganizationId);
333 }
334
335 public static void removeByC_N(long companyId, java.lang.String name)
336 throws com.liferay.portal.SystemException,
337 com.liferay.portal.NoSuchOrganizationException {
338 getPersistence().removeByC_N(companyId, name);
339 }
340
341 public static void removeAll() throws com.liferay.portal.SystemException {
342 getPersistence().removeAll();
343 }
344
345 public static int countByCompanyId(long companyId)
346 throws com.liferay.portal.SystemException {
347 return getPersistence().countByCompanyId(companyId);
348 }
349
350 public static int countByLocations(long companyId)
351 throws com.liferay.portal.SystemException {
352 return getPersistence().countByLocations(companyId);
353 }
354
355 public static int countByC_P(long companyId, long parentOrganizationId)
356 throws com.liferay.portal.SystemException {
357 return getPersistence().countByC_P(companyId, parentOrganizationId);
358 }
359
360 public static int countByC_N(long companyId, java.lang.String name)
361 throws com.liferay.portal.SystemException {
362 return getPersistence().countByC_N(companyId, name);
363 }
364
365 public static int countAll() throws com.liferay.portal.SystemException {
366 return getPersistence().countAll();
367 }
368
369 public static java.util.List getGroups(long pk)
370 throws com.liferay.portal.SystemException,
371 com.liferay.portal.NoSuchOrganizationException {
372 return getPersistence().getGroups(pk);
373 }
374
375 public static java.util.List getGroups(long pk, int begin, int end)
376 throws com.liferay.portal.SystemException,
377 com.liferay.portal.NoSuchOrganizationException {
378 return getPersistence().getGroups(pk, begin, end);
379 }
380
381 public static java.util.List getGroups(long pk, int begin, int end,
382 com.liferay.portal.kernel.util.OrderByComparator obc)
383 throws com.liferay.portal.SystemException,
384 com.liferay.portal.NoSuchOrganizationException {
385 return getPersistence().getGroups(pk, begin, end, obc);
386 }
387
388 public static int getGroupsSize(long pk)
389 throws com.liferay.portal.SystemException {
390 return getPersistence().getGroupsSize(pk);
391 }
392
393 public static boolean containsGroup(long pk, long groupPK)
394 throws com.liferay.portal.SystemException {
395 return getPersistence().containsGroup(pk, groupPK);
396 }
397
398 public static boolean containsGroups(long pk)
399 throws com.liferay.portal.SystemException {
400 return getPersistence().containsGroups(pk);
401 }
402
403 public static void addGroup(long pk, long groupPK)
404 throws com.liferay.portal.SystemException,
405 com.liferay.portal.NoSuchGroupException,
406 com.liferay.portal.NoSuchOrganizationException {
407 getPersistence().addGroup(pk, groupPK);
408 }
409
410 public static void addGroup(long pk, com.liferay.portal.model.Group group)
411 throws com.liferay.portal.SystemException,
412 com.liferay.portal.NoSuchGroupException,
413 com.liferay.portal.NoSuchOrganizationException {
414 getPersistence().addGroup(pk, group);
415 }
416
417 public static void addGroups(long pk, long[] groupPKs)
418 throws com.liferay.portal.SystemException,
419 com.liferay.portal.NoSuchGroupException,
420 com.liferay.portal.NoSuchOrganizationException {
421 getPersistence().addGroups(pk, groupPKs);
422 }
423
424 public static void addGroups(long pk, java.util.List groups)
425 throws com.liferay.portal.SystemException,
426 com.liferay.portal.NoSuchGroupException,
427 com.liferay.portal.NoSuchOrganizationException {
428 getPersistence().addGroups(pk, groups);
429 }
430
431 public static void clearGroups(long pk)
432 throws com.liferay.portal.SystemException,
433 com.liferay.portal.NoSuchOrganizationException {
434 getPersistence().clearGroups(pk);
435 }
436
437 public static void removeGroup(long pk, long groupPK)
438 throws com.liferay.portal.SystemException,
439 com.liferay.portal.NoSuchGroupException,
440 com.liferay.portal.NoSuchOrganizationException {
441 getPersistence().removeGroup(pk, groupPK);
442 }
443
444 public static void removeGroup(long pk, com.liferay.portal.model.Group group)
445 throws com.liferay.portal.SystemException,
446 com.liferay.portal.NoSuchGroupException,
447 com.liferay.portal.NoSuchOrganizationException {
448 getPersistence().removeGroup(pk, group);
449 }
450
451 public static void removeGroups(long pk, long[] groupPKs)
452 throws com.liferay.portal.SystemException,
453 com.liferay.portal.NoSuchGroupException,
454 com.liferay.portal.NoSuchOrganizationException {
455 getPersistence().removeGroups(pk, groupPKs);
456 }
457
458 public static void removeGroups(long pk, java.util.List groups)
459 throws com.liferay.portal.SystemException,
460 com.liferay.portal.NoSuchGroupException,
461 com.liferay.portal.NoSuchOrganizationException {
462 getPersistence().removeGroups(pk, groups);
463 }
464
465 public static void setGroups(long pk, long[] groupPKs)
466 throws com.liferay.portal.SystemException,
467 com.liferay.portal.NoSuchGroupException,
468 com.liferay.portal.NoSuchOrganizationException {
469 getPersistence().setGroups(pk, groupPKs);
470 }
471
472 public static void setGroups(long pk, java.util.List groups)
473 throws com.liferay.portal.SystemException,
474 com.liferay.portal.NoSuchGroupException,
475 com.liferay.portal.NoSuchOrganizationException {
476 getPersistence().setGroups(pk, groups);
477 }
478
479 public static java.util.List getUsers(long pk)
480 throws com.liferay.portal.SystemException,
481 com.liferay.portal.NoSuchOrganizationException {
482 return getPersistence().getUsers(pk);
483 }
484
485 public static java.util.List getUsers(long pk, int begin, int end)
486 throws com.liferay.portal.SystemException,
487 com.liferay.portal.NoSuchOrganizationException {
488 return getPersistence().getUsers(pk, begin, end);
489 }
490
491 public static java.util.List getUsers(long pk, int begin, int end,
492 com.liferay.portal.kernel.util.OrderByComparator obc)
493 throws com.liferay.portal.SystemException,
494 com.liferay.portal.NoSuchOrganizationException {
495 return getPersistence().getUsers(pk, begin, end, obc);
496 }
497
498 public static int getUsersSize(long pk)
499 throws com.liferay.portal.SystemException {
500 return getPersistence().getUsersSize(pk);
501 }
502
503 public static boolean containsUser(long pk, long userPK)
504 throws com.liferay.portal.SystemException {
505 return getPersistence().containsUser(pk, userPK);
506 }
507
508 public static boolean containsUsers(long pk)
509 throws com.liferay.portal.SystemException {
510 return getPersistence().containsUsers(pk);
511 }
512
513 public static void addUser(long pk, long userPK)
514 throws com.liferay.portal.SystemException,
515 com.liferay.portal.NoSuchOrganizationException,
516 com.liferay.portal.NoSuchUserException {
517 getPersistence().addUser(pk, userPK);
518 }
519
520 public static void addUser(long pk, com.liferay.portal.model.User user)
521 throws com.liferay.portal.SystemException,
522 com.liferay.portal.NoSuchOrganizationException,
523 com.liferay.portal.NoSuchUserException {
524 getPersistence().addUser(pk, user);
525 }
526
527 public static void addUsers(long pk, long[] userPKs)
528 throws com.liferay.portal.SystemException,
529 com.liferay.portal.NoSuchOrganizationException,
530 com.liferay.portal.NoSuchUserException {
531 getPersistence().addUsers(pk, userPKs);
532 }
533
534 public static void addUsers(long pk, java.util.List users)
535 throws com.liferay.portal.SystemException,
536 com.liferay.portal.NoSuchOrganizationException,
537 com.liferay.portal.NoSuchUserException {
538 getPersistence().addUsers(pk, users);
539 }
540
541 public static void clearUsers(long pk)
542 throws com.liferay.portal.SystemException,
543 com.liferay.portal.NoSuchOrganizationException {
544 getPersistence().clearUsers(pk);
545 }
546
547 public static void removeUser(long pk, long userPK)
548 throws com.liferay.portal.SystemException,
549 com.liferay.portal.NoSuchOrganizationException,
550 com.liferay.portal.NoSuchUserException {
551 getPersistence().removeUser(pk, userPK);
552 }
553
554 public static void removeUser(long pk, com.liferay.portal.model.User user)
555 throws com.liferay.portal.SystemException,
556 com.liferay.portal.NoSuchOrganizationException,
557 com.liferay.portal.NoSuchUserException {
558 getPersistence().removeUser(pk, user);
559 }
560
561 public static void removeUsers(long pk, long[] userPKs)
562 throws com.liferay.portal.SystemException,
563 com.liferay.portal.NoSuchOrganizationException,
564 com.liferay.portal.NoSuchUserException {
565 getPersistence().removeUsers(pk, userPKs);
566 }
567
568 public static void removeUsers(long pk, java.util.List users)
569 throws com.liferay.portal.SystemException,
570 com.liferay.portal.NoSuchOrganizationException,
571 com.liferay.portal.NoSuchUserException {
572 getPersistence().removeUsers(pk, users);
573 }
574
575 public static void setUsers(long pk, long[] userPKs)
576 throws com.liferay.portal.SystemException,
577 com.liferay.portal.NoSuchOrganizationException,
578 com.liferay.portal.NoSuchUserException {
579 getPersistence().setUsers(pk, userPKs);
580 }
581
582 public static void setUsers(long pk, java.util.List users)
583 throws com.liferay.portal.SystemException,
584 com.liferay.portal.NoSuchOrganizationException,
585 com.liferay.portal.NoSuchUserException {
586 getPersistence().setUsers(pk, users);
587 }
588
589 public static OrganizationPersistence getPersistence() {
590 return _getUtil()._persistence;
591 }
592
593 public void setPersistence(OrganizationPersistence persistence) {
594 _persistence = persistence;
595 }
596
597 private static OrganizationUtil _getUtil() {
598 if (_util == null) {
599 _util = (OrganizationUtil)com.liferay.portal.kernel.bean.BeanLocatorUtil.locate(_UTIL);
600 }
601
602 return _util;
603 }
604
605 private static ModelListener _getListener() {
606 if (Validator.isNotNull(_LISTENER)) {
607 try {
608 return (ModelListener)Class.forName(_LISTENER).newInstance();
609 }
610 catch (Exception e) {
611 _log.error(e);
612 }
613 }
614
615 return null;
616 }
617
618 private static final String _UTIL = OrganizationUtil.class.getName();
619 private static final String _LISTENER = GetterUtil.getString(PropsUtil.get(
620 "value.object.listener.com.liferay.portal.model.Organization"));
621 private static Log _log = LogFactory.getLog(OrganizationUtil.class);
622 private static OrganizationUtil _util;
623 private OrganizationPersistence _persistence;
624 }