001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.NoSuchUserException;
019 import com.liferay.portal.kernel.annotation.BeanReference;
020 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQuery;
022 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQueryFactoryUtil;
023 import com.liferay.portal.kernel.dao.jdbc.RowMapper;
024 import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
025 import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
026 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
027 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
028 import com.liferay.portal.kernel.dao.orm.FinderPath;
029 import com.liferay.portal.kernel.dao.orm.Query;
030 import com.liferay.portal.kernel.dao.orm.QueryPos;
031 import com.liferay.portal.kernel.dao.orm.QueryUtil;
032 import com.liferay.portal.kernel.dao.orm.SQLQuery;
033 import com.liferay.portal.kernel.dao.orm.Session;
034 import com.liferay.portal.kernel.exception.SystemException;
035 import com.liferay.portal.kernel.log.Log;
036 import com.liferay.portal.kernel.log.LogFactoryUtil;
037 import com.liferay.portal.kernel.util.GetterUtil;
038 import com.liferay.portal.kernel.util.InstanceFactory;
039 import com.liferay.portal.kernel.util.OrderByComparator;
040 import com.liferay.portal.kernel.util.SetUtil;
041 import com.liferay.portal.kernel.util.StringBundler;
042 import com.liferay.portal.kernel.util.StringPool;
043 import com.liferay.portal.kernel.util.StringUtil;
044 import com.liferay.portal.kernel.util.Validator;
045 import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
046 import com.liferay.portal.model.ModelListener;
047 import com.liferay.portal.model.User;
048 import com.liferay.portal.model.impl.UserImpl;
049 import com.liferay.portal.model.impl.UserModelImpl;
050 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
051
052 import com.liferay.portlet.announcements.service.persistence.AnnouncementsDeliveryPersistence;
053 import com.liferay.portlet.asset.service.persistence.AssetEntryPersistence;
054 import com.liferay.portlet.blogs.service.persistence.BlogsStatsUserPersistence;
055 import com.liferay.portlet.documentlibrary.service.persistence.DLFileRankPersistence;
056 import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
057 import com.liferay.portlet.messageboards.service.persistence.MBBanPersistence;
058 import com.liferay.portlet.messageboards.service.persistence.MBMessageFlagPersistence;
059 import com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence;
060 import com.liferay.portlet.messageboards.service.persistence.MBStatsUserPersistence;
061 import com.liferay.portlet.shopping.service.persistence.ShoppingCartPersistence;
062 import com.liferay.portlet.social.service.persistence.SocialActivityPersistence;
063 import com.liferay.portlet.social.service.persistence.SocialRequestPersistence;
064
065 import java.io.Serializable;
066
067 import java.util.ArrayList;
068 import java.util.Collections;
069 import java.util.List;
070 import java.util.Set;
071
072
088 public class UserPersistenceImpl extends BasePersistenceImpl<User>
089 implements UserPersistence {
090 public static final String FINDER_CLASS_NAME_ENTITY = UserImpl.class.getName();
091 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
092 ".List";
093 public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
094 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
095 "findByUuid",
096 new String[] {
097 String.class.getName(),
098
099 "java.lang.Integer", "java.lang.Integer",
100 "com.liferay.portal.kernel.util.OrderByComparator"
101 });
102 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
103 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
104 "countByUuid", new String[] { String.class.getName() });
105 public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
106 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
107 "findByCompanyId",
108 new String[] {
109 Long.class.getName(),
110
111 "java.lang.Integer", "java.lang.Integer",
112 "com.liferay.portal.kernel.util.OrderByComparator"
113 });
114 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
115 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
116 "countByCompanyId", new String[] { Long.class.getName() });
117 public static final FinderPath FINDER_PATH_FETCH_BY_CONTACTID = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
118 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
119 "fetchByContactId", new String[] { Long.class.getName() });
120 public static final FinderPath FINDER_PATH_COUNT_BY_CONTACTID = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
121 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
122 "countByContactId", new String[] { Long.class.getName() });
123 public static final FinderPath FINDER_PATH_FIND_BY_EMAILADDRESS = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
124 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
125 "findByEmailAddress",
126 new String[] {
127 String.class.getName(),
128
129 "java.lang.Integer", "java.lang.Integer",
130 "com.liferay.portal.kernel.util.OrderByComparator"
131 });
132 public static final FinderPath FINDER_PATH_COUNT_BY_EMAILADDRESS = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
133 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
134 "countByEmailAddress", new String[] { String.class.getName() });
135 public static final FinderPath FINDER_PATH_FETCH_BY_PORTRAITID = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
136 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
137 "fetchByPortraitId", new String[] { Long.class.getName() });
138 public static final FinderPath FINDER_PATH_COUNT_BY_PORTRAITID = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
139 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
140 "countByPortraitId", new String[] { Long.class.getName() });
141 public static final FinderPath FINDER_PATH_FETCH_BY_C_U = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
142 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
143 "fetchByC_U",
144 new String[] { Long.class.getName(), Long.class.getName() });
145 public static final FinderPath FINDER_PATH_COUNT_BY_C_U = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
146 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
147 "countByC_U",
148 new String[] { Long.class.getName(), Long.class.getName() });
149 public static final FinderPath FINDER_PATH_FETCH_BY_C_DU = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
150 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
151 "fetchByC_DU",
152 new String[] { Long.class.getName(), Boolean.class.getName() });
153 public static final FinderPath FINDER_PATH_COUNT_BY_C_DU = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
154 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
155 "countByC_DU",
156 new String[] { Long.class.getName(), Boolean.class.getName() });
157 public static final FinderPath FINDER_PATH_FETCH_BY_C_SN = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
158 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
159 "fetchByC_SN",
160 new String[] { Long.class.getName(), String.class.getName() });
161 public static final FinderPath FINDER_PATH_COUNT_BY_C_SN = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
162 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
163 "countByC_SN",
164 new String[] { Long.class.getName(), String.class.getName() });
165 public static final FinderPath FINDER_PATH_FETCH_BY_C_EA = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
166 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
167 "fetchByC_EA",
168 new String[] { Long.class.getName(), String.class.getName() });
169 public static final FinderPath FINDER_PATH_COUNT_BY_C_EA = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
170 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
171 "countByC_EA",
172 new String[] { Long.class.getName(), String.class.getName() });
173 public static final FinderPath FINDER_PATH_FETCH_BY_C_FID = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
174 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
175 "fetchByC_FID",
176 new String[] { Long.class.getName(), Long.class.getName() });
177 public static final FinderPath FINDER_PATH_COUNT_BY_C_FID = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
178 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
179 "countByC_FID",
180 new String[] { Long.class.getName(), Long.class.getName() });
181 public static final FinderPath FINDER_PATH_FETCH_BY_C_O = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
182 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
183 "fetchByC_O",
184 new String[] { Long.class.getName(), String.class.getName() });
185 public static final FinderPath FINDER_PATH_COUNT_BY_C_O = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
186 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
187 "countByC_O",
188 new String[] { Long.class.getName(), String.class.getName() });
189 public static final FinderPath FINDER_PATH_FIND_BY_C_A = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
190 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
191 "findByC_A",
192 new String[] {
193 Long.class.getName(), Boolean.class.getName(),
194
195 "java.lang.Integer", "java.lang.Integer",
196 "com.liferay.portal.kernel.util.OrderByComparator"
197 });
198 public static final FinderPath FINDER_PATH_COUNT_BY_C_A = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
199 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
200 "countByC_A",
201 new String[] { Long.class.getName(), Boolean.class.getName() });
202 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
203 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
204 "findAll", new String[0]);
205 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(UserModelImpl.ENTITY_CACHE_ENABLED,
206 UserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
207 "countAll", new String[0]);
208
209
214 public void cacheResult(User user) {
215 EntityCacheUtil.putResult(UserModelImpl.ENTITY_CACHE_ENABLED,
216 UserImpl.class, user.getPrimaryKey(), user);
217
218 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CONTACTID,
219 new Object[] { new Long(user.getContactId()) }, user);
220
221 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_PORTRAITID,
222 new Object[] { new Long(user.getPortraitId()) }, user);
223
224 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_U,
225 new Object[] {
226 new Long(user.getCompanyId()), new Long(user.getUserId())
227 }, user);
228
229 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_DU,
230 new Object[] {
231 new Long(user.getCompanyId()),
232 Boolean.valueOf(user.getDefaultUser())
233 }, user);
234
235 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_SN,
236 new Object[] { new Long(user.getCompanyId()), user.getScreenName() },
237 user);
238
239 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_EA,
240 new Object[] { new Long(user.getCompanyId()), user.getEmailAddress() },
241 user);
242
243 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_FID,
244 new Object[] {
245 new Long(user.getCompanyId()), new Long(user.getFacebookId())
246 }, user);
247
248 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_O,
249 new Object[] { new Long(user.getCompanyId()), user.getOpenId() },
250 user);
251 }
252
253
258 public void cacheResult(List<User> users) {
259 for (User user : users) {
260 if (EntityCacheUtil.getResult(UserModelImpl.ENTITY_CACHE_ENABLED,
261 UserImpl.class, user.getPrimaryKey(), this) == null) {
262 cacheResult(user);
263 }
264 }
265 }
266
267
274 public void clearCache() {
275 CacheRegistryUtil.clear(UserImpl.class.getName());
276 EntityCacheUtil.clearCache(UserImpl.class.getName());
277 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
278 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
279 }
280
281
288 public void clearCache(User user) {
289 EntityCacheUtil.removeResult(UserModelImpl.ENTITY_CACHE_ENABLED,
290 UserImpl.class, user.getPrimaryKey());
291
292 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_CONTACTID,
293 new Object[] { new Long(user.getContactId()) });
294
295 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_PORTRAITID,
296 new Object[] { new Long(user.getPortraitId()) });
297
298 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_U,
299 new Object[] {
300 new Long(user.getCompanyId()), new Long(user.getUserId())
301 });
302
303 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_DU,
304 new Object[] {
305 new Long(user.getCompanyId()),
306 Boolean.valueOf(user.getDefaultUser())
307 });
308
309 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_SN,
310 new Object[] { new Long(user.getCompanyId()), user.getScreenName() });
311
312 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_EA,
313 new Object[] { new Long(user.getCompanyId()), user.getEmailAddress() });
314
315 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_FID,
316 new Object[] {
317 new Long(user.getCompanyId()), new Long(user.getFacebookId())
318 });
319
320 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_O,
321 new Object[] { new Long(user.getCompanyId()), user.getOpenId() });
322 }
323
324
330 public User create(long userId) {
331 User user = new UserImpl();
332
333 user.setNew(true);
334 user.setPrimaryKey(userId);
335
336 String uuid = PortalUUIDUtil.generate();
337
338 user.setUuid(uuid);
339
340 return user;
341 }
342
343
351 public User remove(Serializable primaryKey)
352 throws NoSuchModelException, SystemException {
353 return remove(((Long)primaryKey).longValue());
354 }
355
356
364 public User remove(long userId) throws NoSuchUserException, SystemException {
365 Session session = null;
366
367 try {
368 session = openSession();
369
370 User user = (User)session.get(UserImpl.class, new Long(userId));
371
372 if (user == null) {
373 if (_log.isWarnEnabled()) {
374 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + userId);
375 }
376
377 throw new NoSuchUserException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
378 userId);
379 }
380
381 return remove(user);
382 }
383 catch (NoSuchUserException nsee) {
384 throw nsee;
385 }
386 catch (Exception e) {
387 throw processException(e);
388 }
389 finally {
390 closeSession(session);
391 }
392 }
393
394 protected User removeImpl(User user) throws SystemException {
395 user = toUnwrappedModel(user);
396
397 try {
398 clearGroups.clear(user.getPrimaryKey());
399 }
400 catch (Exception e) {
401 throw processException(e);
402 }
403 finally {
404 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
405 }
406
407 try {
408 clearOrganizations.clear(user.getPrimaryKey());
409 }
410 catch (Exception e) {
411 throw processException(e);
412 }
413 finally {
414 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
415 }
416
417 try {
418 clearPermissions.clear(user.getPrimaryKey());
419 }
420 catch (Exception e) {
421 throw processException(e);
422 }
423 finally {
424 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
425 }
426
427 try {
428 clearRoles.clear(user.getPrimaryKey());
429 }
430 catch (Exception e) {
431 throw processException(e);
432 }
433 finally {
434 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
435 }
436
437 try {
438 clearTeams.clear(user.getPrimaryKey());
439 }
440 catch (Exception e) {
441 throw processException(e);
442 }
443 finally {
444 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
445 }
446
447 try {
448 clearUserGroups.clear(user.getPrimaryKey());
449 }
450 catch (Exception e) {
451 throw processException(e);
452 }
453 finally {
454 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
455 }
456
457 Session session = null;
458
459 try {
460 session = openSession();
461
462 BatchSessionUtil.delete(session, user);
463 }
464 catch (Exception e) {
465 throw processException(e);
466 }
467 finally {
468 closeSession(session);
469 }
470
471 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
472
473 UserModelImpl userModelImpl = (UserModelImpl)user;
474
475 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_CONTACTID,
476 new Object[] { new Long(userModelImpl.getOriginalContactId()) });
477
478 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_PORTRAITID,
479 new Object[] { new Long(userModelImpl.getOriginalPortraitId()) });
480
481 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_U,
482 new Object[] {
483 new Long(userModelImpl.getOriginalCompanyId()),
484 new Long(userModelImpl.getOriginalUserId())
485 });
486
487 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_DU,
488 new Object[] {
489 new Long(userModelImpl.getOriginalCompanyId()),
490 Boolean.valueOf(userModelImpl.getOriginalDefaultUser())
491 });
492
493 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_SN,
494 new Object[] {
495 new Long(userModelImpl.getOriginalCompanyId()),
496
497 userModelImpl.getOriginalScreenName()
498 });
499
500 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_EA,
501 new Object[] {
502 new Long(userModelImpl.getOriginalCompanyId()),
503
504 userModelImpl.getOriginalEmailAddress()
505 });
506
507 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_FID,
508 new Object[] {
509 new Long(userModelImpl.getOriginalCompanyId()),
510 new Long(userModelImpl.getOriginalFacebookId())
511 });
512
513 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_O,
514 new Object[] {
515 new Long(userModelImpl.getOriginalCompanyId()),
516
517 userModelImpl.getOriginalOpenId()
518 });
519
520 EntityCacheUtil.removeResult(UserModelImpl.ENTITY_CACHE_ENABLED,
521 UserImpl.class, user.getPrimaryKey());
522
523 return user;
524 }
525
526 public User updateImpl(com.liferay.portal.model.User user, boolean merge)
527 throws SystemException {
528 user = toUnwrappedModel(user);
529
530 boolean isNew = user.isNew();
531
532 UserModelImpl userModelImpl = (UserModelImpl)user;
533
534 if (Validator.isNull(user.getUuid())) {
535 String uuid = PortalUUIDUtil.generate();
536
537 user.setUuid(uuid);
538 }
539
540 Session session = null;
541
542 try {
543 session = openSession();
544
545 BatchSessionUtil.update(session, user, merge);
546
547 user.setNew(false);
548 }
549 catch (Exception e) {
550 throw processException(e);
551 }
552 finally {
553 closeSession(session);
554 }
555
556 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
557
558 EntityCacheUtil.putResult(UserModelImpl.ENTITY_CACHE_ENABLED,
559 UserImpl.class, user.getPrimaryKey(), user);
560
561 if (!isNew &&
562 (user.getContactId() != userModelImpl.getOriginalContactId())) {
563 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_CONTACTID,
564 new Object[] { new Long(userModelImpl.getOriginalContactId()) });
565 }
566
567 if (isNew ||
568 (user.getContactId() != userModelImpl.getOriginalContactId())) {
569 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CONTACTID,
570 new Object[] { new Long(user.getContactId()) }, user);
571 }
572
573 if (!isNew &&
574 (user.getPortraitId() != userModelImpl.getOriginalPortraitId())) {
575 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_PORTRAITID,
576 new Object[] { new Long(userModelImpl.getOriginalPortraitId()) });
577 }
578
579 if (isNew ||
580 (user.getPortraitId() != userModelImpl.getOriginalPortraitId())) {
581 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_PORTRAITID,
582 new Object[] { new Long(user.getPortraitId()) }, user);
583 }
584
585 if (!isNew &&
586 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
587 (user.getUserId() != userModelImpl.getOriginalUserId()))) {
588 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_U,
589 new Object[] {
590 new Long(userModelImpl.getOriginalCompanyId()),
591 new Long(userModelImpl.getOriginalUserId())
592 });
593 }
594
595 if (isNew ||
596 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
597 (user.getUserId() != userModelImpl.getOriginalUserId()))) {
598 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_U,
599 new Object[] {
600 new Long(user.getCompanyId()), new Long(user.getUserId())
601 }, user);
602 }
603
604 if (!isNew &&
605 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
606 (user.getDefaultUser() != userModelImpl.getOriginalDefaultUser()))) {
607 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_DU,
608 new Object[] {
609 new Long(userModelImpl.getOriginalCompanyId()),
610 Boolean.valueOf(userModelImpl.getOriginalDefaultUser())
611 });
612 }
613
614 if (isNew ||
615 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
616 (user.getDefaultUser() != userModelImpl.getOriginalDefaultUser()))) {
617 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_DU,
618 new Object[] {
619 new Long(user.getCompanyId()),
620 Boolean.valueOf(user.getDefaultUser())
621 }, user);
622 }
623
624 if (!isNew &&
625 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
626 !Validator.equals(user.getScreenName(),
627 userModelImpl.getOriginalScreenName()))) {
628 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_SN,
629 new Object[] {
630 new Long(userModelImpl.getOriginalCompanyId()),
631
632 userModelImpl.getOriginalScreenName()
633 });
634 }
635
636 if (isNew ||
637 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
638 !Validator.equals(user.getScreenName(),
639 userModelImpl.getOriginalScreenName()))) {
640 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_SN,
641 new Object[] { new Long(user.getCompanyId()), user.getScreenName() },
642 user);
643 }
644
645 if (!isNew &&
646 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
647 !Validator.equals(user.getEmailAddress(),
648 userModelImpl.getOriginalEmailAddress()))) {
649 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_EA,
650 new Object[] {
651 new Long(userModelImpl.getOriginalCompanyId()),
652
653 userModelImpl.getOriginalEmailAddress()
654 });
655 }
656
657 if (isNew ||
658 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
659 !Validator.equals(user.getEmailAddress(),
660 userModelImpl.getOriginalEmailAddress()))) {
661 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_EA,
662 new Object[] {
663 new Long(user.getCompanyId()),
664
665 user.getEmailAddress()
666 }, user);
667 }
668
669 if (!isNew &&
670 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
671 (user.getFacebookId() != userModelImpl.getOriginalFacebookId()))) {
672 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_FID,
673 new Object[] {
674 new Long(userModelImpl.getOriginalCompanyId()),
675 new Long(userModelImpl.getOriginalFacebookId())
676 });
677 }
678
679 if (isNew ||
680 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
681 (user.getFacebookId() != userModelImpl.getOriginalFacebookId()))) {
682 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_FID,
683 new Object[] {
684 new Long(user.getCompanyId()),
685 new Long(user.getFacebookId())
686 }, user);
687 }
688
689 if (!isNew &&
690 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
691 !Validator.equals(user.getOpenId(),
692 userModelImpl.getOriginalOpenId()))) {
693 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_O,
694 new Object[] {
695 new Long(userModelImpl.getOriginalCompanyId()),
696
697 userModelImpl.getOriginalOpenId()
698 });
699 }
700
701 if (isNew ||
702 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
703 !Validator.equals(user.getOpenId(),
704 userModelImpl.getOriginalOpenId()))) {
705 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_O,
706 new Object[] { new Long(user.getCompanyId()), user.getOpenId() },
707 user);
708 }
709
710 return user;
711 }
712
713 protected User toUnwrappedModel(User user) {
714 if (user instanceof UserImpl) {
715 return user;
716 }
717
718 UserImpl userImpl = new UserImpl();
719
720 userImpl.setNew(user.isNew());
721 userImpl.setPrimaryKey(user.getPrimaryKey());
722
723 userImpl.setUuid(user.getUuid());
724 userImpl.setUserId(user.getUserId());
725 userImpl.setCompanyId(user.getCompanyId());
726 userImpl.setCreateDate(user.getCreateDate());
727 userImpl.setModifiedDate(user.getModifiedDate());
728 userImpl.setDefaultUser(user.isDefaultUser());
729 userImpl.setContactId(user.getContactId());
730 userImpl.setPassword(user.getPassword());
731 userImpl.setPasswordEncrypted(user.isPasswordEncrypted());
732 userImpl.setPasswordReset(user.isPasswordReset());
733 userImpl.setPasswordModifiedDate(user.getPasswordModifiedDate());
734 userImpl.setDigest(user.getDigest());
735 userImpl.setReminderQueryQuestion(user.getReminderQueryQuestion());
736 userImpl.setReminderQueryAnswer(user.getReminderQueryAnswer());
737 userImpl.setGraceLoginCount(user.getGraceLoginCount());
738 userImpl.setScreenName(user.getScreenName());
739 userImpl.setEmailAddress(user.getEmailAddress());
740 userImpl.setFacebookId(user.getFacebookId());
741 userImpl.setOpenId(user.getOpenId());
742 userImpl.setPortraitId(user.getPortraitId());
743 userImpl.setLanguageId(user.getLanguageId());
744 userImpl.setTimeZoneId(user.getTimeZoneId());
745 userImpl.setGreeting(user.getGreeting());
746 userImpl.setComments(user.getComments());
747 userImpl.setFirstName(user.getFirstName());
748 userImpl.setMiddleName(user.getMiddleName());
749 userImpl.setLastName(user.getLastName());
750 userImpl.setJobTitle(user.getJobTitle());
751 userImpl.setLoginDate(user.getLoginDate());
752 userImpl.setLoginIP(user.getLoginIP());
753 userImpl.setLastLoginDate(user.getLastLoginDate());
754 userImpl.setLastLoginIP(user.getLastLoginIP());
755 userImpl.setLastFailedLoginDate(user.getLastFailedLoginDate());
756 userImpl.setFailedLoginAttempts(user.getFailedLoginAttempts());
757 userImpl.setLockout(user.isLockout());
758 userImpl.setLockoutDate(user.getLockoutDate());
759 userImpl.setAgreedToTermsOfUse(user.isAgreedToTermsOfUse());
760 userImpl.setActive(user.isActive());
761
762 return userImpl;
763 }
764
765
773 public User findByPrimaryKey(Serializable primaryKey)
774 throws NoSuchModelException, SystemException {
775 return findByPrimaryKey(((Long)primaryKey).longValue());
776 }
777
778
786 public User findByPrimaryKey(long userId)
787 throws NoSuchUserException, SystemException {
788 User user = fetchByPrimaryKey(userId);
789
790 if (user == null) {
791 if (_log.isWarnEnabled()) {
792 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + userId);
793 }
794
795 throw new NoSuchUserException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
796 userId);
797 }
798
799 return user;
800 }
801
802
809 public User fetchByPrimaryKey(Serializable primaryKey)
810 throws SystemException {
811 return fetchByPrimaryKey(((Long)primaryKey).longValue());
812 }
813
814
821 public User fetchByPrimaryKey(long userId) throws SystemException {
822 User user = (User)EntityCacheUtil.getResult(UserModelImpl.ENTITY_CACHE_ENABLED,
823 UserImpl.class, userId, this);
824
825 if (user == null) {
826 Session session = null;
827
828 try {
829 session = openSession();
830
831 user = (User)session.get(UserImpl.class, new Long(userId));
832 }
833 catch (Exception e) {
834 throw processException(e);
835 }
836 finally {
837 if (user != null) {
838 cacheResult(user);
839 }
840
841 closeSession(session);
842 }
843 }
844
845 return user;
846 }
847
848
855 public List<User> findByUuid(String uuid) throws SystemException {
856 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
857 }
858
859
872 public List<User> findByUuid(String uuid, int start, int end)
873 throws SystemException {
874 return findByUuid(uuid, start, end, null);
875 }
876
877
891 public List<User> findByUuid(String uuid, int start, int end,
892 OrderByComparator orderByComparator) throws SystemException {
893 Object[] finderArgs = new Object[] {
894 uuid,
895
896 String.valueOf(start), String.valueOf(end),
897 String.valueOf(orderByComparator)
898 };
899
900 List<User> list = (List<User>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
901 finderArgs, this);
902
903 if (list == null) {
904 Session session = null;
905
906 try {
907 session = openSession();
908
909 StringBundler query = null;
910
911 if (orderByComparator != null) {
912 query = new StringBundler(3 +
913 (orderByComparator.getOrderByFields().length * 3));
914 }
915 else {
916 query = new StringBundler(2);
917 }
918
919 query.append(_SQL_SELECT_USER_WHERE);
920
921 if (uuid == null) {
922 query.append(_FINDER_COLUMN_UUID_UUID_1);
923 }
924 else {
925 if (uuid.equals(StringPool.BLANK)) {
926 query.append(_FINDER_COLUMN_UUID_UUID_3);
927 }
928 else {
929 query.append(_FINDER_COLUMN_UUID_UUID_2);
930 }
931 }
932
933 if (orderByComparator != null) {
934 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
935 orderByComparator);
936 }
937
938 String sql = query.toString();
939
940 Query q = session.createQuery(sql);
941
942 QueryPos qPos = QueryPos.getInstance(q);
943
944 if (uuid != null) {
945 qPos.add(uuid);
946 }
947
948 list = (List<User>)QueryUtil.list(q, getDialect(), start, end);
949 }
950 catch (Exception e) {
951 throw processException(e);
952 }
953 finally {
954 if (list == null) {
955 list = new ArrayList<User>();
956 }
957
958 cacheResult(list);
959
960 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
961 list);
962
963 closeSession(session);
964 }
965 }
966
967 return list;
968 }
969
970
983 public User findByUuid_First(String uuid,
984 OrderByComparator orderByComparator)
985 throws NoSuchUserException, SystemException {
986 List<User> list = findByUuid(uuid, 0, 1, orderByComparator);
987
988 if (list.isEmpty()) {
989 StringBundler msg = new StringBundler(4);
990
991 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
992
993 msg.append("uuid=");
994 msg.append(uuid);
995
996 msg.append(StringPool.CLOSE_CURLY_BRACE);
997
998 throw new NoSuchUserException(msg.toString());
999 }
1000 else {
1001 return list.get(0);
1002 }
1003 }
1004
1005
1018 public User findByUuid_Last(String uuid, OrderByComparator orderByComparator)
1019 throws NoSuchUserException, SystemException {
1020 int count = countByUuid(uuid);
1021
1022 List<User> list = findByUuid(uuid, count - 1, count, orderByComparator);
1023
1024 if (list.isEmpty()) {
1025 StringBundler msg = new StringBundler(4);
1026
1027 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1028
1029 msg.append("uuid=");
1030 msg.append(uuid);
1031
1032 msg.append(StringPool.CLOSE_CURLY_BRACE);
1033
1034 throw new NoSuchUserException(msg.toString());
1035 }
1036 else {
1037 return list.get(0);
1038 }
1039 }
1040
1041
1055 public User[] findByUuid_PrevAndNext(long userId, String uuid,
1056 OrderByComparator orderByComparator)
1057 throws NoSuchUserException, SystemException {
1058 User user = findByPrimaryKey(userId);
1059
1060 Session session = null;
1061
1062 try {
1063 session = openSession();
1064
1065 User[] array = new UserImpl[3];
1066
1067 array[0] = getByUuid_PrevAndNext(session, user, uuid,
1068 orderByComparator, true);
1069
1070 array[1] = user;
1071
1072 array[2] = getByUuid_PrevAndNext(session, user, uuid,
1073 orderByComparator, false);
1074
1075 return array;
1076 }
1077 catch (Exception e) {
1078 throw processException(e);
1079 }
1080 finally {
1081 closeSession(session);
1082 }
1083 }
1084
1085 protected User getByUuid_PrevAndNext(Session session, User user,
1086 String uuid, OrderByComparator orderByComparator, boolean previous) {
1087 StringBundler query = null;
1088
1089 if (orderByComparator != null) {
1090 query = new StringBundler(6 +
1091 (orderByComparator.getOrderByFields().length * 6));
1092 }
1093 else {
1094 query = new StringBundler(3);
1095 }
1096
1097 query.append(_SQL_SELECT_USER_WHERE);
1098
1099 if (uuid == null) {
1100 query.append(_FINDER_COLUMN_UUID_UUID_1);
1101 }
1102 else {
1103 if (uuid.equals(StringPool.BLANK)) {
1104 query.append(_FINDER_COLUMN_UUID_UUID_3);
1105 }
1106 else {
1107 query.append(_FINDER_COLUMN_UUID_UUID_2);
1108 }
1109 }
1110
1111 if (orderByComparator != null) {
1112 String[] orderByFields = orderByComparator.getOrderByFields();
1113
1114 if (orderByFields.length > 0) {
1115 query.append(WHERE_AND);
1116 }
1117
1118 for (int i = 0; i < orderByFields.length; i++) {
1119 query.append(_ORDER_BY_ENTITY_ALIAS);
1120 query.append(orderByFields[i]);
1121
1122 if ((i + 1) < orderByFields.length) {
1123 if (orderByComparator.isAscending() ^ previous) {
1124 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1125 }
1126 else {
1127 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1128 }
1129 }
1130 else {
1131 if (orderByComparator.isAscending() ^ previous) {
1132 query.append(WHERE_GREATER_THAN);
1133 }
1134 else {
1135 query.append(WHERE_LESSER_THAN);
1136 }
1137 }
1138 }
1139
1140 query.append(ORDER_BY_CLAUSE);
1141
1142 for (int i = 0; i < orderByFields.length; i++) {
1143 query.append(_ORDER_BY_ENTITY_ALIAS);
1144 query.append(orderByFields[i]);
1145
1146 if ((i + 1) < orderByFields.length) {
1147 if (orderByComparator.isAscending() ^ previous) {
1148 query.append(ORDER_BY_ASC_HAS_NEXT);
1149 }
1150 else {
1151 query.append(ORDER_BY_DESC_HAS_NEXT);
1152 }
1153 }
1154 else {
1155 if (orderByComparator.isAscending() ^ previous) {
1156 query.append(ORDER_BY_ASC);
1157 }
1158 else {
1159 query.append(ORDER_BY_DESC);
1160 }
1161 }
1162 }
1163 }
1164
1165 String sql = query.toString();
1166
1167 Query q = session.createQuery(sql);
1168
1169 q.setFirstResult(0);
1170 q.setMaxResults(2);
1171
1172 QueryPos qPos = QueryPos.getInstance(q);
1173
1174 if (uuid != null) {
1175 qPos.add(uuid);
1176 }
1177
1178 if (orderByComparator != null) {
1179 Object[] values = orderByComparator.getOrderByValues(user);
1180
1181 for (Object value : values) {
1182 qPos.add(value);
1183 }
1184 }
1185
1186 List<User> list = q.list();
1187
1188 if (list.size() == 2) {
1189 return list.get(1);
1190 }
1191 else {
1192 return null;
1193 }
1194 }
1195
1196
1203 public List<User> findByCompanyId(long companyId) throws SystemException {
1204 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1205 null);
1206 }
1207
1208
1221 public List<User> findByCompanyId(long companyId, int start, int end)
1222 throws SystemException {
1223 return findByCompanyId(companyId, start, end, null);
1224 }
1225
1226
1240 public List<User> findByCompanyId(long companyId, int start, int end,
1241 OrderByComparator orderByComparator) throws SystemException {
1242 Object[] finderArgs = new Object[] {
1243 companyId,
1244
1245 String.valueOf(start), String.valueOf(end),
1246 String.valueOf(orderByComparator)
1247 };
1248
1249 List<User> list = (List<User>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
1250 finderArgs, this);
1251
1252 if (list == null) {
1253 Session session = null;
1254
1255 try {
1256 session = openSession();
1257
1258 StringBundler query = null;
1259
1260 if (orderByComparator != null) {
1261 query = new StringBundler(3 +
1262 (orderByComparator.getOrderByFields().length * 3));
1263 }
1264 else {
1265 query = new StringBundler(2);
1266 }
1267
1268 query.append(_SQL_SELECT_USER_WHERE);
1269
1270 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1271
1272 if (orderByComparator != null) {
1273 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1274 orderByComparator);
1275 }
1276
1277 String sql = query.toString();
1278
1279 Query q = session.createQuery(sql);
1280
1281 QueryPos qPos = QueryPos.getInstance(q);
1282
1283 qPos.add(companyId);
1284
1285 list = (List<User>)QueryUtil.list(q, getDialect(), start, end);
1286 }
1287 catch (Exception e) {
1288 throw processException(e);
1289 }
1290 finally {
1291 if (list == null) {
1292 list = new ArrayList<User>();
1293 }
1294
1295 cacheResult(list);
1296
1297 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
1298 finderArgs, list);
1299
1300 closeSession(session);
1301 }
1302 }
1303
1304 return list;
1305 }
1306
1307
1320 public User findByCompanyId_First(long companyId,
1321 OrderByComparator orderByComparator)
1322 throws NoSuchUserException, SystemException {
1323 List<User> list = findByCompanyId(companyId, 0, 1, orderByComparator);
1324
1325 if (list.isEmpty()) {
1326 StringBundler msg = new StringBundler(4);
1327
1328 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1329
1330 msg.append("companyId=");
1331 msg.append(companyId);
1332
1333 msg.append(StringPool.CLOSE_CURLY_BRACE);
1334
1335 throw new NoSuchUserException(msg.toString());
1336 }
1337 else {
1338 return list.get(0);
1339 }
1340 }
1341
1342
1355 public User findByCompanyId_Last(long companyId,
1356 OrderByComparator orderByComparator)
1357 throws NoSuchUserException, SystemException {
1358 int count = countByCompanyId(companyId);
1359
1360 List<User> list = findByCompanyId(companyId, count - 1, count,
1361 orderByComparator);
1362
1363 if (list.isEmpty()) {
1364 StringBundler msg = new StringBundler(4);
1365
1366 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1367
1368 msg.append("companyId=");
1369 msg.append(companyId);
1370
1371 msg.append(StringPool.CLOSE_CURLY_BRACE);
1372
1373 throw new NoSuchUserException(msg.toString());
1374 }
1375 else {
1376 return list.get(0);
1377 }
1378 }
1379
1380
1394 public User[] findByCompanyId_PrevAndNext(long userId, long companyId,
1395 OrderByComparator orderByComparator)
1396 throws NoSuchUserException, SystemException {
1397 User user = findByPrimaryKey(userId);
1398
1399 Session session = null;
1400
1401 try {
1402 session = openSession();
1403
1404 User[] array = new UserImpl[3];
1405
1406 array[0] = getByCompanyId_PrevAndNext(session, user, companyId,
1407 orderByComparator, true);
1408
1409 array[1] = user;
1410
1411 array[2] = getByCompanyId_PrevAndNext(session, user, companyId,
1412 orderByComparator, false);
1413
1414 return array;
1415 }
1416 catch (Exception e) {
1417 throw processException(e);
1418 }
1419 finally {
1420 closeSession(session);
1421 }
1422 }
1423
1424 protected User getByCompanyId_PrevAndNext(Session session, User user,
1425 long companyId, OrderByComparator orderByComparator, boolean previous) {
1426 StringBundler query = null;
1427
1428 if (orderByComparator != null) {
1429 query = new StringBundler(6 +
1430 (orderByComparator.getOrderByFields().length * 6));
1431 }
1432 else {
1433 query = new StringBundler(3);
1434 }
1435
1436 query.append(_SQL_SELECT_USER_WHERE);
1437
1438 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1439
1440 if (orderByComparator != null) {
1441 String[] orderByFields = orderByComparator.getOrderByFields();
1442
1443 if (orderByFields.length > 0) {
1444 query.append(WHERE_AND);
1445 }
1446
1447 for (int i = 0; i < orderByFields.length; i++) {
1448 query.append(_ORDER_BY_ENTITY_ALIAS);
1449 query.append(orderByFields[i]);
1450
1451 if ((i + 1) < orderByFields.length) {
1452 if (orderByComparator.isAscending() ^ previous) {
1453 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1454 }
1455 else {
1456 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1457 }
1458 }
1459 else {
1460 if (orderByComparator.isAscending() ^ previous) {
1461 query.append(WHERE_GREATER_THAN);
1462 }
1463 else {
1464 query.append(WHERE_LESSER_THAN);
1465 }
1466 }
1467 }
1468
1469 query.append(ORDER_BY_CLAUSE);
1470
1471 for (int i = 0; i < orderByFields.length; i++) {
1472 query.append(_ORDER_BY_ENTITY_ALIAS);
1473 query.append(orderByFields[i]);
1474
1475 if ((i + 1) < orderByFields.length) {
1476 if (orderByComparator.isAscending() ^ previous) {
1477 query.append(ORDER_BY_ASC_HAS_NEXT);
1478 }
1479 else {
1480 query.append(ORDER_BY_DESC_HAS_NEXT);
1481 }
1482 }
1483 else {
1484 if (orderByComparator.isAscending() ^ previous) {
1485 query.append(ORDER_BY_ASC);
1486 }
1487 else {
1488 query.append(ORDER_BY_DESC);
1489 }
1490 }
1491 }
1492 }
1493
1494 String sql = query.toString();
1495
1496 Query q = session.createQuery(sql);
1497
1498 q.setFirstResult(0);
1499 q.setMaxResults(2);
1500
1501 QueryPos qPos = QueryPos.getInstance(q);
1502
1503 qPos.add(companyId);
1504
1505 if (orderByComparator != null) {
1506 Object[] values = orderByComparator.getOrderByValues(user);
1507
1508 for (Object value : values) {
1509 qPos.add(value);
1510 }
1511 }
1512
1513 List<User> list = q.list();
1514
1515 if (list.size() == 2) {
1516 return list.get(1);
1517 }
1518 else {
1519 return null;
1520 }
1521 }
1522
1523
1531 public User findByContactId(long contactId)
1532 throws NoSuchUserException, SystemException {
1533 User user = fetchByContactId(contactId);
1534
1535 if (user == null) {
1536 StringBundler msg = new StringBundler(4);
1537
1538 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1539
1540 msg.append("contactId=");
1541 msg.append(contactId);
1542
1543 msg.append(StringPool.CLOSE_CURLY_BRACE);
1544
1545 if (_log.isWarnEnabled()) {
1546 _log.warn(msg.toString());
1547 }
1548
1549 throw new NoSuchUserException(msg.toString());
1550 }
1551
1552 return user;
1553 }
1554
1555
1562 public User fetchByContactId(long contactId) throws SystemException {
1563 return fetchByContactId(contactId, true);
1564 }
1565
1566
1573 public User fetchByContactId(long contactId, boolean retrieveFromCache)
1574 throws SystemException {
1575 Object[] finderArgs = new Object[] { contactId };
1576
1577 Object result = null;
1578
1579 if (retrieveFromCache) {
1580 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_CONTACTID,
1581 finderArgs, this);
1582 }
1583
1584 if (result == null) {
1585 Session session = null;
1586
1587 try {
1588 session = openSession();
1589
1590 StringBundler query = new StringBundler(2);
1591
1592 query.append(_SQL_SELECT_USER_WHERE);
1593
1594 query.append(_FINDER_COLUMN_CONTACTID_CONTACTID_2);
1595
1596 String sql = query.toString();
1597
1598 Query q = session.createQuery(sql);
1599
1600 QueryPos qPos = QueryPos.getInstance(q);
1601
1602 qPos.add(contactId);
1603
1604 List<User> list = q.list();
1605
1606 result = list;
1607
1608 User user = null;
1609
1610 if (list.isEmpty()) {
1611 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CONTACTID,
1612 finderArgs, list);
1613 }
1614 else {
1615 user = list.get(0);
1616
1617 cacheResult(user);
1618
1619 if ((user.getContactId() != contactId)) {
1620 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CONTACTID,
1621 finderArgs, user);
1622 }
1623 }
1624
1625 return user;
1626 }
1627 catch (Exception e) {
1628 throw processException(e);
1629 }
1630 finally {
1631 if (result == null) {
1632 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CONTACTID,
1633 finderArgs, new ArrayList<User>());
1634 }
1635
1636 closeSession(session);
1637 }
1638 }
1639 else {
1640 if (result instanceof List<?>) {
1641 return null;
1642 }
1643 else {
1644 return (User)result;
1645 }
1646 }
1647 }
1648
1649
1656 public List<User> findByEmailAddress(String emailAddress)
1657 throws SystemException {
1658 return findByEmailAddress(emailAddress, QueryUtil.ALL_POS,
1659 QueryUtil.ALL_POS, null);
1660 }
1661
1662
1675 public List<User> findByEmailAddress(String emailAddress, int start, int end)
1676 throws SystemException {
1677 return findByEmailAddress(emailAddress, start, end, null);
1678 }
1679
1680
1694 public List<User> findByEmailAddress(String emailAddress, int start,
1695 int end, OrderByComparator orderByComparator) throws SystemException {
1696 Object[] finderArgs = new Object[] {
1697 emailAddress,
1698
1699 String.valueOf(start), String.valueOf(end),
1700 String.valueOf(orderByComparator)
1701 };
1702
1703 List<User> list = (List<User>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_EMAILADDRESS,
1704 finderArgs, this);
1705
1706 if (list == null) {
1707 Session session = null;
1708
1709 try {
1710 session = openSession();
1711
1712 StringBundler query = null;
1713
1714 if (orderByComparator != null) {
1715 query = new StringBundler(3 +
1716 (orderByComparator.getOrderByFields().length * 3));
1717 }
1718 else {
1719 query = new StringBundler(2);
1720 }
1721
1722 query.append(_SQL_SELECT_USER_WHERE);
1723
1724 if (emailAddress == null) {
1725 query.append(_FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_1);
1726 }
1727 else {
1728 if (emailAddress.equals(StringPool.BLANK)) {
1729 query.append(_FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_3);
1730 }
1731 else {
1732 query.append(_FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_2);
1733 }
1734 }
1735
1736 if (orderByComparator != null) {
1737 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1738 orderByComparator);
1739 }
1740
1741 String sql = query.toString();
1742
1743 Query q = session.createQuery(sql);
1744
1745 QueryPos qPos = QueryPos.getInstance(q);
1746
1747 if (emailAddress != null) {
1748 qPos.add(emailAddress);
1749 }
1750
1751 list = (List<User>)QueryUtil.list(q, getDialect(), start, end);
1752 }
1753 catch (Exception e) {
1754 throw processException(e);
1755 }
1756 finally {
1757 if (list == null) {
1758 list = new ArrayList<User>();
1759 }
1760
1761 cacheResult(list);
1762
1763 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_EMAILADDRESS,
1764 finderArgs, list);
1765
1766 closeSession(session);
1767 }
1768 }
1769
1770 return list;
1771 }
1772
1773
1786 public User findByEmailAddress_First(String emailAddress,
1787 OrderByComparator orderByComparator)
1788 throws NoSuchUserException, SystemException {
1789 List<User> list = findByEmailAddress(emailAddress, 0, 1,
1790 orderByComparator);
1791
1792 if (list.isEmpty()) {
1793 StringBundler msg = new StringBundler(4);
1794
1795 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1796
1797 msg.append("emailAddress=");
1798 msg.append(emailAddress);
1799
1800 msg.append(StringPool.CLOSE_CURLY_BRACE);
1801
1802 throw new NoSuchUserException(msg.toString());
1803 }
1804 else {
1805 return list.get(0);
1806 }
1807 }
1808
1809
1822 public User findByEmailAddress_Last(String emailAddress,
1823 OrderByComparator orderByComparator)
1824 throws NoSuchUserException, SystemException {
1825 int count = countByEmailAddress(emailAddress);
1826
1827 List<User> list = findByEmailAddress(emailAddress, count - 1, count,
1828 orderByComparator);
1829
1830 if (list.isEmpty()) {
1831 StringBundler msg = new StringBundler(4);
1832
1833 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1834
1835 msg.append("emailAddress=");
1836 msg.append(emailAddress);
1837
1838 msg.append(StringPool.CLOSE_CURLY_BRACE);
1839
1840 throw new NoSuchUserException(msg.toString());
1841 }
1842 else {
1843 return list.get(0);
1844 }
1845 }
1846
1847
1861 public User[] findByEmailAddress_PrevAndNext(long userId,
1862 String emailAddress, OrderByComparator orderByComparator)
1863 throws NoSuchUserException, SystemException {
1864 User user = findByPrimaryKey(userId);
1865
1866 Session session = null;
1867
1868 try {
1869 session = openSession();
1870
1871 User[] array = new UserImpl[3];
1872
1873 array[0] = getByEmailAddress_PrevAndNext(session, user,
1874 emailAddress, orderByComparator, true);
1875
1876 array[1] = user;
1877
1878 array[2] = getByEmailAddress_PrevAndNext(session, user,
1879 emailAddress, orderByComparator, false);
1880
1881 return array;
1882 }
1883 catch (Exception e) {
1884 throw processException(e);
1885 }
1886 finally {
1887 closeSession(session);
1888 }
1889 }
1890
1891 protected User getByEmailAddress_PrevAndNext(Session session, User user,
1892 String emailAddress, OrderByComparator orderByComparator,
1893 boolean previous) {
1894 StringBundler query = null;
1895
1896 if (orderByComparator != null) {
1897 query = new StringBundler(6 +
1898 (orderByComparator.getOrderByFields().length * 6));
1899 }
1900 else {
1901 query = new StringBundler(3);
1902 }
1903
1904 query.append(_SQL_SELECT_USER_WHERE);
1905
1906 if (emailAddress == null) {
1907 query.append(_FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_1);
1908 }
1909 else {
1910 if (emailAddress.equals(StringPool.BLANK)) {
1911 query.append(_FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_3);
1912 }
1913 else {
1914 query.append(_FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_2);
1915 }
1916 }
1917
1918 if (orderByComparator != null) {
1919 String[] orderByFields = orderByComparator.getOrderByFields();
1920
1921 if (orderByFields.length > 0) {
1922 query.append(WHERE_AND);
1923 }
1924
1925 for (int i = 0; i < orderByFields.length; i++) {
1926 query.append(_ORDER_BY_ENTITY_ALIAS);
1927 query.append(orderByFields[i]);
1928
1929 if ((i + 1) < orderByFields.length) {
1930 if (orderByComparator.isAscending() ^ previous) {
1931 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1932 }
1933 else {
1934 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1935 }
1936 }
1937 else {
1938 if (orderByComparator.isAscending() ^ previous) {
1939 query.append(WHERE_GREATER_THAN);
1940 }
1941 else {
1942 query.append(WHERE_LESSER_THAN);
1943 }
1944 }
1945 }
1946
1947 query.append(ORDER_BY_CLAUSE);
1948
1949 for (int i = 0; i < orderByFields.length; i++) {
1950 query.append(_ORDER_BY_ENTITY_ALIAS);
1951 query.append(orderByFields[i]);
1952
1953 if ((i + 1) < orderByFields.length) {
1954 if (orderByComparator.isAscending() ^ previous) {
1955 query.append(ORDER_BY_ASC_HAS_NEXT);
1956 }
1957 else {
1958 query.append(ORDER_BY_DESC_HAS_NEXT);
1959 }
1960 }
1961 else {
1962 if (orderByComparator.isAscending() ^ previous) {
1963 query.append(ORDER_BY_ASC);
1964 }
1965 else {
1966 query.append(ORDER_BY_DESC);
1967 }
1968 }
1969 }
1970 }
1971
1972 String sql = query.toString();
1973
1974 Query q = session.createQuery(sql);
1975
1976 q.setFirstResult(0);
1977 q.setMaxResults(2);
1978
1979 QueryPos qPos = QueryPos.getInstance(q);
1980
1981 if (emailAddress != null) {
1982 qPos.add(emailAddress);
1983 }
1984
1985 if (orderByComparator != null) {
1986 Object[] values = orderByComparator.getOrderByValues(user);
1987
1988 for (Object value : values) {
1989 qPos.add(value);
1990 }
1991 }
1992
1993 List<User> list = q.list();
1994
1995 if (list.size() == 2) {
1996 return list.get(1);
1997 }
1998 else {
1999 return null;
2000 }
2001 }
2002
2003
2011 public User findByPortraitId(long portraitId)
2012 throws NoSuchUserException, SystemException {
2013 User user = fetchByPortraitId(portraitId);
2014
2015 if (user == null) {
2016 StringBundler msg = new StringBundler(4);
2017
2018 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2019
2020 msg.append("portraitId=");
2021 msg.append(portraitId);
2022
2023 msg.append(StringPool.CLOSE_CURLY_BRACE);
2024
2025 if (_log.isWarnEnabled()) {
2026 _log.warn(msg.toString());
2027 }
2028
2029 throw new NoSuchUserException(msg.toString());
2030 }
2031
2032 return user;
2033 }
2034
2035
2042 public User fetchByPortraitId(long portraitId) throws SystemException {
2043 return fetchByPortraitId(portraitId, true);
2044 }
2045
2046
2053 public User fetchByPortraitId(long portraitId, boolean retrieveFromCache)
2054 throws SystemException {
2055 Object[] finderArgs = new Object[] { portraitId };
2056
2057 Object result = null;
2058
2059 if (retrieveFromCache) {
2060 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_PORTRAITID,
2061 finderArgs, this);
2062 }
2063
2064 if (result == null) {
2065 Session session = null;
2066
2067 try {
2068 session = openSession();
2069
2070 StringBundler query = new StringBundler(2);
2071
2072 query.append(_SQL_SELECT_USER_WHERE);
2073
2074 query.append(_FINDER_COLUMN_PORTRAITID_PORTRAITID_2);
2075
2076 String sql = query.toString();
2077
2078 Query q = session.createQuery(sql);
2079
2080 QueryPos qPos = QueryPos.getInstance(q);
2081
2082 qPos.add(portraitId);
2083
2084 List<User> list = q.list();
2085
2086 result = list;
2087
2088 User user = null;
2089
2090 if (list.isEmpty()) {
2091 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_PORTRAITID,
2092 finderArgs, list);
2093 }
2094 else {
2095 user = list.get(0);
2096
2097 cacheResult(user);
2098
2099 if ((user.getPortraitId() != portraitId)) {
2100 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_PORTRAITID,
2101 finderArgs, user);
2102 }
2103 }
2104
2105 return user;
2106 }
2107 catch (Exception e) {
2108 throw processException(e);
2109 }
2110 finally {
2111 if (result == null) {
2112 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_PORTRAITID,
2113 finderArgs, new ArrayList<User>());
2114 }
2115
2116 closeSession(session);
2117 }
2118 }
2119 else {
2120 if (result instanceof List<?>) {
2121 return null;
2122 }
2123 else {
2124 return (User)result;
2125 }
2126 }
2127 }
2128
2129
2138 public User findByC_U(long companyId, long userId)
2139 throws NoSuchUserException, SystemException {
2140 User user = fetchByC_U(companyId, userId);
2141
2142 if (user == null) {
2143 StringBundler msg = new StringBundler(6);
2144
2145 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2146
2147 msg.append("companyId=");
2148 msg.append(companyId);
2149
2150 msg.append(", userId=");
2151 msg.append(userId);
2152
2153 msg.append(StringPool.CLOSE_CURLY_BRACE);
2154
2155 if (_log.isWarnEnabled()) {
2156 _log.warn(msg.toString());
2157 }
2158
2159 throw new NoSuchUserException(msg.toString());
2160 }
2161
2162 return user;
2163 }
2164
2165
2173 public User fetchByC_U(long companyId, long userId)
2174 throws SystemException {
2175 return fetchByC_U(companyId, userId, true);
2176 }
2177
2178
2186 public User fetchByC_U(long companyId, long userId,
2187 boolean retrieveFromCache) throws SystemException {
2188 Object[] finderArgs = new Object[] { companyId, userId };
2189
2190 Object result = null;
2191
2192 if (retrieveFromCache) {
2193 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_U,
2194 finderArgs, this);
2195 }
2196
2197 if (result == null) {
2198 Session session = null;
2199
2200 try {
2201 session = openSession();
2202
2203 StringBundler query = new StringBundler(3);
2204
2205 query.append(_SQL_SELECT_USER_WHERE);
2206
2207 query.append(_FINDER_COLUMN_C_U_COMPANYID_2);
2208
2209 query.append(_FINDER_COLUMN_C_U_USERID_2);
2210
2211 String sql = query.toString();
2212
2213 Query q = session.createQuery(sql);
2214
2215 QueryPos qPos = QueryPos.getInstance(q);
2216
2217 qPos.add(companyId);
2218
2219 qPos.add(userId);
2220
2221 List<User> list = q.list();
2222
2223 result = list;
2224
2225 User user = null;
2226
2227 if (list.isEmpty()) {
2228 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_U,
2229 finderArgs, list);
2230 }
2231 else {
2232 user = list.get(0);
2233
2234 cacheResult(user);
2235
2236 if ((user.getCompanyId() != companyId) ||
2237 (user.getUserId() != userId)) {
2238 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_U,
2239 finderArgs, user);
2240 }
2241 }
2242
2243 return user;
2244 }
2245 catch (Exception e) {
2246 throw processException(e);
2247 }
2248 finally {
2249 if (result == null) {
2250 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_U,
2251 finderArgs, new ArrayList<User>());
2252 }
2253
2254 closeSession(session);
2255 }
2256 }
2257 else {
2258 if (result instanceof List<?>) {
2259 return null;
2260 }
2261 else {
2262 return (User)result;
2263 }
2264 }
2265 }
2266
2267
2276 public User findByC_DU(long companyId, boolean defaultUser)
2277 throws NoSuchUserException, SystemException {
2278 User user = fetchByC_DU(companyId, defaultUser);
2279
2280 if (user == null) {
2281 StringBundler msg = new StringBundler(6);
2282
2283 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2284
2285 msg.append("companyId=");
2286 msg.append(companyId);
2287
2288 msg.append(", defaultUser=");
2289 msg.append(defaultUser);
2290
2291 msg.append(StringPool.CLOSE_CURLY_BRACE);
2292
2293 if (_log.isWarnEnabled()) {
2294 _log.warn(msg.toString());
2295 }
2296
2297 throw new NoSuchUserException(msg.toString());
2298 }
2299
2300 return user;
2301 }
2302
2303
2311 public User fetchByC_DU(long companyId, boolean defaultUser)
2312 throws SystemException {
2313 return fetchByC_DU(companyId, defaultUser, true);
2314 }
2315
2316
2324 public User fetchByC_DU(long companyId, boolean defaultUser,
2325 boolean retrieveFromCache) throws SystemException {
2326 Object[] finderArgs = new Object[] { companyId, defaultUser };
2327
2328 Object result = null;
2329
2330 if (retrieveFromCache) {
2331 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_DU,
2332 finderArgs, this);
2333 }
2334
2335 if (result == null) {
2336 Session session = null;
2337
2338 try {
2339 session = openSession();
2340
2341 StringBundler query = new StringBundler(3);
2342
2343 query.append(_SQL_SELECT_USER_WHERE);
2344
2345 query.append(_FINDER_COLUMN_C_DU_COMPANYID_2);
2346
2347 query.append(_FINDER_COLUMN_C_DU_DEFAULTUSER_2);
2348
2349 String sql = query.toString();
2350
2351 Query q = session.createQuery(sql);
2352
2353 QueryPos qPos = QueryPos.getInstance(q);
2354
2355 qPos.add(companyId);
2356
2357 qPos.add(defaultUser);
2358
2359 List<User> list = q.list();
2360
2361 result = list;
2362
2363 User user = null;
2364
2365 if (list.isEmpty()) {
2366 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_DU,
2367 finderArgs, list);
2368 }
2369 else {
2370 user = list.get(0);
2371
2372 cacheResult(user);
2373
2374 if ((user.getCompanyId() != companyId) ||
2375 (user.getDefaultUser() != defaultUser)) {
2376 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_DU,
2377 finderArgs, user);
2378 }
2379 }
2380
2381 return user;
2382 }
2383 catch (Exception e) {
2384 throw processException(e);
2385 }
2386 finally {
2387 if (result == null) {
2388 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_DU,
2389 finderArgs, new ArrayList<User>());
2390 }
2391
2392 closeSession(session);
2393 }
2394 }
2395 else {
2396 if (result instanceof List<?>) {
2397 return null;
2398 }
2399 else {
2400 return (User)result;
2401 }
2402 }
2403 }
2404
2405
2414 public User findByC_SN(long companyId, String screenName)
2415 throws NoSuchUserException, SystemException {
2416 User user = fetchByC_SN(companyId, screenName);
2417
2418 if (user == null) {
2419 StringBundler msg = new StringBundler(6);
2420
2421 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2422
2423 msg.append("companyId=");
2424 msg.append(companyId);
2425
2426 msg.append(", screenName=");
2427 msg.append(screenName);
2428
2429 msg.append(StringPool.CLOSE_CURLY_BRACE);
2430
2431 if (_log.isWarnEnabled()) {
2432 _log.warn(msg.toString());
2433 }
2434
2435 throw new NoSuchUserException(msg.toString());
2436 }
2437
2438 return user;
2439 }
2440
2441
2449 public User fetchByC_SN(long companyId, String screenName)
2450 throws SystemException {
2451 return fetchByC_SN(companyId, screenName, true);
2452 }
2453
2454
2462 public User fetchByC_SN(long companyId, String screenName,
2463 boolean retrieveFromCache) throws SystemException {
2464 Object[] finderArgs = new Object[] { companyId, screenName };
2465
2466 Object result = null;
2467
2468 if (retrieveFromCache) {
2469 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_SN,
2470 finderArgs, this);
2471 }
2472
2473 if (result == null) {
2474 Session session = null;
2475
2476 try {
2477 session = openSession();
2478
2479 StringBundler query = new StringBundler(3);
2480
2481 query.append(_SQL_SELECT_USER_WHERE);
2482
2483 query.append(_FINDER_COLUMN_C_SN_COMPANYID_2);
2484
2485 if (screenName == null) {
2486 query.append(_FINDER_COLUMN_C_SN_SCREENNAME_1);
2487 }
2488 else {
2489 if (screenName.equals(StringPool.BLANK)) {
2490 query.append(_FINDER_COLUMN_C_SN_SCREENNAME_3);
2491 }
2492 else {
2493 query.append(_FINDER_COLUMN_C_SN_SCREENNAME_2);
2494 }
2495 }
2496
2497 String sql = query.toString();
2498
2499 Query q = session.createQuery(sql);
2500
2501 QueryPos qPos = QueryPos.getInstance(q);
2502
2503 qPos.add(companyId);
2504
2505 if (screenName != null) {
2506 qPos.add(screenName);
2507 }
2508
2509 List<User> list = q.list();
2510
2511 result = list;
2512
2513 User user = null;
2514
2515 if (list.isEmpty()) {
2516 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_SN,
2517 finderArgs, list);
2518 }
2519 else {
2520 user = list.get(0);
2521
2522 cacheResult(user);
2523
2524 if ((user.getCompanyId() != companyId) ||
2525 (user.getScreenName() == null) ||
2526 !user.getScreenName().equals(screenName)) {
2527 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_SN,
2528 finderArgs, user);
2529 }
2530 }
2531
2532 return user;
2533 }
2534 catch (Exception e) {
2535 throw processException(e);
2536 }
2537 finally {
2538 if (result == null) {
2539 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_SN,
2540 finderArgs, new ArrayList<User>());
2541 }
2542
2543 closeSession(session);
2544 }
2545 }
2546 else {
2547 if (result instanceof List<?>) {
2548 return null;
2549 }
2550 else {
2551 return (User)result;
2552 }
2553 }
2554 }
2555
2556
2565 public User findByC_EA(long companyId, String emailAddress)
2566 throws NoSuchUserException, SystemException {
2567 User user = fetchByC_EA(companyId, emailAddress);
2568
2569 if (user == null) {
2570 StringBundler msg = new StringBundler(6);
2571
2572 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2573
2574 msg.append("companyId=");
2575 msg.append(companyId);
2576
2577 msg.append(", emailAddress=");
2578 msg.append(emailAddress);
2579
2580 msg.append(StringPool.CLOSE_CURLY_BRACE);
2581
2582 if (_log.isWarnEnabled()) {
2583 _log.warn(msg.toString());
2584 }
2585
2586 throw new NoSuchUserException(msg.toString());
2587 }
2588
2589 return user;
2590 }
2591
2592
2600 public User fetchByC_EA(long companyId, String emailAddress)
2601 throws SystemException {
2602 return fetchByC_EA(companyId, emailAddress, true);
2603 }
2604
2605
2613 public User fetchByC_EA(long companyId, String emailAddress,
2614 boolean retrieveFromCache) throws SystemException {
2615 Object[] finderArgs = new Object[] { companyId, emailAddress };
2616
2617 Object result = null;
2618
2619 if (retrieveFromCache) {
2620 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_EA,
2621 finderArgs, this);
2622 }
2623
2624 if (result == null) {
2625 Session session = null;
2626
2627 try {
2628 session = openSession();
2629
2630 StringBundler query = new StringBundler(3);
2631
2632 query.append(_SQL_SELECT_USER_WHERE);
2633
2634 query.append(_FINDER_COLUMN_C_EA_COMPANYID_2);
2635
2636 if (emailAddress == null) {
2637 query.append(_FINDER_COLUMN_C_EA_EMAILADDRESS_1);
2638 }
2639 else {
2640 if (emailAddress.equals(StringPool.BLANK)) {
2641 query.append(_FINDER_COLUMN_C_EA_EMAILADDRESS_3);
2642 }
2643 else {
2644 query.append(_FINDER_COLUMN_C_EA_EMAILADDRESS_2);
2645 }
2646 }
2647
2648 String sql = query.toString();
2649
2650 Query q = session.createQuery(sql);
2651
2652 QueryPos qPos = QueryPos.getInstance(q);
2653
2654 qPos.add(companyId);
2655
2656 if (emailAddress != null) {
2657 qPos.add(emailAddress);
2658 }
2659
2660 List<User> list = q.list();
2661
2662 result = list;
2663
2664 User user = null;
2665
2666 if (list.isEmpty()) {
2667 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_EA,
2668 finderArgs, list);
2669 }
2670 else {
2671 user = list.get(0);
2672
2673 cacheResult(user);
2674
2675 if ((user.getCompanyId() != companyId) ||
2676 (user.getEmailAddress() == null) ||
2677 !user.getEmailAddress().equals(emailAddress)) {
2678 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_EA,
2679 finderArgs, user);
2680 }
2681 }
2682
2683 return user;
2684 }
2685 catch (Exception e) {
2686 throw processException(e);
2687 }
2688 finally {
2689 if (result == null) {
2690 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_EA,
2691 finderArgs, new ArrayList<User>());
2692 }
2693
2694 closeSession(session);
2695 }
2696 }
2697 else {
2698 if (result instanceof List<?>) {
2699 return null;
2700 }
2701 else {
2702 return (User)result;
2703 }
2704 }
2705 }
2706
2707
2716 public User findByC_FID(long companyId, long facebookId)
2717 throws NoSuchUserException, SystemException {
2718 User user = fetchByC_FID(companyId, facebookId);
2719
2720 if (user == null) {
2721 StringBundler msg = new StringBundler(6);
2722
2723 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2724
2725 msg.append("companyId=");
2726 msg.append(companyId);
2727
2728 msg.append(", facebookId=");
2729 msg.append(facebookId);
2730
2731 msg.append(StringPool.CLOSE_CURLY_BRACE);
2732
2733 if (_log.isWarnEnabled()) {
2734 _log.warn(msg.toString());
2735 }
2736
2737 throw new NoSuchUserException(msg.toString());
2738 }
2739
2740 return user;
2741 }
2742
2743
2751 public User fetchByC_FID(long companyId, long facebookId)
2752 throws SystemException {
2753 return fetchByC_FID(companyId, facebookId, true);
2754 }
2755
2756
2764 public User fetchByC_FID(long companyId, long facebookId,
2765 boolean retrieveFromCache) throws SystemException {
2766 Object[] finderArgs = new Object[] { companyId, facebookId };
2767
2768 Object result = null;
2769
2770 if (retrieveFromCache) {
2771 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_FID,
2772 finderArgs, this);
2773 }
2774
2775 if (result == null) {
2776 Session session = null;
2777
2778 try {
2779 session = openSession();
2780
2781 StringBundler query = new StringBundler(3);
2782
2783 query.append(_SQL_SELECT_USER_WHERE);
2784
2785 query.append(_FINDER_COLUMN_C_FID_COMPANYID_2);
2786
2787 query.append(_FINDER_COLUMN_C_FID_FACEBOOKID_2);
2788
2789 String sql = query.toString();
2790
2791 Query q = session.createQuery(sql);
2792
2793 QueryPos qPos = QueryPos.getInstance(q);
2794
2795 qPos.add(companyId);
2796
2797 qPos.add(facebookId);
2798
2799 List<User> list = q.list();
2800
2801 result = list;
2802
2803 User user = null;
2804
2805 if (list.isEmpty()) {
2806 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_FID,
2807 finderArgs, list);
2808 }
2809 else {
2810 user = list.get(0);
2811
2812 cacheResult(user);
2813
2814 if ((user.getCompanyId() != companyId) ||
2815 (user.getFacebookId() != facebookId)) {
2816 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_FID,
2817 finderArgs, user);
2818 }
2819 }
2820
2821 return user;
2822 }
2823 catch (Exception e) {
2824 throw processException(e);
2825 }
2826 finally {
2827 if (result == null) {
2828 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_FID,
2829 finderArgs, new ArrayList<User>());
2830 }
2831
2832 closeSession(session);
2833 }
2834 }
2835 else {
2836 if (result instanceof List<?>) {
2837 return null;
2838 }
2839 else {
2840 return (User)result;
2841 }
2842 }
2843 }
2844
2845
2854 public User findByC_O(long companyId, String openId)
2855 throws NoSuchUserException, SystemException {
2856 User user = fetchByC_O(companyId, openId);
2857
2858 if (user == null) {
2859 StringBundler msg = new StringBundler(6);
2860
2861 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2862
2863 msg.append("companyId=");
2864 msg.append(companyId);
2865
2866 msg.append(", openId=");
2867 msg.append(openId);
2868
2869 msg.append(StringPool.CLOSE_CURLY_BRACE);
2870
2871 if (_log.isWarnEnabled()) {
2872 _log.warn(msg.toString());
2873 }
2874
2875 throw new NoSuchUserException(msg.toString());
2876 }
2877
2878 return user;
2879 }
2880
2881
2889 public User fetchByC_O(long companyId, String openId)
2890 throws SystemException {
2891 return fetchByC_O(companyId, openId, true);
2892 }
2893
2894
2902 public User fetchByC_O(long companyId, String openId,
2903 boolean retrieveFromCache) throws SystemException {
2904 Object[] finderArgs = new Object[] { companyId, openId };
2905
2906 Object result = null;
2907
2908 if (retrieveFromCache) {
2909 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_O,
2910 finderArgs, this);
2911 }
2912
2913 if (result == null) {
2914 Session session = null;
2915
2916 try {
2917 session = openSession();
2918
2919 StringBundler query = new StringBundler(3);
2920
2921 query.append(_SQL_SELECT_USER_WHERE);
2922
2923 query.append(_FINDER_COLUMN_C_O_COMPANYID_2);
2924
2925 if (openId == null) {
2926 query.append(_FINDER_COLUMN_C_O_OPENID_1);
2927 }
2928 else {
2929 if (openId.equals(StringPool.BLANK)) {
2930 query.append(_FINDER_COLUMN_C_O_OPENID_3);
2931 }
2932 else {
2933 query.append(_FINDER_COLUMN_C_O_OPENID_2);
2934 }
2935 }
2936
2937 String sql = query.toString();
2938
2939 Query q = session.createQuery(sql);
2940
2941 QueryPos qPos = QueryPos.getInstance(q);
2942
2943 qPos.add(companyId);
2944
2945 if (openId != null) {
2946 qPos.add(openId);
2947 }
2948
2949 List<User> list = q.list();
2950
2951 result = list;
2952
2953 User user = null;
2954
2955 if (list.isEmpty()) {
2956 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_O,
2957 finderArgs, list);
2958 }
2959 else {
2960 user = list.get(0);
2961
2962 cacheResult(user);
2963
2964 if ((user.getCompanyId() != companyId) ||
2965 (user.getOpenId() == null) ||
2966 !user.getOpenId().equals(openId)) {
2967 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_O,
2968 finderArgs, user);
2969 }
2970 }
2971
2972 return user;
2973 }
2974 catch (Exception e) {
2975 throw processException(e);
2976 }
2977 finally {
2978 if (result == null) {
2979 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_O,
2980 finderArgs, new ArrayList<User>());
2981 }
2982
2983 closeSession(session);
2984 }
2985 }
2986 else {
2987 if (result instanceof List<?>) {
2988 return null;
2989 }
2990 else {
2991 return (User)result;
2992 }
2993 }
2994 }
2995
2996
3004 public List<User> findByC_A(long companyId, boolean active)
3005 throws SystemException {
3006 return findByC_A(companyId, active, QueryUtil.ALL_POS,
3007 QueryUtil.ALL_POS, null);
3008 }
3009
3010
3024 public List<User> findByC_A(long companyId, boolean active, int start,
3025 int end) throws SystemException {
3026 return findByC_A(companyId, active, start, end, null);
3027 }
3028
3029
3044 public List<User> findByC_A(long companyId, boolean active, int start,
3045 int end, OrderByComparator orderByComparator) throws SystemException {
3046 Object[] finderArgs = new Object[] {
3047 companyId, active,
3048
3049 String.valueOf(start), String.valueOf(end),
3050 String.valueOf(orderByComparator)
3051 };
3052
3053 List<User> list = (List<User>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_A,
3054 finderArgs, this);
3055
3056 if (list == null) {
3057 Session session = null;
3058
3059 try {
3060 session = openSession();
3061
3062 StringBundler query = null;
3063
3064 if (orderByComparator != null) {
3065 query = new StringBundler(4 +
3066 (orderByComparator.getOrderByFields().length * 3));
3067 }
3068 else {
3069 query = new StringBundler(3);
3070 }
3071
3072 query.append(_SQL_SELECT_USER_WHERE);
3073
3074 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
3075
3076 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
3077
3078 if (orderByComparator != null) {
3079 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3080 orderByComparator);
3081 }
3082
3083 String sql = query.toString();
3084
3085 Query q = session.createQuery(sql);
3086
3087 QueryPos qPos = QueryPos.getInstance(q);
3088
3089 qPos.add(companyId);
3090
3091 qPos.add(active);
3092
3093 list = (List<User>)QueryUtil.list(q, getDialect(), start, end);
3094 }
3095 catch (Exception e) {
3096 throw processException(e);
3097 }
3098 finally {
3099 if (list == null) {
3100 list = new ArrayList<User>();
3101 }
3102
3103 cacheResult(list);
3104
3105 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_A, finderArgs,
3106 list);
3107
3108 closeSession(session);
3109 }
3110 }
3111
3112 return list;
3113 }
3114
3115
3129 public User findByC_A_First(long companyId, boolean active,
3130 OrderByComparator orderByComparator)
3131 throws NoSuchUserException, SystemException {
3132 List<User> list = findByC_A(companyId, active, 0, 1, orderByComparator);
3133
3134 if (list.isEmpty()) {
3135 StringBundler msg = new StringBundler(6);
3136
3137 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3138
3139 msg.append("companyId=");
3140 msg.append(companyId);
3141
3142 msg.append(", active=");
3143 msg.append(active);
3144
3145 msg.append(StringPool.CLOSE_CURLY_BRACE);
3146
3147 throw new NoSuchUserException(msg.toString());
3148 }
3149 else {
3150 return list.get(0);
3151 }
3152 }
3153
3154
3168 public User findByC_A_Last(long companyId, boolean active,
3169 OrderByComparator orderByComparator)
3170 throws NoSuchUserException, SystemException {
3171 int count = countByC_A(companyId, active);
3172
3173 List<User> list = findByC_A(companyId, active, count - 1, count,
3174 orderByComparator);
3175
3176 if (list.isEmpty()) {
3177 StringBundler msg = new StringBundler(6);
3178
3179 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3180
3181 msg.append("companyId=");
3182 msg.append(companyId);
3183
3184 msg.append(", active=");
3185 msg.append(active);
3186
3187 msg.append(StringPool.CLOSE_CURLY_BRACE);
3188
3189 throw new NoSuchUserException(msg.toString());
3190 }
3191 else {
3192 return list.get(0);
3193 }
3194 }
3195
3196
3211 public User[] findByC_A_PrevAndNext(long userId, long companyId,
3212 boolean active, OrderByComparator orderByComparator)
3213 throws NoSuchUserException, SystemException {
3214 User user = findByPrimaryKey(userId);
3215
3216 Session session = null;
3217
3218 try {
3219 session = openSession();
3220
3221 User[] array = new UserImpl[3];
3222
3223 array[0] = getByC_A_PrevAndNext(session, user, companyId, active,
3224 orderByComparator, true);
3225
3226 array[1] = user;
3227
3228 array[2] = getByC_A_PrevAndNext(session, user, companyId, active,
3229 orderByComparator, false);
3230
3231 return array;
3232 }
3233 catch (Exception e) {
3234 throw processException(e);
3235 }
3236 finally {
3237 closeSession(session);
3238 }
3239 }
3240
3241 protected User getByC_A_PrevAndNext(Session session, User user,
3242 long companyId, boolean active, OrderByComparator orderByComparator,
3243 boolean previous) {
3244 StringBundler query = null;
3245
3246 if (orderByComparator != null) {
3247 query = new StringBundler(6 +
3248 (orderByComparator.getOrderByFields().length * 6));
3249 }
3250 else {
3251 query = new StringBundler(3);
3252 }
3253
3254 query.append(_SQL_SELECT_USER_WHERE);
3255
3256 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
3257
3258 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
3259
3260 if (orderByComparator != null) {
3261 String[] orderByFields = orderByComparator.getOrderByFields();
3262
3263 if (orderByFields.length > 0) {
3264 query.append(WHERE_AND);
3265 }
3266
3267 for (int i = 0; i < orderByFields.length; i++) {
3268 query.append(_ORDER_BY_ENTITY_ALIAS);
3269 query.append(orderByFields[i]);
3270
3271 if ((i + 1) < orderByFields.length) {
3272 if (orderByComparator.isAscending() ^ previous) {
3273 query.append(WHERE_GREATER_THAN_HAS_NEXT);
3274 }
3275 else {
3276 query.append(WHERE_LESSER_THAN_HAS_NEXT);
3277 }
3278 }
3279 else {
3280 if (orderByComparator.isAscending() ^ previous) {
3281 query.append(WHERE_GREATER_THAN);
3282 }
3283 else {
3284 query.append(WHERE_LESSER_THAN);
3285 }
3286 }
3287 }
3288
3289 query.append(ORDER_BY_CLAUSE);
3290
3291 for (int i = 0; i < orderByFields.length; i++) {
3292 query.append(_ORDER_BY_ENTITY_ALIAS);
3293 query.append(orderByFields[i]);
3294
3295 if ((i + 1) < orderByFields.length) {
3296 if (orderByComparator.isAscending() ^ previous) {
3297 query.append(ORDER_BY_ASC_HAS_NEXT);
3298 }
3299 else {
3300 query.append(ORDER_BY_DESC_HAS_NEXT);
3301 }
3302 }
3303 else {
3304 if (orderByComparator.isAscending() ^ previous) {
3305 query.append(ORDER_BY_ASC);
3306 }
3307 else {
3308 query.append(ORDER_BY_DESC);
3309 }
3310 }
3311 }
3312 }
3313
3314 String sql = query.toString();
3315
3316 Query q = session.createQuery(sql);
3317
3318 q.setFirstResult(0);
3319 q.setMaxResults(2);
3320
3321 QueryPos qPos = QueryPos.getInstance(q);
3322
3323 qPos.add(companyId);
3324
3325 qPos.add(active);
3326
3327 if (orderByComparator != null) {
3328 Object[] values = orderByComparator.getOrderByValues(user);
3329
3330 for (Object value : values) {
3331 qPos.add(value);
3332 }
3333 }
3334
3335 List<User> list = q.list();
3336
3337 if (list.size() == 2) {
3338 return list.get(1);
3339 }
3340 else {
3341 return null;
3342 }
3343 }
3344
3345
3351 public List<User> findAll() throws SystemException {
3352 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
3353 }
3354
3355
3367 public List<User> findAll(int start, int end) throws SystemException {
3368 return findAll(start, end, null);
3369 }
3370
3371
3384 public List<User> findAll(int start, int end,
3385 OrderByComparator orderByComparator) throws SystemException {
3386 Object[] finderArgs = new Object[] {
3387 String.valueOf(start), String.valueOf(end),
3388 String.valueOf(orderByComparator)
3389 };
3390
3391 List<User> list = (List<User>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
3392 finderArgs, this);
3393
3394 if (list == null) {
3395 Session session = null;
3396
3397 try {
3398 session = openSession();
3399
3400 StringBundler query = null;
3401 String sql = null;
3402
3403 if (orderByComparator != null) {
3404 query = new StringBundler(2 +
3405 (orderByComparator.getOrderByFields().length * 3));
3406
3407 query.append(_SQL_SELECT_USER);
3408
3409 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3410 orderByComparator);
3411
3412 sql = query.toString();
3413 }
3414 else {
3415 sql = _SQL_SELECT_USER;
3416 }
3417
3418 Query q = session.createQuery(sql);
3419
3420 if (orderByComparator == null) {
3421 list = (List<User>)QueryUtil.list(q, getDialect(), start,
3422 end, false);
3423
3424 Collections.sort(list);
3425 }
3426 else {
3427 list = (List<User>)QueryUtil.list(q, getDialect(), start,
3428 end);
3429 }
3430 }
3431 catch (Exception e) {
3432 throw processException(e);
3433 }
3434 finally {
3435 if (list == null) {
3436 list = new ArrayList<User>();
3437 }
3438
3439 cacheResult(list);
3440
3441 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
3442
3443 closeSession(session);
3444 }
3445 }
3446
3447 return list;
3448 }
3449
3450
3456 public void removeByUuid(String uuid) throws SystemException {
3457 for (User user : findByUuid(uuid)) {
3458 remove(user);
3459 }
3460 }
3461
3462
3468 public void removeByCompanyId(long companyId) throws SystemException {
3469 for (User user : findByCompanyId(companyId)) {
3470 remove(user);
3471 }
3472 }
3473
3474
3480 public void removeByContactId(long contactId)
3481 throws NoSuchUserException, SystemException {
3482 User user = findByContactId(contactId);
3483
3484 remove(user);
3485 }
3486
3487
3493 public void removeByEmailAddress(String emailAddress)
3494 throws SystemException {
3495 for (User user : findByEmailAddress(emailAddress)) {
3496 remove(user);
3497 }
3498 }
3499
3500
3506 public void removeByPortraitId(long portraitId)
3507 throws NoSuchUserException, SystemException {
3508 User user = findByPortraitId(portraitId);
3509
3510 remove(user);
3511 }
3512
3513
3520 public void removeByC_U(long companyId, long userId)
3521 throws NoSuchUserException, SystemException {
3522 User user = findByC_U(companyId, userId);
3523
3524 remove(user);
3525 }
3526
3527
3534 public void removeByC_DU(long companyId, boolean defaultUser)
3535 throws NoSuchUserException, SystemException {
3536 User user = findByC_DU(companyId, defaultUser);
3537
3538 remove(user);
3539 }
3540
3541
3548 public void removeByC_SN(long companyId, String screenName)
3549 throws NoSuchUserException, SystemException {
3550 User user = findByC_SN(companyId, screenName);
3551
3552 remove(user);
3553 }
3554
3555
3562 public void removeByC_EA(long companyId, String emailAddress)
3563 throws NoSuchUserException, SystemException {
3564 User user = findByC_EA(companyId, emailAddress);
3565
3566 remove(user);
3567 }
3568
3569
3576 public void removeByC_FID(long companyId, long facebookId)
3577 throws NoSuchUserException, SystemException {
3578 User user = findByC_FID(companyId, facebookId);
3579
3580 remove(user);
3581 }
3582
3583
3590 public void removeByC_O(long companyId, String openId)
3591 throws NoSuchUserException, SystemException {
3592 User user = findByC_O(companyId, openId);
3593
3594 remove(user);
3595 }
3596
3597
3604 public void removeByC_A(long companyId, boolean active)
3605 throws SystemException {
3606 for (User user : findByC_A(companyId, active)) {
3607 remove(user);
3608 }
3609 }
3610
3611
3616 public void removeAll() throws SystemException {
3617 for (User user : findAll()) {
3618 remove(user);
3619 }
3620 }
3621
3622
3629 public int countByUuid(String uuid) throws SystemException {
3630 Object[] finderArgs = new Object[] { uuid };
3631
3632 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
3633 finderArgs, this);
3634
3635 if (count == null) {
3636 Session session = null;
3637
3638 try {
3639 session = openSession();
3640
3641 StringBundler query = new StringBundler(2);
3642
3643 query.append(_SQL_COUNT_USER_WHERE);
3644
3645 if (uuid == null) {
3646 query.append(_FINDER_COLUMN_UUID_UUID_1);
3647 }
3648 else {
3649 if (uuid.equals(StringPool.BLANK)) {
3650 query.append(_FINDER_COLUMN_UUID_UUID_3);
3651 }
3652 else {
3653 query.append(_FINDER_COLUMN_UUID_UUID_2);
3654 }
3655 }
3656
3657 String sql = query.toString();
3658
3659 Query q = session.createQuery(sql);
3660
3661 QueryPos qPos = QueryPos.getInstance(q);
3662
3663 if (uuid != null) {
3664 qPos.add(uuid);
3665 }
3666
3667 count = (Long)q.uniqueResult();
3668 }
3669 catch (Exception e) {
3670 throw processException(e);
3671 }
3672 finally {
3673 if (count == null) {
3674 count = Long.valueOf(0);
3675 }
3676
3677 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
3678 finderArgs, count);
3679
3680 closeSession(session);
3681 }
3682 }
3683
3684 return count.intValue();
3685 }
3686
3687
3694 public int countByCompanyId(long companyId) throws SystemException {
3695 Object[] finderArgs = new Object[] { companyId };
3696
3697 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
3698 finderArgs, this);
3699
3700 if (count == null) {
3701 Session session = null;
3702
3703 try {
3704 session = openSession();
3705
3706 StringBundler query = new StringBundler(2);
3707
3708 query.append(_SQL_COUNT_USER_WHERE);
3709
3710 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
3711
3712 String sql = query.toString();
3713
3714 Query q = session.createQuery(sql);
3715
3716 QueryPos qPos = QueryPos.getInstance(q);
3717
3718 qPos.add(companyId);
3719
3720 count = (Long)q.uniqueResult();
3721 }
3722 catch (Exception e) {
3723 throw processException(e);
3724 }
3725 finally {
3726 if (count == null) {
3727 count = Long.valueOf(0);
3728 }
3729
3730 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
3731 finderArgs, count);
3732
3733 closeSession(session);
3734 }
3735 }
3736
3737 return count.intValue();
3738 }
3739
3740
3747 public int countByContactId(long contactId) throws SystemException {
3748 Object[] finderArgs = new Object[] { contactId };
3749
3750 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_CONTACTID,
3751 finderArgs, this);
3752
3753 if (count == null) {
3754 Session session = null;
3755
3756 try {
3757 session = openSession();
3758
3759 StringBundler query = new StringBundler(2);
3760
3761 query.append(_SQL_COUNT_USER_WHERE);
3762
3763 query.append(_FINDER_COLUMN_CONTACTID_CONTACTID_2);
3764
3765 String sql = query.toString();
3766
3767 Query q = session.createQuery(sql);
3768
3769 QueryPos qPos = QueryPos.getInstance(q);
3770
3771 qPos.add(contactId);
3772
3773 count = (Long)q.uniqueResult();
3774 }
3775 catch (Exception e) {
3776 throw processException(e);
3777 }
3778 finally {
3779 if (count == null) {
3780 count = Long.valueOf(0);
3781 }
3782
3783 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_CONTACTID,
3784 finderArgs, count);
3785
3786 closeSession(session);
3787 }
3788 }
3789
3790 return count.intValue();
3791 }
3792
3793
3800 public int countByEmailAddress(String emailAddress)
3801 throws SystemException {
3802 Object[] finderArgs = new Object[] { emailAddress };
3803
3804 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_EMAILADDRESS,
3805 finderArgs, this);
3806
3807 if (count == null) {
3808 Session session = null;
3809
3810 try {
3811 session = openSession();
3812
3813 StringBundler query = new StringBundler(2);
3814
3815 query.append(_SQL_COUNT_USER_WHERE);
3816
3817 if (emailAddress == null) {
3818 query.append(_FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_1);
3819 }
3820 else {
3821 if (emailAddress.equals(StringPool.BLANK)) {
3822 query.append(_FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_3);
3823 }
3824 else {
3825 query.append(_FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_2);
3826 }
3827 }
3828
3829 String sql = query.toString();
3830
3831 Query q = session.createQuery(sql);
3832
3833 QueryPos qPos = QueryPos.getInstance(q);
3834
3835 if (emailAddress != null) {
3836 qPos.add(emailAddress);
3837 }
3838
3839 count = (Long)q.uniqueResult();
3840 }
3841 catch (Exception e) {
3842 throw processException(e);
3843 }
3844 finally {
3845 if (count == null) {
3846 count = Long.valueOf(0);
3847 }
3848
3849 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_EMAILADDRESS,
3850 finderArgs, count);
3851
3852 closeSession(session);
3853 }
3854 }
3855
3856 return count.intValue();
3857 }
3858
3859
3866 public int countByPortraitId(long portraitId) throws SystemException {
3867 Object[] finderArgs = new Object[] { portraitId };
3868
3869 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_PORTRAITID,
3870 finderArgs, this);
3871
3872 if (count == null) {
3873 Session session = null;
3874
3875 try {
3876 session = openSession();
3877
3878 StringBundler query = new StringBundler(2);
3879
3880 query.append(_SQL_COUNT_USER_WHERE);
3881
3882 query.append(_FINDER_COLUMN_PORTRAITID_PORTRAITID_2);
3883
3884 String sql = query.toString();
3885
3886 Query q = session.createQuery(sql);
3887
3888 QueryPos qPos = QueryPos.getInstance(q);
3889
3890 qPos.add(portraitId);
3891
3892 count = (Long)q.uniqueResult();
3893 }
3894 catch (Exception e) {
3895 throw processException(e);
3896 }
3897 finally {
3898 if (count == null) {
3899 count = Long.valueOf(0);
3900 }
3901
3902 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_PORTRAITID,
3903 finderArgs, count);
3904
3905 closeSession(session);
3906 }
3907 }
3908
3909 return count.intValue();
3910 }
3911
3912
3920 public int countByC_U(long companyId, long userId)
3921 throws SystemException {
3922 Object[] finderArgs = new Object[] { companyId, userId };
3923
3924 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_U,
3925 finderArgs, this);
3926
3927 if (count == null) {
3928 Session session = null;
3929
3930 try {
3931 session = openSession();
3932
3933 StringBundler query = new StringBundler(3);
3934
3935 query.append(_SQL_COUNT_USER_WHERE);
3936
3937 query.append(_FINDER_COLUMN_C_U_COMPANYID_2);
3938
3939 query.append(_FINDER_COLUMN_C_U_USERID_2);
3940
3941 String sql = query.toString();
3942
3943 Query q = session.createQuery(sql);
3944
3945 QueryPos qPos = QueryPos.getInstance(q);
3946
3947 qPos.add(companyId);
3948
3949 qPos.add(userId);
3950
3951 count = (Long)q.uniqueResult();
3952 }
3953 catch (Exception e) {
3954 throw processException(e);
3955 }
3956 finally {
3957 if (count == null) {
3958 count = Long.valueOf(0);
3959 }
3960
3961 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_U, finderArgs,
3962 count);
3963
3964 closeSession(session);
3965 }
3966 }
3967
3968 return count.intValue();
3969 }
3970
3971
3979 public int countByC_DU(long companyId, boolean defaultUser)
3980 throws SystemException {
3981 Object[] finderArgs = new Object[] { companyId, defaultUser };
3982
3983 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_DU,
3984 finderArgs, this);
3985
3986 if (count == null) {
3987 Session session = null;
3988
3989 try {
3990 session = openSession();
3991
3992 StringBundler query = new StringBundler(3);
3993
3994 query.append(_SQL_COUNT_USER_WHERE);
3995
3996 query.append(_FINDER_COLUMN_C_DU_COMPANYID_2);
3997
3998 query.append(_FINDER_COLUMN_C_DU_DEFAULTUSER_2);
3999
4000 String sql = query.toString();
4001
4002 Query q = session.createQuery(sql);
4003
4004 QueryPos qPos = QueryPos.getInstance(q);
4005
4006 qPos.add(companyId);
4007
4008 qPos.add(defaultUser);
4009
4010 count = (Long)q.uniqueResult();
4011 }
4012 catch (Exception e) {
4013 throw processException(e);
4014 }
4015 finally {
4016 if (count == null) {
4017 count = Long.valueOf(0);
4018 }
4019
4020 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_DU,
4021 finderArgs, count);
4022
4023 closeSession(session);
4024 }
4025 }
4026
4027 return count.intValue();
4028 }
4029
4030
4038 public int countByC_SN(long companyId, String screenName)
4039 throws SystemException {
4040 Object[] finderArgs = new Object[] { companyId, screenName };
4041
4042 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_SN,
4043 finderArgs, this);
4044
4045 if (count == null) {
4046 Session session = null;
4047
4048 try {
4049 session = openSession();
4050
4051 StringBundler query = new StringBundler(3);
4052
4053 query.append(_SQL_COUNT_USER_WHERE);
4054
4055 query.append(_FINDER_COLUMN_C_SN_COMPANYID_2);
4056
4057 if (screenName == null) {
4058 query.append(_FINDER_COLUMN_C_SN_SCREENNAME_1);
4059 }
4060 else {
4061 if (screenName.equals(StringPool.BLANK)) {
4062 query.append(_FINDER_COLUMN_C_SN_SCREENNAME_3);
4063 }
4064 else {
4065 query.append(_FINDER_COLUMN_C_SN_SCREENNAME_2);
4066 }
4067 }
4068
4069 String sql = query.toString();
4070
4071 Query q = session.createQuery(sql);
4072
4073 QueryPos qPos = QueryPos.getInstance(q);
4074
4075 qPos.add(companyId);
4076
4077 if (screenName != null) {
4078 qPos.add(screenName);
4079 }
4080
4081 count = (Long)q.uniqueResult();
4082 }
4083 catch (Exception e) {
4084 throw processException(e);
4085 }
4086 finally {
4087 if (count == null) {
4088 count = Long.valueOf(0);
4089 }
4090
4091 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_SN,
4092 finderArgs, count);
4093
4094 closeSession(session);
4095 }
4096 }
4097
4098 return count.intValue();
4099 }
4100
4101
4109 public int countByC_EA(long companyId, String emailAddress)
4110 throws SystemException {
4111 Object[] finderArgs = new Object[] { companyId, emailAddress };
4112
4113 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_EA,
4114 finderArgs, this);
4115
4116 if (count == null) {
4117 Session session = null;
4118
4119 try {
4120 session = openSession();
4121
4122 StringBundler query = new StringBundler(3);
4123
4124 query.append(_SQL_COUNT_USER_WHERE);
4125
4126 query.append(_FINDER_COLUMN_C_EA_COMPANYID_2);
4127
4128 if (emailAddress == null) {
4129 query.append(_FINDER_COLUMN_C_EA_EMAILADDRESS_1);
4130 }
4131 else {
4132 if (emailAddress.equals(StringPool.BLANK)) {
4133 query.append(_FINDER_COLUMN_C_EA_EMAILADDRESS_3);
4134 }
4135 else {
4136 query.append(_FINDER_COLUMN_C_EA_EMAILADDRESS_2);
4137 }
4138 }
4139
4140 String sql = query.toString();
4141
4142 Query q = session.createQuery(sql);
4143
4144 QueryPos qPos = QueryPos.getInstance(q);
4145
4146 qPos.add(companyId);
4147
4148 if (emailAddress != null) {
4149 qPos.add(emailAddress);
4150 }
4151
4152 count = (Long)q.uniqueResult();
4153 }
4154 catch (Exception e) {
4155 throw processException(e);
4156 }
4157 finally {
4158 if (count == null) {
4159 count = Long.valueOf(0);
4160 }
4161
4162 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_EA,
4163 finderArgs, count);
4164
4165 closeSession(session);
4166 }
4167 }
4168
4169 return count.intValue();
4170 }
4171
4172
4180 public int countByC_FID(long companyId, long facebookId)
4181 throws SystemException {
4182 Object[] finderArgs = new Object[] { companyId, facebookId };
4183
4184 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_FID,
4185 finderArgs, this);
4186
4187 if (count == null) {
4188 Session session = null;
4189
4190 try {
4191 session = openSession();
4192
4193 StringBundler query = new StringBundler(3);
4194
4195 query.append(_SQL_COUNT_USER_WHERE);
4196
4197 query.append(_FINDER_COLUMN_C_FID_COMPANYID_2);
4198
4199 query.append(_FINDER_COLUMN_C_FID_FACEBOOKID_2);
4200
4201 String sql = query.toString();
4202
4203 Query q = session.createQuery(sql);
4204
4205 QueryPos qPos = QueryPos.getInstance(q);
4206
4207 qPos.add(companyId);
4208
4209 qPos.add(facebookId);
4210
4211 count = (Long)q.uniqueResult();
4212 }
4213 catch (Exception e) {
4214 throw processException(e);
4215 }
4216 finally {
4217 if (count == null) {
4218 count = Long.valueOf(0);
4219 }
4220
4221 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_FID,
4222 finderArgs, count);
4223
4224 closeSession(session);
4225 }
4226 }
4227
4228 return count.intValue();
4229 }
4230
4231
4239 public int countByC_O(long companyId, String openId)
4240 throws SystemException {
4241 Object[] finderArgs = new Object[] { companyId, openId };
4242
4243 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_O,
4244 finderArgs, this);
4245
4246 if (count == null) {
4247 Session session = null;
4248
4249 try {
4250 session = openSession();
4251
4252 StringBundler query = new StringBundler(3);
4253
4254 query.append(_SQL_COUNT_USER_WHERE);
4255
4256 query.append(_FINDER_COLUMN_C_O_COMPANYID_2);
4257
4258 if (openId == null) {
4259 query.append(_FINDER_COLUMN_C_O_OPENID_1);
4260 }
4261 else {
4262 if (openId.equals(StringPool.BLANK)) {
4263 query.append(_FINDER_COLUMN_C_O_OPENID_3);
4264 }
4265 else {
4266 query.append(_FINDER_COLUMN_C_O_OPENID_2);
4267 }
4268 }
4269
4270 String sql = query.toString();
4271
4272 Query q = session.createQuery(sql);
4273
4274 QueryPos qPos = QueryPos.getInstance(q);
4275
4276 qPos.add(companyId);
4277
4278 if (openId != null) {
4279 qPos.add(openId);
4280 }
4281
4282 count = (Long)q.uniqueResult();
4283 }
4284 catch (Exception e) {
4285 throw processException(e);
4286 }
4287 finally {
4288 if (count == null) {
4289 count = Long.valueOf(0);
4290 }
4291
4292 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_O, finderArgs,
4293 count);
4294
4295 closeSession(session);
4296 }
4297 }
4298
4299 return count.intValue();
4300 }
4301
4302
4310 public int countByC_A(long companyId, boolean active)
4311 throws SystemException {
4312 Object[] finderArgs = new Object[] { companyId, active };
4313
4314 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_A,
4315 finderArgs, this);
4316
4317 if (count == null) {
4318 Session session = null;
4319
4320 try {
4321 session = openSession();
4322
4323 StringBundler query = new StringBundler(3);
4324
4325 query.append(_SQL_COUNT_USER_WHERE);
4326
4327 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
4328
4329 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
4330
4331 String sql = query.toString();
4332
4333 Query q = session.createQuery(sql);
4334
4335 QueryPos qPos = QueryPos.getInstance(q);
4336
4337 qPos.add(companyId);
4338
4339 qPos.add(active);
4340
4341 count = (Long)q.uniqueResult();
4342 }
4343 catch (Exception e) {
4344 throw processException(e);
4345 }
4346 finally {
4347 if (count == null) {
4348 count = Long.valueOf(0);
4349 }
4350
4351 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_A, finderArgs,
4352 count);
4353
4354 closeSession(session);
4355 }
4356 }
4357
4358 return count.intValue();
4359 }
4360
4361
4367 public int countAll() throws SystemException {
4368 Object[] finderArgs = new Object[0];
4369
4370 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
4371 finderArgs, this);
4372
4373 if (count == null) {
4374 Session session = null;
4375
4376 try {
4377 session = openSession();
4378
4379 Query q = session.createQuery(_SQL_COUNT_USER);
4380
4381 count = (Long)q.uniqueResult();
4382 }
4383 catch (Exception e) {
4384 throw processException(e);
4385 }
4386 finally {
4387 if (count == null) {
4388 count = Long.valueOf(0);
4389 }
4390
4391 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
4392 count);
4393
4394 closeSession(session);
4395 }
4396 }
4397
4398 return count.intValue();
4399 }
4400
4401
4408 public List<com.liferay.portal.model.Group> getGroups(long pk)
4409 throws SystemException {
4410 return getGroups(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
4411 }
4412
4413
4426 public List<com.liferay.portal.model.Group> getGroups(long pk, int start,
4427 int end) throws SystemException {
4428 return getGroups(pk, start, end, null);
4429 }
4430
4431 public static final FinderPath FINDER_PATH_GET_GROUPS = new FinderPath(com.liferay.portal.model.impl.GroupModelImpl.ENTITY_CACHE_ENABLED,
4432 UserModelImpl.FINDER_CACHE_ENABLED_USERS_GROUPS,
4433 UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME, "getGroups",
4434 new String[] {
4435 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
4436 "com.liferay.portal.kernel.util.OrderByComparator"
4437 });
4438
4439
4453 public List<com.liferay.portal.model.Group> getGroups(long pk, int start,
4454 int end, OrderByComparator orderByComparator) throws SystemException {
4455 Object[] finderArgs = new Object[] {
4456 pk, String.valueOf(start), String.valueOf(end),
4457 String.valueOf(orderByComparator)
4458 };
4459
4460 List<com.liferay.portal.model.Group> list = (List<com.liferay.portal.model.Group>)FinderCacheUtil.getResult(FINDER_PATH_GET_GROUPS,
4461 finderArgs, this);
4462
4463 if (list == null) {
4464 Session session = null;
4465
4466 try {
4467 session = openSession();
4468
4469 String sql = null;
4470
4471 if (orderByComparator != null) {
4472 sql = _SQL_GETGROUPS.concat(ORDER_BY_CLAUSE)
4473 .concat(orderByComparator.getOrderBy());
4474 }
4475 else {
4476 sql = _SQL_GETGROUPS.concat(com.liferay.portal.model.impl.GroupModelImpl.ORDER_BY_SQL);
4477 }
4478
4479 SQLQuery q = session.createSQLQuery(sql);
4480
4481 q.addEntity("Group_",
4482 com.liferay.portal.model.impl.GroupImpl.class);
4483
4484 QueryPos qPos = QueryPos.getInstance(q);
4485
4486 qPos.add(pk);
4487
4488 list = (List<com.liferay.portal.model.Group>)QueryUtil.list(q,
4489 getDialect(), start, end);
4490 }
4491 catch (Exception e) {
4492 throw processException(e);
4493 }
4494 finally {
4495 if (list == null) {
4496 list = new ArrayList<com.liferay.portal.model.Group>();
4497 }
4498
4499 groupPersistence.cacheResult(list);
4500
4501 FinderCacheUtil.putResult(FINDER_PATH_GET_GROUPS, finderArgs,
4502 list);
4503
4504 closeSession(session);
4505 }
4506 }
4507
4508 return list;
4509 }
4510
4511 public static final FinderPath FINDER_PATH_GET_GROUPS_SIZE = new FinderPath(com.liferay.portal.model.impl.GroupModelImpl.ENTITY_CACHE_ENABLED,
4512 UserModelImpl.FINDER_CACHE_ENABLED_USERS_GROUPS,
4513 UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME, "getGroupsSize",
4514 new String[] { Long.class.getName() });
4515
4516
4523 public int getGroupsSize(long pk) throws SystemException {
4524 Object[] finderArgs = new Object[] { pk };
4525
4526 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_GROUPS_SIZE,
4527 finderArgs, this);
4528
4529 if (count == null) {
4530 Session session = null;
4531
4532 try {
4533 session = openSession();
4534
4535 SQLQuery q = session.createSQLQuery(_SQL_GETGROUPSSIZE);
4536
4537 q.addScalar(COUNT_COLUMN_NAME,
4538 com.liferay.portal.kernel.dao.orm.Type.LONG);
4539
4540 QueryPos qPos = QueryPos.getInstance(q);
4541
4542 qPos.add(pk);
4543
4544 count = (Long)q.uniqueResult();
4545 }
4546 catch (Exception e) {
4547 throw processException(e);
4548 }
4549 finally {
4550 if (count == null) {
4551 count = Long.valueOf(0);
4552 }
4553
4554 FinderCacheUtil.putResult(FINDER_PATH_GET_GROUPS_SIZE,
4555 finderArgs, count);
4556
4557 closeSession(session);
4558 }
4559 }
4560
4561 return count.intValue();
4562 }
4563
4564 public static final FinderPath FINDER_PATH_CONTAINS_GROUP = new FinderPath(com.liferay.portal.model.impl.GroupModelImpl.ENTITY_CACHE_ENABLED,
4565 UserModelImpl.FINDER_CACHE_ENABLED_USERS_GROUPS,
4566 UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME, "containsGroup",
4567 new String[] { Long.class.getName(), Long.class.getName() });
4568
4569
4577 public boolean containsGroup(long pk, long groupPK)
4578 throws SystemException {
4579 Object[] finderArgs = new Object[] { pk, groupPK };
4580
4581 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_GROUP,
4582 finderArgs, this);
4583
4584 if (value == null) {
4585 try {
4586 value = Boolean.valueOf(containsGroup.contains(pk, groupPK));
4587 }
4588 catch (Exception e) {
4589 throw processException(e);
4590 }
4591 finally {
4592 if (value == null) {
4593 value = Boolean.FALSE;
4594 }
4595
4596 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_GROUP,
4597 finderArgs, value);
4598 }
4599 }
4600
4601 return value.booleanValue();
4602 }
4603
4604
4611 public boolean containsGroups(long pk) throws SystemException {
4612 if (getGroupsSize(pk) > 0) {
4613 return true;
4614 }
4615 else {
4616 return false;
4617 }
4618 }
4619
4620
4627 public void addGroup(long pk, long groupPK) throws SystemException {
4628 try {
4629 addGroup.add(pk, groupPK);
4630 }
4631 catch (Exception e) {
4632 throw processException(e);
4633 }
4634 finally {
4635 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
4636 }
4637 }
4638
4639
4646 public void addGroup(long pk, com.liferay.portal.model.Group group)
4647 throws SystemException {
4648 try {
4649 addGroup.add(pk, group.getPrimaryKey());
4650 }
4651 catch (Exception e) {
4652 throw processException(e);
4653 }
4654 finally {
4655 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
4656 }
4657 }
4658
4659
4666 public void addGroups(long pk, long[] groupPKs) throws SystemException {
4667 try {
4668 for (long groupPK : groupPKs) {
4669 addGroup.add(pk, groupPK);
4670 }
4671 }
4672 catch (Exception e) {
4673 throw processException(e);
4674 }
4675 finally {
4676 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
4677 }
4678 }
4679
4680
4687 public void addGroups(long pk, List<com.liferay.portal.model.Group> groups)
4688 throws SystemException {
4689 try {
4690 for (com.liferay.portal.model.Group group : groups) {
4691 addGroup.add(pk, group.getPrimaryKey());
4692 }
4693 }
4694 catch (Exception e) {
4695 throw processException(e);
4696 }
4697 finally {
4698 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
4699 }
4700 }
4701
4702
4708 public void clearGroups(long pk) throws SystemException {
4709 try {
4710 clearGroups.clear(pk);
4711 }
4712 catch (Exception e) {
4713 throw processException(e);
4714 }
4715 finally {
4716 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
4717 }
4718 }
4719
4720
4727 public void removeGroup(long pk, long groupPK) throws SystemException {
4728 try {
4729 removeGroup.remove(pk, groupPK);
4730 }
4731 catch (Exception e) {
4732 throw processException(e);
4733 }
4734 finally {
4735 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
4736 }
4737 }
4738
4739
4746 public void removeGroup(long pk, com.liferay.portal.model.Group group)
4747 throws SystemException {
4748 try {
4749 removeGroup.remove(pk, group.getPrimaryKey());
4750 }
4751 catch (Exception e) {
4752 throw processException(e);
4753 }
4754 finally {
4755 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
4756 }
4757 }
4758
4759
4766 public void removeGroups(long pk, long[] groupPKs)
4767 throws SystemException {
4768 try {
4769 for (long groupPK : groupPKs) {
4770 removeGroup.remove(pk, groupPK);
4771 }
4772 }
4773 catch (Exception e) {
4774 throw processException(e);
4775 }
4776 finally {
4777 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
4778 }
4779 }
4780
4781
4788 public void removeGroups(long pk,
4789 List<com.liferay.portal.model.Group> groups) throws SystemException {
4790 try {
4791 for (com.liferay.portal.model.Group group : groups) {
4792 removeGroup.remove(pk, group.getPrimaryKey());
4793 }
4794 }
4795 catch (Exception e) {
4796 throw processException(e);
4797 }
4798 finally {
4799 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
4800 }
4801 }
4802
4803
4810 public void setGroups(long pk, long[] groupPKs) throws SystemException {
4811 try {
4812 Set<Long> groupPKSet = SetUtil.fromArray(groupPKs);
4813
4814 List<com.liferay.portal.model.Group> groups = getGroups(pk);
4815
4816 for (com.liferay.portal.model.Group group : groups) {
4817 if (!groupPKSet.remove(group.getPrimaryKey())) {
4818 removeGroup.remove(pk, group.getPrimaryKey());
4819 }
4820 }
4821
4822 for (Long groupPK : groupPKSet) {
4823 addGroup.add(pk, groupPK);
4824 }
4825 }
4826 catch (Exception e) {
4827 throw processException(e);
4828 }
4829 finally {
4830 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
4831 }
4832 }
4833
4834
4841 public void setGroups(long pk, List<com.liferay.portal.model.Group> groups)
4842 throws SystemException {
4843 try {
4844 long[] groupPKs = new long[groups.size()];
4845
4846 for (int i = 0; i < groups.size(); i++) {
4847 com.liferay.portal.model.Group group = groups.get(i);
4848
4849 groupPKs[i] = group.getPrimaryKey();
4850 }
4851
4852 setGroups(pk, groupPKs);
4853 }
4854 catch (Exception e) {
4855 throw processException(e);
4856 }
4857 finally {
4858 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
4859 }
4860 }
4861
4862
4869 public List<com.liferay.portal.model.Organization> getOrganizations(long pk)
4870 throws SystemException {
4871 return getOrganizations(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
4872 }
4873
4874
4887 public List<com.liferay.portal.model.Organization> getOrganizations(
4888 long pk, int start, int end) throws SystemException {
4889 return getOrganizations(pk, start, end, null);
4890 }
4891
4892 public static final FinderPath FINDER_PATH_GET_ORGANIZATIONS = new FinderPath(com.liferay.portal.model.impl.OrganizationModelImpl.ENTITY_CACHE_ENABLED,
4893 UserModelImpl.FINDER_CACHE_ENABLED_USERS_ORGS,
4894 UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME, "getOrganizations",
4895 new String[] {
4896 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
4897 "com.liferay.portal.kernel.util.OrderByComparator"
4898 });
4899
4900
4914 public List<com.liferay.portal.model.Organization> getOrganizations(
4915 long pk, int start, int end, OrderByComparator orderByComparator)
4916 throws SystemException {
4917 Object[] finderArgs = new Object[] {
4918 pk, String.valueOf(start), String.valueOf(end),
4919 String.valueOf(orderByComparator)
4920 };
4921
4922 List<com.liferay.portal.model.Organization> list = (List<com.liferay.portal.model.Organization>)FinderCacheUtil.getResult(FINDER_PATH_GET_ORGANIZATIONS,
4923 finderArgs, this);
4924
4925 if (list == null) {
4926 Session session = null;
4927
4928 try {
4929 session = openSession();
4930
4931 String sql = null;
4932
4933 if (orderByComparator != null) {
4934 sql = _SQL_GETORGANIZATIONS.concat(ORDER_BY_CLAUSE)
4935 .concat(orderByComparator.getOrderBy());
4936 }
4937 else {
4938 sql = _SQL_GETORGANIZATIONS.concat(com.liferay.portal.model.impl.OrganizationModelImpl.ORDER_BY_SQL);
4939 }
4940
4941 SQLQuery q = session.createSQLQuery(sql);
4942
4943 q.addEntity("Organization_",
4944 com.liferay.portal.model.impl.OrganizationImpl.class);
4945
4946 QueryPos qPos = QueryPos.getInstance(q);
4947
4948 qPos.add(pk);
4949
4950 list = (List<com.liferay.portal.model.Organization>)QueryUtil.list(q,
4951 getDialect(), start, end);
4952 }
4953 catch (Exception e) {
4954 throw processException(e);
4955 }
4956 finally {
4957 if (list == null) {
4958 list = new ArrayList<com.liferay.portal.model.Organization>();
4959 }
4960
4961 organizationPersistence.cacheResult(list);
4962
4963 FinderCacheUtil.putResult(FINDER_PATH_GET_ORGANIZATIONS,
4964 finderArgs, list);
4965
4966 closeSession(session);
4967 }
4968 }
4969
4970 return list;
4971 }
4972
4973 public static final FinderPath FINDER_PATH_GET_ORGANIZATIONS_SIZE = new FinderPath(com.liferay.portal.model.impl.OrganizationModelImpl.ENTITY_CACHE_ENABLED,
4974 UserModelImpl.FINDER_CACHE_ENABLED_USERS_ORGS,
4975 UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME,
4976 "getOrganizationsSize", new String[] { Long.class.getName() });
4977
4978
4985 public int getOrganizationsSize(long pk) throws SystemException {
4986 Object[] finderArgs = new Object[] { pk };
4987
4988 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_ORGANIZATIONS_SIZE,
4989 finderArgs, this);
4990
4991 if (count == null) {
4992 Session session = null;
4993
4994 try {
4995 session = openSession();
4996
4997 SQLQuery q = session.createSQLQuery(_SQL_GETORGANIZATIONSSIZE);
4998
4999 q.addScalar(COUNT_COLUMN_NAME,
5000 com.liferay.portal.kernel.dao.orm.Type.LONG);
5001
5002 QueryPos qPos = QueryPos.getInstance(q);
5003
5004 qPos.add(pk);
5005
5006 count = (Long)q.uniqueResult();
5007 }
5008 catch (Exception e) {
5009 throw processException(e);
5010 }
5011 finally {
5012 if (count == null) {
5013 count = Long.valueOf(0);
5014 }
5015
5016 FinderCacheUtil.putResult(FINDER_PATH_GET_ORGANIZATIONS_SIZE,
5017 finderArgs, count);
5018
5019 closeSession(session);
5020 }
5021 }
5022
5023 return count.intValue();
5024 }
5025
5026 public static final FinderPath FINDER_PATH_CONTAINS_ORGANIZATION = new FinderPath(com.liferay.portal.model.impl.OrganizationModelImpl.ENTITY_CACHE_ENABLED,
5027 UserModelImpl.FINDER_CACHE_ENABLED_USERS_ORGS,
5028 UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME,
5029 "containsOrganization",
5030 new String[] { Long.class.getName(), Long.class.getName() });
5031
5032
5040 public boolean containsOrganization(long pk, long organizationPK)
5041 throws SystemException {
5042 Object[] finderArgs = new Object[] { pk, organizationPK };
5043
5044 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_ORGANIZATION,
5045 finderArgs, this);
5046
5047 if (value == null) {
5048 try {
5049 value = Boolean.valueOf(containsOrganization.contains(pk,
5050 organizationPK));
5051 }
5052 catch (Exception e) {
5053 throw processException(e);
5054 }
5055 finally {
5056 if (value == null) {
5057 value = Boolean.FALSE;
5058 }
5059
5060 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_ORGANIZATION,
5061 finderArgs, value);
5062 }
5063 }
5064
5065 return value.booleanValue();
5066 }
5067
5068
5075 public boolean containsOrganizations(long pk) throws SystemException {
5076 if (getOrganizationsSize(pk) > 0) {
5077 return true;
5078 }
5079 else {
5080 return false;
5081 }
5082 }
5083
5084
5091 public void addOrganization(long pk, long organizationPK)
5092 throws SystemException {
5093 try {
5094 addOrganization.add(pk, organizationPK);
5095 }
5096 catch (Exception e) {
5097 throw processException(e);
5098 }
5099 finally {
5100 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
5101 }
5102 }
5103
5104
5111 public void addOrganization(long pk,
5112 com.liferay.portal.model.Organization organization)
5113 throws SystemException {
5114 try {
5115 addOrganization.add(pk, organization.getPrimaryKey());
5116 }
5117 catch (Exception e) {
5118 throw processException(e);
5119 }
5120 finally {
5121 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
5122 }
5123 }
5124
5125
5132 public void addOrganizations(long pk, long[] organizationPKs)
5133 throws SystemException {
5134 try {
5135 for (long organizationPK : organizationPKs) {
5136 addOrganization.add(pk, organizationPK);
5137 }
5138 }
5139 catch (Exception e) {
5140 throw processException(e);
5141 }
5142 finally {
5143 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
5144 }
5145 }
5146
5147
5154 public void addOrganizations(long pk,
5155 List<com.liferay.portal.model.Organization> organizations)
5156 throws SystemException {
5157 try {
5158 for (com.liferay.portal.model.Organization organization : organizations) {
5159 addOrganization.add(pk, organization.getPrimaryKey());
5160 }
5161 }
5162 catch (Exception e) {
5163 throw processException(e);
5164 }
5165 finally {
5166 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
5167 }
5168 }
5169
5170
5176 public void clearOrganizations(long pk) throws SystemException {
5177 try {
5178 clearOrganizations.clear(pk);
5179 }
5180 catch (Exception e) {
5181 throw processException(e);
5182 }
5183 finally {
5184 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
5185 }
5186 }
5187
5188
5195 public void removeOrganization(long pk, long organizationPK)
5196 throws SystemException {
5197 try {
5198 removeOrganization.remove(pk, organizationPK);
5199 }
5200 catch (Exception e) {
5201 throw processException(e);
5202 }
5203 finally {
5204 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
5205 }
5206 }
5207
5208
5215 public void removeOrganization(long pk,
5216 com.liferay.portal.model.Organization organization)
5217 throws SystemException {
5218 try {
5219 removeOrganization.remove(pk, organization.getPrimaryKey());
5220 }
5221 catch (Exception e) {
5222 throw processException(e);
5223 }
5224 finally {
5225 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
5226 }
5227 }
5228
5229
5236 public void removeOrganizations(long pk, long[] organizationPKs)
5237 throws SystemException {
5238 try {
5239 for (long organizationPK : organizationPKs) {
5240 removeOrganization.remove(pk, organizationPK);
5241 }
5242 }
5243 catch (Exception e) {
5244 throw processException(e);
5245 }
5246 finally {
5247 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
5248 }
5249 }
5250
5251
5258 public void removeOrganizations(long pk,
5259 List<com.liferay.portal.model.Organization> organizations)
5260 throws SystemException {
5261 try {
5262 for (com.liferay.portal.model.Organization organization : organizations) {
5263 removeOrganization.remove(pk, organization.getPrimaryKey());
5264 }
5265 }
5266 catch (Exception e) {
5267 throw processException(e);
5268 }
5269 finally {
5270 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
5271 }
5272 }
5273
5274
5281 public void setOrganizations(long pk, long[] organizationPKs)
5282 throws SystemException {
5283 try {
5284 Set<Long> organizationPKSet = SetUtil.fromArray(organizationPKs);
5285
5286 List<com.liferay.portal.model.Organization> organizations = getOrganizations(pk);
5287
5288 for (com.liferay.portal.model.Organization organization : organizations) {
5289 if (!organizationPKSet.remove(organization.getPrimaryKey())) {
5290 removeOrganization.remove(pk, organization.getPrimaryKey());
5291 }
5292 }
5293
5294 for (Long organizationPK : organizationPKSet) {
5295 addOrganization.add(pk, organizationPK);
5296 }
5297 }
5298 catch (Exception e) {
5299 throw processException(e);
5300 }
5301 finally {
5302 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
5303 }
5304 }
5305
5306
5313 public void setOrganizations(long pk,
5314 List<com.liferay.portal.model.Organization> organizations)
5315 throws SystemException {
5316 try {
5317 long[] organizationPKs = new long[organizations.size()];
5318
5319 for (int i = 0; i < organizations.size(); i++) {
5320 com.liferay.portal.model.Organization organization = organizations.get(i);
5321
5322 organizationPKs[i] = organization.getPrimaryKey();
5323 }
5324
5325 setOrganizations(pk, organizationPKs);
5326 }
5327 catch (Exception e) {
5328 throw processException(e);
5329 }
5330 finally {
5331 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
5332 }
5333 }
5334
5335
5342 public List<com.liferay.portal.model.Permission> getPermissions(long pk)
5343 throws SystemException {
5344 return getPermissions(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
5345 }
5346
5347
5360 public List<com.liferay.portal.model.Permission> getPermissions(long pk,
5361 int start, int end) throws SystemException {
5362 return getPermissions(pk, start, end, null);
5363 }
5364
5365 public static final FinderPath FINDER_PATH_GET_PERMISSIONS = new FinderPath(com.liferay.portal.model.impl.PermissionModelImpl.ENTITY_CACHE_ENABLED,
5366 UserModelImpl.FINDER_CACHE_ENABLED_USERS_PERMISSIONS,
5367 UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME,
5368 "getPermissions",
5369 new String[] {
5370 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
5371 "com.liferay.portal.kernel.util.OrderByComparator"
5372 });
5373
5374
5388 public List<com.liferay.portal.model.Permission> getPermissions(long pk,
5389 int start, int end, OrderByComparator orderByComparator)
5390 throws SystemException {
5391 Object[] finderArgs = new Object[] {
5392 pk, String.valueOf(start), String.valueOf(end),
5393 String.valueOf(orderByComparator)
5394 };
5395
5396 List<com.liferay.portal.model.Permission> list = (List<com.liferay.portal.model.Permission>)FinderCacheUtil.getResult(FINDER_PATH_GET_PERMISSIONS,
5397 finderArgs, this);
5398
5399 if (list == null) {
5400 Session session = null;
5401
5402 try {
5403 session = openSession();
5404
5405 String sql = null;
5406
5407 if (orderByComparator != null) {
5408 sql = _SQL_GETPERMISSIONS.concat(ORDER_BY_CLAUSE)
5409 .concat(orderByComparator.getOrderBy());
5410 }
5411 else {
5412 sql = _SQL_GETPERMISSIONS;
5413 }
5414
5415 SQLQuery q = session.createSQLQuery(sql);
5416
5417 q.addEntity("Permission_",
5418 com.liferay.portal.model.impl.PermissionImpl.class);
5419
5420 QueryPos qPos = QueryPos.getInstance(q);
5421
5422 qPos.add(pk);
5423
5424 list = (List<com.liferay.portal.model.Permission>)QueryUtil.list(q,
5425 getDialect(), start, end);
5426 }
5427 catch (Exception e) {
5428 throw processException(e);
5429 }
5430 finally {
5431 if (list == null) {
5432 list = new ArrayList<com.liferay.portal.model.Permission>();
5433 }
5434
5435 permissionPersistence.cacheResult(list);
5436
5437 FinderCacheUtil.putResult(FINDER_PATH_GET_PERMISSIONS,
5438 finderArgs, list);
5439
5440 closeSession(session);
5441 }
5442 }
5443
5444 return list;
5445 }
5446
5447 public static final FinderPath FINDER_PATH_GET_PERMISSIONS_SIZE = new FinderPath(com.liferay.portal.model.impl.PermissionModelImpl.ENTITY_CACHE_ENABLED,
5448 UserModelImpl.FINDER_CACHE_ENABLED_USERS_PERMISSIONS,
5449 UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME,
5450 "getPermissionsSize", new String[] { Long.class.getName() });
5451
5452
5459 public int getPermissionsSize(long pk) throws SystemException {
5460 Object[] finderArgs = new Object[] { pk };
5461
5462 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_PERMISSIONS_SIZE,
5463 finderArgs, this);
5464
5465 if (count == null) {
5466 Session session = null;
5467
5468 try {
5469 session = openSession();
5470
5471 SQLQuery q = session.createSQLQuery(_SQL_GETPERMISSIONSSIZE);
5472
5473 q.addScalar(COUNT_COLUMN_NAME,
5474 com.liferay.portal.kernel.dao.orm.Type.LONG);
5475
5476 QueryPos qPos = QueryPos.getInstance(q);
5477
5478 qPos.add(pk);
5479
5480 count = (Long)q.uniqueResult();
5481 }
5482 catch (Exception e) {
5483 throw processException(e);
5484 }
5485 finally {
5486 if (count == null) {
5487 count = Long.valueOf(0);
5488 }
5489
5490 FinderCacheUtil.putResult(FINDER_PATH_GET_PERMISSIONS_SIZE,
5491 finderArgs, count);
5492
5493 closeSession(session);
5494 }
5495 }
5496
5497 return count.intValue();
5498 }
5499
5500 public static final FinderPath FINDER_PATH_CONTAINS_PERMISSION = new FinderPath(com.liferay.portal.model.impl.PermissionModelImpl.ENTITY_CACHE_ENABLED,
5501 UserModelImpl.FINDER_CACHE_ENABLED_USERS_PERMISSIONS,
5502 UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME,
5503 "containsPermission",
5504 new String[] { Long.class.getName(), Long.class.getName() });
5505
5506
5514 public boolean containsPermission(long pk, long permissionPK)
5515 throws SystemException {
5516 Object[] finderArgs = new Object[] { pk, permissionPK };
5517
5518 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_PERMISSION,
5519 finderArgs, this);
5520
5521 if (value == null) {
5522 try {
5523 value = Boolean.valueOf(containsPermission.contains(pk,
5524 permissionPK));
5525 }
5526 catch (Exception e) {
5527 throw processException(e);
5528 }
5529 finally {
5530 if (value == null) {
5531 value = Boolean.FALSE;
5532 }
5533
5534 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_PERMISSION,
5535 finderArgs, value);
5536 }
5537 }
5538
5539 return value.booleanValue();
5540 }
5541
5542
5549 public boolean containsPermissions(long pk) throws SystemException {
5550 if (getPermissionsSize(pk) > 0) {
5551 return true;
5552 }
5553 else {
5554 return false;
5555 }
5556 }
5557
5558
5565 public void addPermission(long pk, long permissionPK)
5566 throws SystemException {
5567 try {
5568 addPermission.add(pk, permissionPK);
5569 }
5570 catch (Exception e) {
5571 throw processException(e);
5572 }
5573 finally {
5574 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
5575 }
5576 }
5577
5578
5585 public void addPermission(long pk,
5586 com.liferay.portal.model.Permission permission)
5587 throws SystemException {
5588 try {
5589 addPermission.add(pk, permission.getPrimaryKey());
5590 }
5591 catch (Exception e) {
5592 throw processException(e);
5593 }
5594 finally {
5595 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
5596 }
5597 }
5598
5599
5606 public void addPermissions(long pk, long[] permissionPKs)
5607 throws SystemException {
5608 try {
5609 for (long permissionPK : permissionPKs) {
5610 addPermission.add(pk, permissionPK);
5611 }
5612 }
5613 catch (Exception e) {
5614 throw processException(e);
5615 }
5616 finally {
5617 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
5618 }
5619 }
5620
5621
5628 public void addPermissions(long pk,
5629 List<com.liferay.portal.model.Permission> permissions)
5630 throws SystemException {
5631 try {
5632 for (com.liferay.portal.model.Permission permission : permissions) {
5633 addPermission.add(pk, permission.getPrimaryKey());
5634 }
5635 }
5636 catch (Exception e) {
5637 throw processException(e);
5638 }
5639 finally {
5640 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
5641 }
5642 }
5643
5644
5650 public void clearPermissions(long pk) throws SystemException {
5651 try {
5652 clearPermissions.clear(pk);
5653 }
5654 catch (Exception e) {
5655 throw processException(e);
5656 }
5657 finally {
5658 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
5659 }
5660 }
5661
5662
5669 public void removePermission(long pk, long permissionPK)
5670 throws SystemException {
5671 try {
5672 removePermission.remove(pk, permissionPK);
5673 }
5674 catch (Exception e) {
5675 throw processException(e);
5676 }
5677 finally {
5678 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
5679 }
5680 }
5681
5682
5689 public void removePermission(long pk,
5690 com.liferay.portal.model.Permission permission)
5691 throws SystemException {
5692 try {
5693 removePermission.remove(pk, permission.getPrimaryKey());
5694 }
5695 catch (Exception e) {
5696 throw processException(e);
5697 }
5698 finally {
5699 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
5700 }
5701 }
5702
5703
5710 public void removePermissions(long pk, long[] permissionPKs)
5711 throws SystemException {
5712 try {
5713 for (long permissionPK : permissionPKs) {
5714 removePermission.remove(pk, permissionPK);
5715 }
5716 }
5717 catch (Exception e) {
5718 throw processException(e);
5719 }
5720 finally {
5721 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
5722 }
5723 }
5724
5725
5732 public void removePermissions(long pk,
5733 List<com.liferay.portal.model.Permission> permissions)
5734 throws SystemException {
5735 try {
5736 for (com.liferay.portal.model.Permission permission : permissions) {
5737 removePermission.remove(pk, permission.getPrimaryKey());
5738 }
5739 }
5740 catch (Exception e) {
5741 throw processException(e);
5742 }
5743 finally {
5744 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
5745 }
5746 }
5747
5748
5755 public void setPermissions(long pk, long[] permissionPKs)
5756 throws SystemException {
5757 try {
5758 Set<Long> permissionPKSet = SetUtil.fromArray(permissionPKs);
5759
5760 List<com.liferay.portal.model.Permission> permissions = getPermissions(pk);
5761
5762 for (com.liferay.portal.model.Permission permission : permissions) {
5763 if (!permissionPKSet.remove(permission.getPrimaryKey())) {
5764 removePermission.remove(pk, permission.getPrimaryKey());
5765 }
5766 }
5767
5768 for (Long permissionPK : permissionPKSet) {
5769 addPermission.add(pk, permissionPK);
5770 }
5771 }
5772 catch (Exception e) {
5773 throw processException(e);
5774 }
5775 finally {
5776 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
5777 }
5778 }
5779
5780
5787 public void setPermissions(long pk,
5788 List<com.liferay.portal.model.Permission> permissions)
5789 throws SystemException {
5790 try {
5791 long[] permissionPKs = new long[permissions.size()];
5792
5793 for (int i = 0; i < permissions.size(); i++) {
5794 com.liferay.portal.model.Permission permission = permissions.get(i);
5795
5796 permissionPKs[i] = permission.getPrimaryKey();
5797 }
5798
5799 setPermissions(pk, permissionPKs);
5800 }
5801 catch (Exception e) {
5802 throw processException(e);
5803 }
5804 finally {
5805 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
5806 }
5807 }
5808
5809
5816 public List<com.liferay.portal.model.Role> getRoles(long pk)
5817 throws SystemException {
5818 return getRoles(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
5819 }
5820
5821
5834 public List<com.liferay.portal.model.Role> getRoles(long pk, int start,
5835 int end) throws SystemException {
5836 return getRoles(pk, start, end, null);
5837 }
5838
5839 public static final FinderPath FINDER_PATH_GET_ROLES = new FinderPath(com.liferay.portal.model.impl.RoleModelImpl.ENTITY_CACHE_ENABLED,
5840 UserModelImpl.FINDER_CACHE_ENABLED_USERS_ROLES,
5841 UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME, "getRoles",
5842 new String[] {
5843 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
5844 "com.liferay.portal.kernel.util.OrderByComparator"
5845 });
5846
5847
5861 public List<com.liferay.portal.model.Role> getRoles(long pk, int start,
5862 int end, OrderByComparator orderByComparator) throws SystemException {
5863 Object[] finderArgs = new Object[] {
5864 pk, String.valueOf(start), String.valueOf(end),
5865 String.valueOf(orderByComparator)
5866 };
5867
5868 List<com.liferay.portal.model.Role> list = (List<com.liferay.portal.model.Role>)FinderCacheUtil.getResult(FINDER_PATH_GET_ROLES,
5869 finderArgs, this);
5870
5871 if (list == null) {
5872 Session session = null;
5873
5874 try {
5875 session = openSession();
5876
5877 String sql = null;
5878
5879 if (orderByComparator != null) {
5880 sql = _SQL_GETROLES.concat(ORDER_BY_CLAUSE)
5881 .concat(orderByComparator.getOrderBy());
5882 }
5883 else {
5884 sql = _SQL_GETROLES.concat(com.liferay.portal.model.impl.RoleModelImpl.ORDER_BY_SQL);
5885 }
5886
5887 SQLQuery q = session.createSQLQuery(sql);
5888
5889 q.addEntity("Role_",
5890 com.liferay.portal.model.impl.RoleImpl.class);
5891
5892 QueryPos qPos = QueryPos.getInstance(q);
5893
5894 qPos.add(pk);
5895
5896 list = (List<com.liferay.portal.model.Role>)QueryUtil.list(q,
5897 getDialect(), start, end);
5898 }
5899 catch (Exception e) {
5900 throw processException(e);
5901 }
5902 finally {
5903 if (list == null) {
5904 list = new ArrayList<com.liferay.portal.model.Role>();
5905 }
5906
5907 rolePersistence.cacheResult(list);
5908
5909 FinderCacheUtil.putResult(FINDER_PATH_GET_ROLES, finderArgs,
5910 list);
5911
5912 closeSession(session);
5913 }
5914 }
5915
5916 return list;
5917 }
5918
5919 public static final FinderPath FINDER_PATH_GET_ROLES_SIZE = new FinderPath(com.liferay.portal.model.impl.RoleModelImpl.ENTITY_CACHE_ENABLED,
5920 UserModelImpl.FINDER_CACHE_ENABLED_USERS_ROLES,
5921 UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME, "getRolesSize",
5922 new String[] { Long.class.getName() });
5923
5924
5931 public int getRolesSize(long pk) throws SystemException {
5932 Object[] finderArgs = new Object[] { pk };
5933
5934 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_ROLES_SIZE,
5935 finderArgs, this);
5936
5937 if (count == null) {
5938 Session session = null;
5939
5940 try {
5941 session = openSession();
5942
5943 SQLQuery q = session.createSQLQuery(_SQL_GETROLESSIZE);
5944
5945 q.addScalar(COUNT_COLUMN_NAME,
5946 com.liferay.portal.kernel.dao.orm.Type.LONG);
5947
5948 QueryPos qPos = QueryPos.getInstance(q);
5949
5950 qPos.add(pk);
5951
5952 count = (Long)q.uniqueResult();
5953 }
5954 catch (Exception e) {
5955 throw processException(e);
5956 }
5957 finally {
5958 if (count == null) {
5959 count = Long.valueOf(0);
5960 }
5961
5962 FinderCacheUtil.putResult(FINDER_PATH_GET_ROLES_SIZE,
5963 finderArgs, count);
5964
5965 closeSession(session);
5966 }
5967 }
5968
5969 return count.intValue();
5970 }
5971
5972 public static final FinderPath FINDER_PATH_CONTAINS_ROLE = new FinderPath(com.liferay.portal.model.impl.RoleModelImpl.ENTITY_CACHE_ENABLED,
5973 UserModelImpl.FINDER_CACHE_ENABLED_USERS_ROLES,
5974 UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME, "containsRole",
5975 new String[] { Long.class.getName(), Long.class.getName() });
5976
5977
5985 public boolean containsRole(long pk, long rolePK) throws SystemException {
5986 Object[] finderArgs = new Object[] { pk, rolePK };
5987
5988 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_ROLE,
5989 finderArgs, this);
5990
5991 if (value == null) {
5992 try {
5993 value = Boolean.valueOf(containsRole.contains(pk, rolePK));
5994 }
5995 catch (Exception e) {
5996 throw processException(e);
5997 }
5998 finally {
5999 if (value == null) {
6000 value = Boolean.FALSE;
6001 }
6002
6003 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_ROLE,
6004 finderArgs, value);
6005 }
6006 }
6007
6008 return value.booleanValue();
6009 }
6010
6011
6018 public boolean containsRoles(long pk) throws SystemException {
6019 if (getRolesSize(pk) > 0) {
6020 return true;
6021 }
6022 else {
6023 return false;
6024 }
6025 }
6026
6027
6034 public void addRole(long pk, long rolePK) throws SystemException {
6035 try {
6036 addRole.add(pk, rolePK);
6037 }
6038 catch (Exception e) {
6039 throw processException(e);
6040 }
6041 finally {
6042 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
6043 }
6044 }
6045
6046
6053 public void addRole(long pk, com.liferay.portal.model.Role role)
6054 throws SystemException {
6055 try {
6056 addRole.add(pk, role.getPrimaryKey());
6057 }
6058 catch (Exception e) {
6059 throw processException(e);
6060 }
6061 finally {
6062 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
6063 }
6064 }
6065
6066
6073 public void addRoles(long pk, long[] rolePKs) throws SystemException {
6074 try {
6075 for (long rolePK : rolePKs) {
6076 addRole.add(pk, rolePK);
6077 }
6078 }
6079 catch (Exception e) {
6080 throw processException(e);
6081 }
6082 finally {
6083 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
6084 }
6085 }
6086
6087
6094 public void addRoles(long pk, List<com.liferay.portal.model.Role> roles)
6095 throws SystemException {
6096 try {
6097 for (com.liferay.portal.model.Role role : roles) {
6098 addRole.add(pk, role.getPrimaryKey());
6099 }
6100 }
6101 catch (Exception e) {
6102 throw processException(e);
6103 }
6104 finally {
6105 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
6106 }
6107 }
6108
6109
6115 public void clearRoles(long pk) throws SystemException {
6116 try {
6117 clearRoles.clear(pk);
6118 }
6119 catch (Exception e) {
6120 throw processException(e);
6121 }
6122 finally {
6123 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
6124 }
6125 }
6126
6127
6134 public void removeRole(long pk, long rolePK) throws SystemException {
6135 try {
6136 removeRole.remove(pk, rolePK);
6137 }
6138 catch (Exception e) {
6139 throw processException(e);
6140 }
6141 finally {
6142 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
6143 }
6144 }
6145
6146
6153 public void removeRole(long pk, com.liferay.portal.model.Role role)
6154 throws SystemException {
6155 try {
6156 removeRole.remove(pk, role.getPrimaryKey());
6157 }
6158 catch (Exception e) {
6159 throw processException(e);
6160 }
6161 finally {
6162 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
6163 }
6164 }
6165
6166
6173 public void removeRoles(long pk, long[] rolePKs) throws SystemException {
6174 try {
6175 for (long rolePK : rolePKs) {
6176 removeRole.remove(pk, rolePK);
6177 }
6178 }
6179 catch (Exception e) {
6180 throw processException(e);
6181 }
6182 finally {
6183 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
6184 }
6185 }
6186
6187
6194 public void removeRoles(long pk, List<com.liferay.portal.model.Role> roles)
6195 throws SystemException {
6196 try {
6197 for (com.liferay.portal.model.Role role : roles) {
6198 removeRole.remove(pk, role.getPrimaryKey());
6199 }
6200 }
6201 catch (Exception e) {
6202 throw processException(e);
6203 }
6204 finally {
6205 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
6206 }
6207 }
6208
6209
6216 public void setRoles(long pk, long[] rolePKs) throws SystemException {
6217 try {
6218 Set<Long> rolePKSet = SetUtil.fromArray(rolePKs);
6219
6220 List<com.liferay.portal.model.Role> roles = getRoles(pk);
6221
6222 for (com.liferay.portal.model.Role role : roles) {
6223 if (!rolePKSet.remove(role.getPrimaryKey())) {
6224 removeRole.remove(pk, role.getPrimaryKey());
6225 }
6226 }
6227
6228 for (Long rolePK : rolePKSet) {
6229 addRole.add(pk, rolePK);
6230 }
6231 }
6232 catch (Exception e) {
6233 throw processException(e);
6234 }
6235 finally {
6236 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
6237 }
6238 }
6239
6240
6247 public void setRoles(long pk, List<com.liferay.portal.model.Role> roles)
6248 throws SystemException {
6249 try {
6250 long[] rolePKs = new long[roles.size()];
6251
6252 for (int i = 0; i < roles.size(); i++) {
6253 com.liferay.portal.model.Role role = roles.get(i);
6254
6255 rolePKs[i] = role.getPrimaryKey();
6256 }
6257
6258 setRoles(pk, rolePKs);
6259 }
6260 catch (Exception e) {
6261 throw processException(e);
6262 }
6263 finally {
6264 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
6265 }
6266 }
6267
6268
6275 public List<com.liferay.portal.model.Team> getTeams(long pk)
6276 throws SystemException {
6277 return getTeams(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
6278 }
6279
6280
6293 public List<com.liferay.portal.model.Team> getTeams(long pk, int start,
6294 int end) throws SystemException {
6295 return getTeams(pk, start, end, null);
6296 }
6297
6298 public static final FinderPath FINDER_PATH_GET_TEAMS = new FinderPath(com.liferay.portal.model.impl.TeamModelImpl.ENTITY_CACHE_ENABLED,
6299 UserModelImpl.FINDER_CACHE_ENABLED_USERS_TEAMS,
6300 UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME, "getTeams",
6301 new String[] {
6302 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
6303 "com.liferay.portal.kernel.util.OrderByComparator"
6304 });
6305
6306
6320 public List<com.liferay.portal.model.Team> getTeams(long pk, int start,
6321 int end, OrderByComparator orderByComparator) throws SystemException {
6322 Object[] finderArgs = new Object[] {
6323 pk, String.valueOf(start), String.valueOf(end),
6324 String.valueOf(orderByComparator)
6325 };
6326
6327 List<com.liferay.portal.model.Team> list = (List<com.liferay.portal.model.Team>)FinderCacheUtil.getResult(FINDER_PATH_GET_TEAMS,
6328 finderArgs, this);
6329
6330 if (list == null) {
6331 Session session = null;
6332
6333 try {
6334 session = openSession();
6335
6336 String sql = null;
6337
6338 if (orderByComparator != null) {
6339 sql = _SQL_GETTEAMS.concat(ORDER_BY_CLAUSE)
6340 .concat(orderByComparator.getOrderBy());
6341 }
6342 else {
6343 sql = _SQL_GETTEAMS.concat(com.liferay.portal.model.impl.TeamModelImpl.ORDER_BY_SQL);
6344 }
6345
6346 SQLQuery q = session.createSQLQuery(sql);
6347
6348 q.addEntity("Team", com.liferay.portal.model.impl.TeamImpl.class);
6349
6350 QueryPos qPos = QueryPos.getInstance(q);
6351
6352 qPos.add(pk);
6353
6354 list = (List<com.liferay.portal.model.Team>)QueryUtil.list(q,
6355 getDialect(), start, end);
6356 }
6357 catch (Exception e) {
6358 throw processException(e);
6359 }
6360 finally {
6361 if (list == null) {
6362 list = new ArrayList<com.liferay.portal.model.Team>();
6363 }
6364
6365 teamPersistence.cacheResult(list);
6366
6367 FinderCacheUtil.putResult(FINDER_PATH_GET_TEAMS, finderArgs,
6368 list);
6369
6370 closeSession(session);
6371 }
6372 }
6373
6374 return list;
6375 }
6376
6377 public static final FinderPath FINDER_PATH_GET_TEAMS_SIZE = new FinderPath(com.liferay.portal.model.impl.TeamModelImpl.ENTITY_CACHE_ENABLED,
6378 UserModelImpl.FINDER_CACHE_ENABLED_USERS_TEAMS,
6379 UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME, "getTeamsSize",
6380 new String[] { Long.class.getName() });
6381
6382
6389 public int getTeamsSize(long pk) throws SystemException {
6390 Object[] finderArgs = new Object[] { pk };
6391
6392 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_TEAMS_SIZE,
6393 finderArgs, this);
6394
6395 if (count == null) {
6396 Session session = null;
6397
6398 try {
6399 session = openSession();
6400
6401 SQLQuery q = session.createSQLQuery(_SQL_GETTEAMSSIZE);
6402
6403 q.addScalar(COUNT_COLUMN_NAME,
6404 com.liferay.portal.kernel.dao.orm.Type.LONG);
6405
6406 QueryPos qPos = QueryPos.getInstance(q);
6407
6408 qPos.add(pk);
6409
6410 count = (Long)q.uniqueResult();
6411 }
6412 catch (Exception e) {
6413 throw processException(e);
6414 }
6415 finally {
6416 if (count == null) {
6417 count = Long.valueOf(0);
6418 }
6419
6420 FinderCacheUtil.putResult(FINDER_PATH_GET_TEAMS_SIZE,
6421 finderArgs, count);
6422
6423 closeSession(session);
6424 }
6425 }
6426
6427 return count.intValue();
6428 }
6429
6430 public static final FinderPath FINDER_PATH_CONTAINS_TEAM = new FinderPath(com.liferay.portal.model.impl.TeamModelImpl.ENTITY_CACHE_ENABLED,
6431 UserModelImpl.FINDER_CACHE_ENABLED_USERS_TEAMS,
6432 UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME, "containsTeam",
6433 new String[] { Long.class.getName(), Long.class.getName() });
6434
6435
6443 public boolean containsTeam(long pk, long teamPK) throws SystemException {
6444 Object[] finderArgs = new Object[] { pk, teamPK };
6445
6446 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_TEAM,
6447 finderArgs, this);
6448
6449 if (value == null) {
6450 try {
6451 value = Boolean.valueOf(containsTeam.contains(pk, teamPK));
6452 }
6453 catch (Exception e) {
6454 throw processException(e);
6455 }
6456 finally {
6457 if (value == null) {
6458 value = Boolean.FALSE;
6459 }
6460
6461 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_TEAM,
6462 finderArgs, value);
6463 }
6464 }
6465
6466 return value.booleanValue();
6467 }
6468
6469
6476 public boolean containsTeams(long pk) throws SystemException {
6477 if (getTeamsSize(pk) > 0) {
6478 return true;
6479 }
6480 else {
6481 return false;
6482 }
6483 }
6484
6485
6492 public void addTeam(long pk, long teamPK) throws SystemException {
6493 try {
6494 addTeam.add(pk, teamPK);
6495 }
6496 catch (Exception e) {
6497 throw processException(e);
6498 }
6499 finally {
6500 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
6501 }
6502 }
6503
6504
6511 public void addTeam(long pk, com.liferay.portal.model.Team team)
6512 throws SystemException {
6513 try {
6514 addTeam.add(pk, team.getPrimaryKey());
6515 }
6516 catch (Exception e) {
6517 throw processException(e);
6518 }
6519 finally {
6520 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
6521 }
6522 }
6523
6524
6531 public void addTeams(long pk, long[] teamPKs) throws SystemException {
6532 try {
6533 for (long teamPK : teamPKs) {
6534 addTeam.add(pk, teamPK);
6535 }
6536 }
6537 catch (Exception e) {
6538 throw processException(e);
6539 }
6540 finally {
6541 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
6542 }
6543 }
6544
6545
6552 public void addTeams(long pk, List<com.liferay.portal.model.Team> teams)
6553 throws SystemException {
6554 try {
6555 for (com.liferay.portal.model.Team team : teams) {
6556 addTeam.add(pk, team.getPrimaryKey());
6557 }
6558 }
6559 catch (Exception e) {
6560 throw processException(e);
6561 }
6562 finally {
6563 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
6564 }
6565 }
6566
6567
6573 public void clearTeams(long pk) throws SystemException {
6574 try {
6575 clearTeams.clear(pk);
6576 }
6577 catch (Exception e) {
6578 throw processException(e);
6579 }
6580 finally {
6581 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
6582 }
6583 }
6584
6585
6592 public void removeTeam(long pk, long teamPK) throws SystemException {
6593 try {
6594 removeTeam.remove(pk, teamPK);
6595 }
6596 catch (Exception e) {
6597 throw processException(e);
6598 }
6599 finally {
6600 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
6601 }
6602 }
6603
6604
6611 public void removeTeam(long pk, com.liferay.portal.model.Team team)
6612 throws SystemException {
6613 try {
6614 removeTeam.remove(pk, team.getPrimaryKey());
6615 }
6616 catch (Exception e) {
6617 throw processException(e);
6618 }
6619 finally {
6620 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
6621 }
6622 }
6623
6624
6631 public void removeTeams(long pk, long[] teamPKs) throws SystemException {
6632 try {
6633 for (long teamPK : teamPKs) {
6634 removeTeam.remove(pk, teamPK);
6635 }
6636 }
6637 catch (Exception e) {
6638 throw processException(e);
6639 }
6640 finally {
6641 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
6642 }
6643 }
6644
6645
6652 public void removeTeams(long pk, List<com.liferay.portal.model.Team> teams)
6653 throws SystemException {
6654 try {
6655 for (com.liferay.portal.model.Team team : teams) {
6656 removeTeam.remove(pk, team.getPrimaryKey());
6657 }
6658 }
6659 catch (Exception e) {
6660 throw processException(e);
6661 }
6662 finally {
6663 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
6664 }
6665 }
6666
6667
6674 public void setTeams(long pk, long[] teamPKs) throws SystemException {
6675 try {
6676 Set<Long> teamPKSet = SetUtil.fromArray(teamPKs);
6677
6678 List<com.liferay.portal.model.Team> teams = getTeams(pk);
6679
6680 for (com.liferay.portal.model.Team team : teams) {
6681 if (!teamPKSet.remove(team.getPrimaryKey())) {
6682 removeTeam.remove(pk, team.getPrimaryKey());
6683 }
6684 }
6685
6686 for (Long teamPK : teamPKSet) {
6687 addTeam.add(pk, teamPK);
6688 }
6689 }
6690 catch (Exception e) {
6691 throw processException(e);
6692 }
6693 finally {
6694 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
6695 }
6696 }
6697
6698
6705 public void setTeams(long pk, List<com.liferay.portal.model.Team> teams)
6706 throws SystemException {
6707 try {
6708 long[] teamPKs = new long[teams.size()];
6709
6710 for (int i = 0; i < teams.size(); i++) {
6711 com.liferay.portal.model.Team team = teams.get(i);
6712
6713 teamPKs[i] = team.getPrimaryKey();
6714 }
6715
6716 setTeams(pk, teamPKs);
6717 }
6718 catch (Exception e) {
6719 throw processException(e);
6720 }
6721 finally {
6722 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
6723 }
6724 }
6725
6726
6733 public List<com.liferay.portal.model.UserGroup> getUserGroups(long pk)
6734 throws SystemException {
6735 return getUserGroups(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
6736 }
6737
6738
6751 public List<com.liferay.portal.model.UserGroup> getUserGroups(long pk,
6752 int start, int end) throws SystemException {
6753 return getUserGroups(pk, start, end, null);
6754 }
6755
6756 public static final FinderPath FINDER_PATH_GET_USERGROUPS = new FinderPath(com.liferay.portal.model.impl.UserGroupModelImpl.ENTITY_CACHE_ENABLED,
6757 UserModelImpl.FINDER_CACHE_ENABLED_USERS_USERGROUPS,
6758 UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME, "getUserGroups",
6759 new String[] {
6760 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
6761 "com.liferay.portal.kernel.util.OrderByComparator"
6762 });
6763
6764
6778 public List<com.liferay.portal.model.UserGroup> getUserGroups(long pk,
6779 int start, int end, OrderByComparator orderByComparator)
6780 throws SystemException {
6781 Object[] finderArgs = new Object[] {
6782 pk, String.valueOf(start), String.valueOf(end),
6783 String.valueOf(orderByComparator)
6784 };
6785
6786 List<com.liferay.portal.model.UserGroup> list = (List<com.liferay.portal.model.UserGroup>)FinderCacheUtil.getResult(FINDER_PATH_GET_USERGROUPS,
6787 finderArgs, this);
6788
6789 if (list == null) {
6790 Session session = null;
6791
6792 try {
6793 session = openSession();
6794
6795 String sql = null;
6796
6797 if (orderByComparator != null) {
6798 sql = _SQL_GETUSERGROUPS.concat(ORDER_BY_CLAUSE)
6799 .concat(orderByComparator.getOrderBy());
6800 }
6801 else {
6802 sql = _SQL_GETUSERGROUPS.concat(com.liferay.portal.model.impl.UserGroupModelImpl.ORDER_BY_SQL);
6803 }
6804
6805 SQLQuery q = session.createSQLQuery(sql);
6806
6807 q.addEntity("UserGroup",
6808 com.liferay.portal.model.impl.UserGroupImpl.class);
6809
6810 QueryPos qPos = QueryPos.getInstance(q);
6811
6812 qPos.add(pk);
6813
6814 list = (List<com.liferay.portal.model.UserGroup>)QueryUtil.list(q,
6815 getDialect(), start, end);
6816 }
6817 catch (Exception e) {
6818 throw processException(e);
6819 }
6820 finally {
6821 if (list == null) {
6822 list = new ArrayList<com.liferay.portal.model.UserGroup>();
6823 }
6824
6825 userGroupPersistence.cacheResult(list);
6826
6827 FinderCacheUtil.putResult(FINDER_PATH_GET_USERGROUPS,
6828 finderArgs, list);
6829
6830 closeSession(session);
6831 }
6832 }
6833
6834 return list;
6835 }
6836
6837 public static final FinderPath FINDER_PATH_GET_USERGROUPS_SIZE = new FinderPath(com.liferay.portal.model.impl.UserGroupModelImpl.ENTITY_CACHE_ENABLED,
6838 UserModelImpl.FINDER_CACHE_ENABLED_USERS_USERGROUPS,
6839 UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME,
6840 "getUserGroupsSize", new String[] { Long.class.getName() });
6841
6842
6849 public int getUserGroupsSize(long pk) throws SystemException {
6850 Object[] finderArgs = new Object[] { pk };
6851
6852 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_USERGROUPS_SIZE,
6853 finderArgs, this);
6854
6855 if (count == null) {
6856 Session session = null;
6857
6858 try {
6859 session = openSession();
6860
6861 SQLQuery q = session.createSQLQuery(_SQL_GETUSERGROUPSSIZE);
6862
6863 q.addScalar(COUNT_COLUMN_NAME,
6864 com.liferay.portal.kernel.dao.orm.Type.LONG);
6865
6866 QueryPos qPos = QueryPos.getInstance(q);
6867
6868 qPos.add(pk);
6869
6870 count = (Long)q.uniqueResult();
6871 }
6872 catch (Exception e) {
6873 throw processException(e);
6874 }
6875 finally {
6876 if (count == null) {
6877 count = Long.valueOf(0);
6878 }
6879
6880 FinderCacheUtil.putResult(FINDER_PATH_GET_USERGROUPS_SIZE,
6881 finderArgs, count);
6882
6883 closeSession(session);
6884 }
6885 }
6886
6887 return count.intValue();
6888 }
6889
6890 public static final FinderPath FINDER_PATH_CONTAINS_USERGROUP = new FinderPath(com.liferay.portal.model.impl.UserGroupModelImpl.ENTITY_CACHE_ENABLED,
6891 UserModelImpl.FINDER_CACHE_ENABLED_USERS_USERGROUPS,
6892 UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME,
6893 "containsUserGroup",
6894 new String[] { Long.class.getName(), Long.class.getName() });
6895
6896
6904 public boolean containsUserGroup(long pk, long userGroupPK)
6905 throws SystemException {
6906 Object[] finderArgs = new Object[] { pk, userGroupPK };
6907
6908 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_USERGROUP,
6909 finderArgs, this);
6910
6911 if (value == null) {
6912 try {
6913 value = Boolean.valueOf(containsUserGroup.contains(pk,
6914 userGroupPK));
6915 }
6916 catch (Exception e) {
6917 throw processException(e);
6918 }
6919 finally {
6920 if (value == null) {
6921 value = Boolean.FALSE;
6922 }
6923
6924 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_USERGROUP,
6925 finderArgs, value);
6926 }
6927 }
6928
6929 return value.booleanValue();
6930 }
6931
6932
6939 public boolean containsUserGroups(long pk) throws SystemException {
6940 if (getUserGroupsSize(pk) > 0) {
6941 return true;
6942 }
6943 else {
6944 return false;
6945 }
6946 }
6947
6948
6955 public void addUserGroup(long pk, long userGroupPK)
6956 throws SystemException {
6957 try {
6958 addUserGroup.add(pk, userGroupPK);
6959 }
6960 catch (Exception e) {
6961 throw processException(e);
6962 }
6963 finally {
6964 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
6965 }
6966 }
6967
6968
6975 public void addUserGroup(long pk,
6976 com.liferay.portal.model.UserGroup userGroup) throws SystemException {
6977 try {
6978 addUserGroup.add(pk, userGroup.getPrimaryKey());
6979 }
6980 catch (Exception e) {
6981 throw processException(e);
6982 }
6983 finally {
6984 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
6985 }
6986 }
6987
6988
6995 public void addUserGroups(long pk, long[] userGroupPKs)
6996 throws SystemException {
6997 try {
6998 for (long userGroupPK : userGroupPKs) {
6999 addUserGroup.add(pk, userGroupPK);
7000 }
7001 }
7002 catch (Exception e) {
7003 throw processException(e);
7004 }
7005 finally {
7006 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
7007 }
7008 }
7009
7010
7017 public void addUserGroups(long pk,
7018 List<com.liferay.portal.model.UserGroup> userGroups)
7019 throws SystemException {
7020 try {
7021 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
7022 addUserGroup.add(pk, userGroup.getPrimaryKey());
7023 }
7024 }
7025 catch (Exception e) {
7026 throw processException(e);
7027 }
7028 finally {
7029 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
7030 }
7031 }
7032
7033
7039 public void clearUserGroups(long pk) throws SystemException {
7040 try {
7041 clearUserGroups.clear(pk);
7042 }
7043 catch (Exception e) {
7044 throw processException(e);
7045 }
7046 finally {
7047 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
7048 }
7049 }
7050
7051
7058 public void removeUserGroup(long pk, long userGroupPK)
7059 throws SystemException {
7060 try {
7061 removeUserGroup.remove(pk, userGroupPK);
7062 }
7063 catch (Exception e) {
7064 throw processException(e);
7065 }
7066 finally {
7067 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
7068 }
7069 }
7070
7071
7078 public void removeUserGroup(long pk,
7079 com.liferay.portal.model.UserGroup userGroup) throws SystemException {
7080 try {
7081 removeUserGroup.remove(pk, userGroup.getPrimaryKey());
7082 }
7083 catch (Exception e) {
7084 throw processException(e);
7085 }
7086 finally {
7087 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
7088 }
7089 }
7090
7091
7098 public void removeUserGroups(long pk, long[] userGroupPKs)
7099 throws SystemException {
7100 try {
7101 for (long userGroupPK : userGroupPKs) {
7102 removeUserGroup.remove(pk, userGroupPK);
7103 }
7104 }
7105 catch (Exception e) {
7106 throw processException(e);
7107 }
7108 finally {
7109 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
7110 }
7111 }
7112
7113
7120 public void removeUserGroups(long pk,
7121 List<com.liferay.portal.model.UserGroup> userGroups)
7122 throws SystemException {
7123 try {
7124 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
7125 removeUserGroup.remove(pk, userGroup.getPrimaryKey());
7126 }
7127 }
7128 catch (Exception e) {
7129 throw processException(e);
7130 }
7131 finally {
7132 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
7133 }
7134 }
7135
7136
7143 public void setUserGroups(long pk, long[] userGroupPKs)
7144 throws SystemException {
7145 try {
7146 Set<Long> userGroupPKSet = SetUtil.fromArray(userGroupPKs);
7147
7148 List<com.liferay.portal.model.UserGroup> userGroups = getUserGroups(pk);
7149
7150 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
7151 if (!userGroupPKSet.remove(userGroup.getPrimaryKey())) {
7152 removeUserGroup.remove(pk, userGroup.getPrimaryKey());
7153 }
7154 }
7155
7156 for (Long userGroupPK : userGroupPKSet) {
7157 addUserGroup.add(pk, userGroupPK);
7158 }
7159 }
7160 catch (Exception e) {
7161 throw processException(e);
7162 }
7163 finally {
7164 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
7165 }
7166 }
7167
7168
7175 public void setUserGroups(long pk,
7176 List<com.liferay.portal.model.UserGroup> userGroups)
7177 throws SystemException {
7178 try {
7179 long[] userGroupPKs = new long[userGroups.size()];
7180
7181 for (int i = 0; i < userGroups.size(); i++) {
7182 com.liferay.portal.model.UserGroup userGroup = userGroups.get(i);
7183
7184 userGroupPKs[i] = userGroup.getPrimaryKey();
7185 }
7186
7187 setUserGroups(pk, userGroupPKs);
7188 }
7189 catch (Exception e) {
7190 throw processException(e);
7191 }
7192 finally {
7193 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
7194 }
7195 }
7196
7197
7200 public void afterPropertiesSet() {
7201 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
7202 com.liferay.portal.util.PropsUtil.get(
7203 "value.object.listener.com.liferay.portal.model.User")));
7204
7205 if (listenerClassNames.length > 0) {
7206 try {
7207 List<ModelListener<User>> listenersList = new ArrayList<ModelListener<User>>();
7208
7209 for (String listenerClassName : listenerClassNames) {
7210 listenersList.add((ModelListener<User>)InstanceFactory.newInstance(
7211 listenerClassName));
7212 }
7213
7214 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
7215 }
7216 catch (Exception e) {
7217 _log.error(e);
7218 }
7219 }
7220
7221 containsGroup = new ContainsGroup(this);
7222
7223 addGroup = new AddGroup(this);
7224 clearGroups = new ClearGroups(this);
7225 removeGroup = new RemoveGroup(this);
7226
7227 containsOrganization = new ContainsOrganization(this);
7228
7229 addOrganization = new AddOrganization(this);
7230 clearOrganizations = new ClearOrganizations(this);
7231 removeOrganization = new RemoveOrganization(this);
7232
7233 containsPermission = new ContainsPermission(this);
7234
7235 addPermission = new AddPermission(this);
7236 clearPermissions = new ClearPermissions(this);
7237 removePermission = new RemovePermission(this);
7238
7239 containsRole = new ContainsRole(this);
7240
7241 addRole = new AddRole(this);
7242 clearRoles = new ClearRoles(this);
7243 removeRole = new RemoveRole(this);
7244
7245 containsTeam = new ContainsTeam(this);
7246
7247 addTeam = new AddTeam(this);
7248 clearTeams = new ClearTeams(this);
7249 removeTeam = new RemoveTeam(this);
7250
7251 containsUserGroup = new ContainsUserGroup(this);
7252
7253 addUserGroup = new AddUserGroup(this);
7254 clearUserGroups = new ClearUserGroups(this);
7255 removeUserGroup = new RemoveUserGroup(this);
7256 }
7257
7258 public void destroy() {
7259 EntityCacheUtil.removeCache(UserImpl.class.getName());
7260 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
7261 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
7262 }
7263
7264 @BeanReference(type = AccountPersistence.class)
7265 protected AccountPersistence accountPersistence;
7266 @BeanReference(type = AddressPersistence.class)
7267 protected AddressPersistence addressPersistence;
7268 @BeanReference(type = BrowserTrackerPersistence.class)
7269 protected BrowserTrackerPersistence browserTrackerPersistence;
7270 @BeanReference(type = ClassNamePersistence.class)
7271 protected ClassNamePersistence classNamePersistence;
7272 @BeanReference(type = ClusterGroupPersistence.class)
7273 protected ClusterGroupPersistence clusterGroupPersistence;
7274 @BeanReference(type = CompanyPersistence.class)
7275 protected CompanyPersistence companyPersistence;
7276 @BeanReference(type = ContactPersistence.class)
7277 protected ContactPersistence contactPersistence;
7278 @BeanReference(type = CountryPersistence.class)
7279 protected CountryPersistence countryPersistence;
7280 @BeanReference(type = EmailAddressPersistence.class)
7281 protected EmailAddressPersistence emailAddressPersistence;
7282 @BeanReference(type = GroupPersistence.class)
7283 protected GroupPersistence groupPersistence;
7284 @BeanReference(type = ImagePersistence.class)
7285 protected ImagePersistence imagePersistence;
7286 @BeanReference(type = LayoutPersistence.class)
7287 protected LayoutPersistence layoutPersistence;
7288 @BeanReference(type = LayoutPrototypePersistence.class)
7289 protected LayoutPrototypePersistence layoutPrototypePersistence;
7290 @BeanReference(type = LayoutSetPersistence.class)
7291 protected LayoutSetPersistence layoutSetPersistence;
7292 @BeanReference(type = LayoutSetPrototypePersistence.class)
7293 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
7294 @BeanReference(type = ListTypePersistence.class)
7295 protected ListTypePersistence listTypePersistence;
7296 @BeanReference(type = LockPersistence.class)
7297 protected LockPersistence lockPersistence;
7298 @BeanReference(type = MembershipRequestPersistence.class)
7299 protected MembershipRequestPersistence membershipRequestPersistence;
7300 @BeanReference(type = OrganizationPersistence.class)
7301 protected OrganizationPersistence organizationPersistence;
7302 @BeanReference(type = OrgGroupPermissionPersistence.class)
7303 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
7304 @BeanReference(type = OrgGroupRolePersistence.class)
7305 protected OrgGroupRolePersistence orgGroupRolePersistence;
7306 @BeanReference(type = OrgLaborPersistence.class)
7307 protected OrgLaborPersistence orgLaborPersistence;
7308 @BeanReference(type = PasswordPolicyPersistence.class)
7309 protected PasswordPolicyPersistence passwordPolicyPersistence;
7310 @BeanReference(type = PasswordPolicyRelPersistence.class)
7311 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
7312 @BeanReference(type = PasswordTrackerPersistence.class)
7313 protected PasswordTrackerPersistence passwordTrackerPersistence;
7314 @BeanReference(type = PermissionPersistence.class)
7315 protected PermissionPersistence permissionPersistence;
7316 @BeanReference(type = PhonePersistence.class)
7317 protected PhonePersistence phonePersistence;
7318 @BeanReference(type = PluginSettingPersistence.class)
7319 protected PluginSettingPersistence pluginSettingPersistence;
7320 @BeanReference(type = PortletPersistence.class)
7321 protected PortletPersistence portletPersistence;
7322 @BeanReference(type = PortletItemPersistence.class)
7323 protected PortletItemPersistence portletItemPersistence;
7324 @BeanReference(type = PortletPreferencesPersistence.class)
7325 protected PortletPreferencesPersistence portletPreferencesPersistence;
7326 @BeanReference(type = RegionPersistence.class)
7327 protected RegionPersistence regionPersistence;
7328 @BeanReference(type = ReleasePersistence.class)
7329 protected ReleasePersistence releasePersistence;
7330 @BeanReference(type = ResourcePersistence.class)
7331 protected ResourcePersistence resourcePersistence;
7332 @BeanReference(type = ResourceActionPersistence.class)
7333 protected ResourceActionPersistence resourceActionPersistence;
7334 @BeanReference(type = ResourceCodePersistence.class)
7335 protected ResourceCodePersistence resourceCodePersistence;
7336 @BeanReference(type = ResourcePermissionPersistence.class)
7337 protected ResourcePermissionPersistence resourcePermissionPersistence;
7338 @BeanReference(type = RolePersistence.class)
7339 protected RolePersistence rolePersistence;
7340 @BeanReference(type = ServiceComponentPersistence.class)
7341 protected ServiceComponentPersistence serviceComponentPersistence;
7342 @BeanReference(type = ShardPersistence.class)
7343 protected ShardPersistence shardPersistence;
7344 @BeanReference(type = SubscriptionPersistence.class)
7345 protected SubscriptionPersistence subscriptionPersistence;
7346 @BeanReference(type = TicketPersistence.class)
7347 protected TicketPersistence ticketPersistence;
7348 @BeanReference(type = TeamPersistence.class)
7349 protected TeamPersistence teamPersistence;
7350 @BeanReference(type = UserPersistence.class)
7351 protected UserPersistence userPersistence;
7352 @BeanReference(type = UserGroupPersistence.class)
7353 protected UserGroupPersistence userGroupPersistence;
7354 @BeanReference(type = UserGroupGroupRolePersistence.class)
7355 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
7356 @BeanReference(type = UserGroupRolePersistence.class)
7357 protected UserGroupRolePersistence userGroupRolePersistence;
7358 @BeanReference(type = UserIdMapperPersistence.class)
7359 protected UserIdMapperPersistence userIdMapperPersistence;
7360 @BeanReference(type = UserTrackerPersistence.class)
7361 protected UserTrackerPersistence userTrackerPersistence;
7362 @BeanReference(type = UserTrackerPathPersistence.class)
7363 protected UserTrackerPathPersistence userTrackerPathPersistence;
7364 @BeanReference(type = WebDAVPropsPersistence.class)
7365 protected WebDAVPropsPersistence webDAVPropsPersistence;
7366 @BeanReference(type = WebsitePersistence.class)
7367 protected WebsitePersistence websitePersistence;
7368 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
7369 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
7370 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
7371 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
7372 @BeanReference(type = AnnouncementsDeliveryPersistence.class)
7373 protected AnnouncementsDeliveryPersistence announcementsDeliveryPersistence;
7374 @BeanReference(type = AssetEntryPersistence.class)
7375 protected AssetEntryPersistence assetEntryPersistence;
7376 @BeanReference(type = BlogsStatsUserPersistence.class)
7377 protected BlogsStatsUserPersistence blogsStatsUserPersistence;
7378 @BeanReference(type = DLFileRankPersistence.class)
7379 protected DLFileRankPersistence dlFileRankPersistence;
7380 @BeanReference(type = ExpandoValuePersistence.class)
7381 protected ExpandoValuePersistence expandoValuePersistence;
7382 @BeanReference(type = MBBanPersistence.class)
7383 protected MBBanPersistence mbBanPersistence;
7384 @BeanReference(type = MBMessagePersistence.class)
7385 protected MBMessagePersistence mbMessagePersistence;
7386 @BeanReference(type = MBMessageFlagPersistence.class)
7387 protected MBMessageFlagPersistence mbMessageFlagPersistence;
7388 @BeanReference(type = MBStatsUserPersistence.class)
7389 protected MBStatsUserPersistence mbStatsUserPersistence;
7390 @BeanReference(type = ShoppingCartPersistence.class)
7391 protected ShoppingCartPersistence shoppingCartPersistence;
7392 @BeanReference(type = SocialActivityPersistence.class)
7393 protected SocialActivityPersistence socialActivityPersistence;
7394 @BeanReference(type = SocialRequestPersistence.class)
7395 protected SocialRequestPersistence socialRequestPersistence;
7396 protected ContainsGroup containsGroup;
7397 protected AddGroup addGroup;
7398 protected ClearGroups clearGroups;
7399 protected RemoveGroup removeGroup;
7400 protected ContainsOrganization containsOrganization;
7401 protected AddOrganization addOrganization;
7402 protected ClearOrganizations clearOrganizations;
7403 protected RemoveOrganization removeOrganization;
7404 protected ContainsPermission containsPermission;
7405 protected AddPermission addPermission;
7406 protected ClearPermissions clearPermissions;
7407 protected RemovePermission removePermission;
7408 protected ContainsRole containsRole;
7409 protected AddRole addRole;
7410 protected ClearRoles clearRoles;
7411 protected RemoveRole removeRole;
7412 protected ContainsTeam containsTeam;
7413 protected AddTeam addTeam;
7414 protected ClearTeams clearTeams;
7415 protected RemoveTeam removeTeam;
7416 protected ContainsUserGroup containsUserGroup;
7417 protected AddUserGroup addUserGroup;
7418 protected ClearUserGroups clearUserGroups;
7419 protected RemoveUserGroup removeUserGroup;
7420
7421 protected class ContainsGroup {
7422 protected ContainsGroup(UserPersistenceImpl persistenceImpl) {
7423 super();
7424
7425 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
7426 _SQL_CONTAINSGROUP,
7427 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
7428 RowMapper.COUNT);
7429 }
7430
7431 protected boolean contains(long userId, long groupId) {
7432 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
7433 new Long(userId), new Long(groupId)
7434 });
7435
7436 if (results.size() > 0) {
7437 Integer count = results.get(0);
7438
7439 if (count.intValue() > 0) {
7440 return true;
7441 }
7442 }
7443
7444 return false;
7445 }
7446
7447 private MappingSqlQuery<Integer> _mappingSqlQuery;
7448 }
7449
7450 protected class AddGroup {
7451 protected AddGroup(UserPersistenceImpl persistenceImpl) {
7452 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
7453 "INSERT INTO Users_Groups (userId, groupId) VALUES (?, ?)",
7454 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
7455 _persistenceImpl = persistenceImpl;
7456 }
7457
7458 protected void add(long userId, long groupId) throws SystemException {
7459 if (!_persistenceImpl.containsGroup.contains(userId, groupId)) {
7460 ModelListener<com.liferay.portal.model.Group>[] groupListeners = groupPersistence.getListeners();
7461
7462 for (ModelListener<User> listener : listeners) {
7463 listener.onBeforeAddAssociation(userId,
7464 com.liferay.portal.model.Group.class.getName(), groupId);
7465 }
7466
7467 for (ModelListener<com.liferay.portal.model.Group> listener : groupListeners) {
7468 listener.onBeforeAddAssociation(groupId,
7469 User.class.getName(), userId);
7470 }
7471
7472 _sqlUpdate.update(new Object[] {
7473 new Long(userId), new Long(groupId)
7474 });
7475
7476 for (ModelListener<User> listener : listeners) {
7477 listener.onAfterAddAssociation(userId,
7478 com.liferay.portal.model.Group.class.getName(), groupId);
7479 }
7480
7481 for (ModelListener<com.liferay.portal.model.Group> listener : groupListeners) {
7482 listener.onAfterAddAssociation(groupId,
7483 User.class.getName(), userId);
7484 }
7485 }
7486 }
7487
7488 private SqlUpdate _sqlUpdate;
7489 private UserPersistenceImpl _persistenceImpl;
7490 }
7491
7492 protected class ClearGroups {
7493 protected ClearGroups(UserPersistenceImpl persistenceImpl) {
7494 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
7495 "DELETE FROM Users_Groups WHERE userId = ?",
7496 new int[] { java.sql.Types.BIGINT });
7497 }
7498
7499 protected void clear(long userId) throws SystemException {
7500 ModelListener<com.liferay.portal.model.Group>[] groupListeners = groupPersistence.getListeners();
7501
7502 List<com.liferay.portal.model.Group> groups = null;
7503
7504 if ((listeners.length > 0) || (groupListeners.length > 0)) {
7505 groups = getGroups(userId);
7506
7507 for (com.liferay.portal.model.Group group : groups) {
7508 for (ModelListener<User> listener : listeners) {
7509 listener.onBeforeRemoveAssociation(userId,
7510 com.liferay.portal.model.Group.class.getName(),
7511 group.getPrimaryKey());
7512 }
7513
7514 for (ModelListener<com.liferay.portal.model.Group> listener : groupListeners) {
7515 listener.onBeforeRemoveAssociation(group.getPrimaryKey(),
7516 User.class.getName(), userId);
7517 }
7518 }
7519 }
7520
7521 _sqlUpdate.update(new Object[] { new Long(userId) });
7522
7523 if ((listeners.length > 0) || (groupListeners.length > 0)) {
7524 for (com.liferay.portal.model.Group group : groups) {
7525 for (ModelListener<User> listener : listeners) {
7526 listener.onAfterRemoveAssociation(userId,
7527 com.liferay.portal.model.Group.class.getName(),
7528 group.getPrimaryKey());
7529 }
7530
7531 for (ModelListener<com.liferay.portal.model.Group> listener : groupListeners) {
7532 listener.onAfterRemoveAssociation(group.getPrimaryKey(),
7533 User.class.getName(), userId);
7534 }
7535 }
7536 }
7537 }
7538
7539 private SqlUpdate _sqlUpdate;
7540 }
7541
7542 protected class RemoveGroup {
7543 protected RemoveGroup(UserPersistenceImpl persistenceImpl) {
7544 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
7545 "DELETE FROM Users_Groups WHERE userId = ? AND groupId = ?",
7546 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
7547 _persistenceImpl = persistenceImpl;
7548 }
7549
7550 protected void remove(long userId, long groupId)
7551 throws SystemException {
7552 if (_persistenceImpl.containsGroup.contains(userId, groupId)) {
7553 ModelListener<com.liferay.portal.model.Group>[] groupListeners = groupPersistence.getListeners();
7554
7555 for (ModelListener<User> listener : listeners) {
7556 listener.onBeforeRemoveAssociation(userId,
7557 com.liferay.portal.model.Group.class.getName(), groupId);
7558 }
7559
7560 for (ModelListener<com.liferay.portal.model.Group> listener : groupListeners) {
7561 listener.onBeforeRemoveAssociation(groupId,
7562 User.class.getName(), userId);
7563 }
7564
7565 _sqlUpdate.update(new Object[] {
7566 new Long(userId), new Long(groupId)
7567 });
7568
7569 for (ModelListener<User> listener : listeners) {
7570 listener.onAfterRemoveAssociation(userId,
7571 com.liferay.portal.model.Group.class.getName(), groupId);
7572 }
7573
7574 for (ModelListener<com.liferay.portal.model.Group> listener : groupListeners) {
7575 listener.onAfterRemoveAssociation(groupId,
7576 User.class.getName(), userId);
7577 }
7578 }
7579 }
7580
7581 private SqlUpdate _sqlUpdate;
7582 private UserPersistenceImpl _persistenceImpl;
7583 }
7584
7585 protected class ContainsOrganization {
7586 protected ContainsOrganization(UserPersistenceImpl persistenceImpl) {
7587 super();
7588
7589 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
7590 _SQL_CONTAINSORGANIZATION,
7591 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
7592 RowMapper.COUNT);
7593 }
7594
7595 protected boolean contains(long userId, long organizationId) {
7596 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
7597 new Long(userId), new Long(organizationId)
7598 });
7599
7600 if (results.size() > 0) {
7601 Integer count = results.get(0);
7602
7603 if (count.intValue() > 0) {
7604 return true;
7605 }
7606 }
7607
7608 return false;
7609 }
7610
7611 private MappingSqlQuery<Integer> _mappingSqlQuery;
7612 }
7613
7614 protected class AddOrganization {
7615 protected AddOrganization(UserPersistenceImpl persistenceImpl) {
7616 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
7617 "INSERT INTO Users_Orgs (userId, organizationId) VALUES (?, ?)",
7618 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
7619 _persistenceImpl = persistenceImpl;
7620 }
7621
7622 protected void add(long userId, long organizationId)
7623 throws SystemException {
7624 if (!_persistenceImpl.containsOrganization.contains(userId,
7625 organizationId)) {
7626 ModelListener<com.liferay.portal.model.Organization>[] organizationListeners =
7627 organizationPersistence.getListeners();
7628
7629 for (ModelListener<User> listener : listeners) {
7630 listener.onBeforeAddAssociation(userId,
7631 com.liferay.portal.model.Organization.class.getName(),
7632 organizationId);
7633 }
7634
7635 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
7636 listener.onBeforeAddAssociation(organizationId,
7637 User.class.getName(), userId);
7638 }
7639
7640 _sqlUpdate.update(new Object[] {
7641 new Long(userId), new Long(organizationId)
7642 });
7643
7644 for (ModelListener<User> listener : listeners) {
7645 listener.onAfterAddAssociation(userId,
7646 com.liferay.portal.model.Organization.class.getName(),
7647 organizationId);
7648 }
7649
7650 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
7651 listener.onAfterAddAssociation(organizationId,
7652 User.class.getName(), userId);
7653 }
7654 }
7655 }
7656
7657 private SqlUpdate _sqlUpdate;
7658 private UserPersistenceImpl _persistenceImpl;
7659 }
7660
7661 protected class ClearOrganizations {
7662 protected ClearOrganizations(UserPersistenceImpl persistenceImpl) {
7663 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
7664 "DELETE FROM Users_Orgs WHERE userId = ?",
7665 new int[] { java.sql.Types.BIGINT });
7666 }
7667
7668 protected void clear(long userId) throws SystemException {
7669 ModelListener<com.liferay.portal.model.Organization>[] organizationListeners =
7670 organizationPersistence.getListeners();
7671
7672 List<com.liferay.portal.model.Organization> organizations = null;
7673
7674 if ((listeners.length > 0) || (organizationListeners.length > 0)) {
7675 organizations = getOrganizations(userId);
7676
7677 for (com.liferay.portal.model.Organization organization : organizations) {
7678 for (ModelListener<User> listener : listeners) {
7679 listener.onBeforeRemoveAssociation(userId,
7680 com.liferay.portal.model.Organization.class.getName(),
7681 organization.getPrimaryKey());
7682 }
7683
7684 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
7685 listener.onBeforeRemoveAssociation(organization.getPrimaryKey(),
7686 User.class.getName(), userId);
7687 }
7688 }
7689 }
7690
7691 _sqlUpdate.update(new Object[] { new Long(userId) });
7692
7693 if ((listeners.length > 0) || (organizationListeners.length > 0)) {
7694 for (com.liferay.portal.model.Organization organization : organizations) {
7695 for (ModelListener<User> listener : listeners) {
7696 listener.onAfterRemoveAssociation(userId,
7697 com.liferay.portal.model.Organization.class.getName(),
7698 organization.getPrimaryKey());
7699 }
7700
7701 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
7702 listener.onAfterRemoveAssociation(organization.getPrimaryKey(),
7703 User.class.getName(), userId);
7704 }
7705 }
7706 }
7707 }
7708
7709 private SqlUpdate _sqlUpdate;
7710 }
7711
7712 protected class RemoveOrganization {
7713 protected RemoveOrganization(UserPersistenceImpl persistenceImpl) {
7714 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
7715 "DELETE FROM Users_Orgs WHERE userId = ? AND organizationId = ?",
7716 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
7717 _persistenceImpl = persistenceImpl;
7718 }
7719
7720 protected void remove(long userId, long organizationId)
7721 throws SystemException {
7722 if (_persistenceImpl.containsOrganization.contains(userId,
7723 organizationId)) {
7724 ModelListener<com.liferay.portal.model.Organization>[] organizationListeners =
7725 organizationPersistence.getListeners();
7726
7727 for (ModelListener<User> listener : listeners) {
7728 listener.onBeforeRemoveAssociation(userId,
7729 com.liferay.portal.model.Organization.class.getName(),
7730 organizationId);
7731 }
7732
7733 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
7734 listener.onBeforeRemoveAssociation(organizationId,
7735 User.class.getName(), userId);
7736 }
7737
7738 _sqlUpdate.update(new Object[] {
7739 new Long(userId), new Long(organizationId)
7740 });
7741
7742 for (ModelListener<User> listener : listeners) {
7743 listener.onAfterRemoveAssociation(userId,
7744 com.liferay.portal.model.Organization.class.getName(),
7745 organizationId);
7746 }
7747
7748 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
7749 listener.onAfterRemoveAssociation(organizationId,
7750 User.class.getName(), userId);
7751 }
7752 }
7753 }
7754
7755 private SqlUpdate _sqlUpdate;
7756 private UserPersistenceImpl _persistenceImpl;
7757 }
7758
7759 protected class ContainsPermission {
7760 protected ContainsPermission(UserPersistenceImpl persistenceImpl) {
7761 super();
7762
7763 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
7764 _SQL_CONTAINSPERMISSION,
7765 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
7766 RowMapper.COUNT);
7767 }
7768
7769 protected boolean contains(long userId, long permissionId) {
7770 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
7771 new Long(userId), new Long(permissionId)
7772 });
7773
7774 if (results.size() > 0) {
7775 Integer count = results.get(0);
7776
7777 if (count.intValue() > 0) {
7778 return true;
7779 }
7780 }
7781
7782 return false;
7783 }
7784
7785 private MappingSqlQuery<Integer> _mappingSqlQuery;
7786 }
7787
7788 protected class AddPermission {
7789 protected AddPermission(UserPersistenceImpl persistenceImpl) {
7790 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
7791 "INSERT INTO Users_Permissions (userId, permissionId) VALUES (?, ?)",
7792 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
7793 _persistenceImpl = persistenceImpl;
7794 }
7795
7796 protected void add(long userId, long permissionId)
7797 throws SystemException {
7798 if (!_persistenceImpl.containsPermission.contains(userId,
7799 permissionId)) {
7800 ModelListener<com.liferay.portal.model.Permission>[] permissionListeners =
7801 permissionPersistence.getListeners();
7802
7803 for (ModelListener<User> listener : listeners) {
7804 listener.onBeforeAddAssociation(userId,
7805 com.liferay.portal.model.Permission.class.getName(),
7806 permissionId);
7807 }
7808
7809 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
7810 listener.onBeforeAddAssociation(permissionId,
7811 User.class.getName(), userId);
7812 }
7813
7814 _sqlUpdate.update(new Object[] {
7815 new Long(userId), new Long(permissionId)
7816 });
7817
7818 for (ModelListener<User> listener : listeners) {
7819 listener.onAfterAddAssociation(userId,
7820 com.liferay.portal.model.Permission.class.getName(),
7821 permissionId);
7822 }
7823
7824 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
7825 listener.onAfterAddAssociation(permissionId,
7826 User.class.getName(), userId);
7827 }
7828 }
7829 }
7830
7831 private SqlUpdate _sqlUpdate;
7832 private UserPersistenceImpl _persistenceImpl;
7833 }
7834
7835 protected class ClearPermissions {
7836 protected ClearPermissions(UserPersistenceImpl persistenceImpl) {
7837 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
7838 "DELETE FROM Users_Permissions WHERE userId = ?",
7839 new int[] { java.sql.Types.BIGINT });
7840 }
7841
7842 protected void clear(long userId) throws SystemException {
7843 ModelListener<com.liferay.portal.model.Permission>[] permissionListeners =
7844 permissionPersistence.getListeners();
7845
7846 List<com.liferay.portal.model.Permission> permissions = null;
7847
7848 if ((listeners.length > 0) || (permissionListeners.length > 0)) {
7849 permissions = getPermissions(userId);
7850
7851 for (com.liferay.portal.model.Permission permission : permissions) {
7852 for (ModelListener<User> listener : listeners) {
7853 listener.onBeforeRemoveAssociation(userId,
7854 com.liferay.portal.model.Permission.class.getName(),
7855 permission.getPrimaryKey());
7856 }
7857
7858 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
7859 listener.onBeforeRemoveAssociation(permission.getPrimaryKey(),
7860 User.class.getName(), userId);
7861 }
7862 }
7863 }
7864
7865 _sqlUpdate.update(new Object[] { new Long(userId) });
7866
7867 if ((listeners.length > 0) || (permissionListeners.length > 0)) {
7868 for (com.liferay.portal.model.Permission permission : permissions) {
7869 for (ModelListener<User> listener : listeners) {
7870 listener.onAfterRemoveAssociation(userId,
7871 com.liferay.portal.model.Permission.class.getName(),
7872 permission.getPrimaryKey());
7873 }
7874
7875 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
7876 listener.onAfterRemoveAssociation(permission.getPrimaryKey(),
7877 User.class.getName(), userId);
7878 }
7879 }
7880 }
7881 }
7882
7883 private SqlUpdate _sqlUpdate;
7884 }
7885
7886 protected class RemovePermission {
7887 protected RemovePermission(UserPersistenceImpl persistenceImpl) {
7888 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
7889 "DELETE FROM Users_Permissions WHERE userId = ? AND permissionId = ?",
7890 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
7891 _persistenceImpl = persistenceImpl;
7892 }
7893
7894 protected void remove(long userId, long permissionId)
7895 throws SystemException {
7896 if (_persistenceImpl.containsPermission.contains(userId,
7897 permissionId)) {
7898 ModelListener<com.liferay.portal.model.Permission>[] permissionListeners =
7899 permissionPersistence.getListeners();
7900
7901 for (ModelListener<User> listener : listeners) {
7902 listener.onBeforeRemoveAssociation(userId,
7903 com.liferay.portal.model.Permission.class.getName(),
7904 permissionId);
7905 }
7906
7907 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
7908 listener.onBeforeRemoveAssociation(permissionId,
7909 User.class.getName(), userId);
7910 }
7911
7912 _sqlUpdate.update(new Object[] {
7913 new Long(userId), new Long(permissionId)
7914 });
7915
7916 for (ModelListener<User> listener : listeners) {
7917 listener.onAfterRemoveAssociation(userId,
7918 com.liferay.portal.model.Permission.class.getName(),
7919 permissionId);
7920 }
7921
7922 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
7923 listener.onAfterRemoveAssociation(permissionId,
7924 User.class.getName(), userId);
7925 }
7926 }
7927 }
7928
7929 private SqlUpdate _sqlUpdate;
7930 private UserPersistenceImpl _persistenceImpl;
7931 }
7932
7933 protected class ContainsRole {
7934 protected ContainsRole(UserPersistenceImpl persistenceImpl) {
7935 super();
7936
7937 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
7938 _SQL_CONTAINSROLE,
7939 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
7940 RowMapper.COUNT);
7941 }
7942
7943 protected boolean contains(long userId, long roleId) {
7944 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
7945 new Long(userId), new Long(roleId)
7946 });
7947
7948 if (results.size() > 0) {
7949 Integer count = results.get(0);
7950
7951 if (count.intValue() > 0) {
7952 return true;
7953 }
7954 }
7955
7956 return false;
7957 }
7958
7959 private MappingSqlQuery<Integer> _mappingSqlQuery;
7960 }
7961
7962 protected class AddRole {
7963 protected AddRole(UserPersistenceImpl persistenceImpl) {
7964 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
7965 "INSERT INTO Users_Roles (userId, roleId) VALUES (?, ?)",
7966 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
7967 _persistenceImpl = persistenceImpl;
7968 }
7969
7970 protected void add(long userId, long roleId) throws SystemException {
7971 if (!_persistenceImpl.containsRole.contains(userId, roleId)) {
7972 ModelListener<com.liferay.portal.model.Role>[] roleListeners = rolePersistence.getListeners();
7973
7974 for (ModelListener<User> listener : listeners) {
7975 listener.onBeforeAddAssociation(userId,
7976 com.liferay.portal.model.Role.class.getName(), roleId);
7977 }
7978
7979 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
7980 listener.onBeforeAddAssociation(roleId,
7981 User.class.getName(), userId);
7982 }
7983
7984 _sqlUpdate.update(new Object[] {
7985 new Long(userId), new Long(roleId)
7986 });
7987
7988 for (ModelListener<User> listener : listeners) {
7989 listener.onAfterAddAssociation(userId,
7990 com.liferay.portal.model.Role.class.getName(), roleId);
7991 }
7992
7993 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
7994 listener.onAfterAddAssociation(roleId,
7995 User.class.getName(), userId);
7996 }
7997 }
7998 }
7999
8000 private SqlUpdate _sqlUpdate;
8001 private UserPersistenceImpl _persistenceImpl;
8002 }
8003
8004 protected class ClearRoles {
8005 protected ClearRoles(UserPersistenceImpl persistenceImpl) {
8006 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
8007 "DELETE FROM Users_Roles WHERE userId = ?",
8008 new int[] { java.sql.Types.BIGINT });
8009 }
8010
8011 protected void clear(long userId) throws SystemException {
8012 ModelListener<com.liferay.portal.model.Role>[] roleListeners = rolePersistence.getListeners();
8013
8014 List<com.liferay.portal.model.Role> roles = null;
8015
8016 if ((listeners.length > 0) || (roleListeners.length > 0)) {
8017 roles = getRoles(userId);
8018
8019 for (com.liferay.portal.model.Role role : roles) {
8020 for (ModelListener<User> listener : listeners) {
8021 listener.onBeforeRemoveAssociation(userId,
8022 com.liferay.portal.model.Role.class.getName(),
8023 role.getPrimaryKey());
8024 }
8025
8026 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
8027 listener.onBeforeRemoveAssociation(role.getPrimaryKey(),
8028 User.class.getName(), userId);
8029 }
8030 }
8031 }
8032
8033 _sqlUpdate.update(new Object[] { new Long(userId) });
8034
8035 if ((listeners.length > 0) || (roleListeners.length > 0)) {
8036 for (com.liferay.portal.model.Role role : roles) {
8037 for (ModelListener<User> listener : listeners) {
8038 listener.onAfterRemoveAssociation(userId,
8039 com.liferay.portal.model.Role.class.getName(),
8040 role.getPrimaryKey());
8041 }
8042
8043 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
8044 listener.onAfterRemoveAssociation(role.getPrimaryKey(),
8045 User.class.getName(), userId);
8046 }
8047 }
8048 }
8049 }
8050
8051 private SqlUpdate _sqlUpdate;
8052 }
8053
8054 protected class RemoveRole {
8055 protected RemoveRole(UserPersistenceImpl persistenceImpl) {
8056 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
8057 "DELETE FROM Users_Roles WHERE userId = ? AND roleId = ?",
8058 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
8059 _persistenceImpl = persistenceImpl;
8060 }
8061
8062 protected void remove(long userId, long roleId)
8063 throws SystemException {
8064 if (_persistenceImpl.containsRole.contains(userId, roleId)) {
8065 ModelListener<com.liferay.portal.model.Role>[] roleListeners = rolePersistence.getListeners();
8066
8067 for (ModelListener<User> listener : listeners) {
8068 listener.onBeforeRemoveAssociation(userId,
8069 com.liferay.portal.model.Role.class.getName(), roleId);
8070 }
8071
8072 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
8073 listener.onBeforeRemoveAssociation(roleId,
8074 User.class.getName(), userId);
8075 }
8076
8077 _sqlUpdate.update(new Object[] {
8078 new Long(userId), new Long(roleId)
8079 });
8080
8081 for (ModelListener<User> listener : listeners) {
8082 listener.onAfterRemoveAssociation(userId,
8083 com.liferay.portal.model.Role.class.getName(), roleId);
8084 }
8085
8086 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
8087 listener.onAfterRemoveAssociation(roleId,
8088 User.class.getName(), userId);
8089 }
8090 }
8091 }
8092
8093 private SqlUpdate _sqlUpdate;
8094 private UserPersistenceImpl _persistenceImpl;
8095 }
8096
8097 protected class ContainsTeam {
8098 protected ContainsTeam(UserPersistenceImpl persistenceImpl) {
8099 super();
8100
8101 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
8102 _SQL_CONTAINSTEAM,
8103 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
8104 RowMapper.COUNT);
8105 }
8106
8107 protected boolean contains(long userId, long teamId) {
8108 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
8109 new Long(userId), new Long(teamId)
8110 });
8111
8112 if (results.size() > 0) {
8113 Integer count = results.get(0);
8114
8115 if (count.intValue() > 0) {
8116 return true;
8117 }
8118 }
8119
8120 return false;
8121 }
8122
8123 private MappingSqlQuery<Integer> _mappingSqlQuery;
8124 }
8125
8126 protected class AddTeam {
8127 protected AddTeam(UserPersistenceImpl persistenceImpl) {
8128 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
8129 "INSERT INTO Users_Teams (userId, teamId) VALUES (?, ?)",
8130 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
8131 _persistenceImpl = persistenceImpl;
8132 }
8133
8134 protected void add(long userId, long teamId) throws SystemException {
8135 if (!_persistenceImpl.containsTeam.contains(userId, teamId)) {
8136 ModelListener<com.liferay.portal.model.Team>[] teamListeners = teamPersistence.getListeners();
8137
8138 for (ModelListener<User> listener : listeners) {
8139 listener.onBeforeAddAssociation(userId,
8140 com.liferay.portal.model.Team.class.getName(), teamId);
8141 }
8142
8143 for (ModelListener<com.liferay.portal.model.Team> listener : teamListeners) {
8144 listener.onBeforeAddAssociation(teamId,
8145 User.class.getName(), userId);
8146 }
8147
8148 _sqlUpdate.update(new Object[] {
8149 new Long(userId), new Long(teamId)
8150 });
8151
8152 for (ModelListener<User> listener : listeners) {
8153 listener.onAfterAddAssociation(userId,
8154 com.liferay.portal.model.Team.class.getName(), teamId);
8155 }
8156
8157 for (ModelListener<com.liferay.portal.model.Team> listener : teamListeners) {
8158 listener.onAfterAddAssociation(teamId,
8159 User.class.getName(), userId);
8160 }
8161 }
8162 }
8163
8164 private SqlUpdate _sqlUpdate;
8165 private UserPersistenceImpl _persistenceImpl;
8166 }
8167
8168 protected class ClearTeams {
8169 protected ClearTeams(UserPersistenceImpl persistenceImpl) {
8170 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
8171 "DELETE FROM Users_Teams WHERE userId = ?",
8172 new int[] { java.sql.Types.BIGINT });
8173 }
8174
8175 protected void clear(long userId) throws SystemException {
8176 ModelListener<com.liferay.portal.model.Team>[] teamListeners = teamPersistence.getListeners();
8177
8178 List<com.liferay.portal.model.Team> teams = null;
8179
8180 if ((listeners.length > 0) || (teamListeners.length > 0)) {
8181 teams = getTeams(userId);
8182
8183 for (com.liferay.portal.model.Team team : teams) {
8184 for (ModelListener<User> listener : listeners) {
8185 listener.onBeforeRemoveAssociation(userId,
8186 com.liferay.portal.model.Team.class.getName(),
8187 team.getPrimaryKey());
8188 }
8189
8190 for (ModelListener<com.liferay.portal.model.Team> listener : teamListeners) {
8191 listener.onBeforeRemoveAssociation(team.getPrimaryKey(),
8192 User.class.getName(), userId);
8193 }
8194 }
8195 }
8196
8197 _sqlUpdate.update(new Object[] { new Long(userId) });
8198
8199 if ((listeners.length > 0) || (teamListeners.length > 0)) {
8200 for (com.liferay.portal.model.Team team : teams) {
8201 for (ModelListener<User> listener : listeners) {
8202 listener.onAfterRemoveAssociation(userId,
8203 com.liferay.portal.model.Team.class.getName(),
8204 team.getPrimaryKey());
8205 }
8206
8207 for (ModelListener<com.liferay.portal.model.Team> listener : teamListeners) {
8208 listener.onAfterRemoveAssociation(team.getPrimaryKey(),
8209 User.class.getName(), userId);
8210 }
8211 }
8212 }
8213 }
8214
8215 private SqlUpdate _sqlUpdate;
8216 }
8217
8218 protected class RemoveTeam {
8219 protected RemoveTeam(UserPersistenceImpl persistenceImpl) {
8220 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
8221 "DELETE FROM Users_Teams WHERE userId = ? AND teamId = ?",
8222 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
8223 _persistenceImpl = persistenceImpl;
8224 }
8225
8226 protected void remove(long userId, long teamId)
8227 throws SystemException {
8228 if (_persistenceImpl.containsTeam.contains(userId, teamId)) {
8229 ModelListener<com.liferay.portal.model.Team>[] teamListeners = teamPersistence.getListeners();
8230
8231 for (ModelListener<User> listener : listeners) {
8232 listener.onBeforeRemoveAssociation(userId,
8233 com.liferay.portal.model.Team.class.getName(), teamId);
8234 }
8235
8236 for (ModelListener<com.liferay.portal.model.Team> listener : teamListeners) {
8237 listener.onBeforeRemoveAssociation(teamId,
8238 User.class.getName(), userId);
8239 }
8240
8241 _sqlUpdate.update(new Object[] {
8242 new Long(userId), new Long(teamId)
8243 });
8244
8245 for (ModelListener<User> listener : listeners) {
8246 listener.onAfterRemoveAssociation(userId,
8247 com.liferay.portal.model.Team.class.getName(), teamId);
8248 }
8249
8250 for (ModelListener<com.liferay.portal.model.Team> listener : teamListeners) {
8251 listener.onAfterRemoveAssociation(teamId,
8252 User.class.getName(), userId);
8253 }
8254 }
8255 }
8256
8257 private SqlUpdate _sqlUpdate;
8258 private UserPersistenceImpl _persistenceImpl;
8259 }
8260
8261 protected class ContainsUserGroup {
8262 protected ContainsUserGroup(UserPersistenceImpl persistenceImpl) {
8263 super();
8264
8265 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
8266 _SQL_CONTAINSUSERGROUP,
8267 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
8268 RowMapper.COUNT);
8269 }
8270
8271 protected boolean contains(long userId, long userGroupId) {
8272 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
8273 new Long(userId), new Long(userGroupId)
8274 });
8275
8276 if (results.size() > 0) {
8277 Integer count = results.get(0);
8278
8279 if (count.intValue() > 0) {
8280 return true;
8281 }
8282 }
8283
8284 return false;
8285 }
8286
8287 private MappingSqlQuery<Integer> _mappingSqlQuery;
8288 }
8289
8290 protected class AddUserGroup {
8291 protected AddUserGroup(UserPersistenceImpl persistenceImpl) {
8292 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
8293 "INSERT INTO Users_UserGroups (userId, userGroupId) VALUES (?, ?)",
8294 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
8295 _persistenceImpl = persistenceImpl;
8296 }
8297
8298 protected void add(long userId, long userGroupId)
8299 throws SystemException {
8300 if (!_persistenceImpl.containsUserGroup.contains(userId, userGroupId)) {
8301 ModelListener<com.liferay.portal.model.UserGroup>[] userGroupListeners =
8302 userGroupPersistence.getListeners();
8303
8304 for (ModelListener<User> listener : listeners) {
8305 listener.onBeforeAddAssociation(userId,
8306 com.liferay.portal.model.UserGroup.class.getName(),
8307 userGroupId);
8308 }
8309
8310 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
8311 listener.onBeforeAddAssociation(userGroupId,
8312 User.class.getName(), userId);
8313 }
8314
8315 _sqlUpdate.update(new Object[] {
8316 new Long(userId), new Long(userGroupId)
8317 });
8318
8319 for (ModelListener<User> listener : listeners) {
8320 listener.onAfterAddAssociation(userId,
8321 com.liferay.portal.model.UserGroup.class.getName(),
8322 userGroupId);
8323 }
8324
8325 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
8326 listener.onAfterAddAssociation(userGroupId,
8327 User.class.getName(), userId);
8328 }
8329 }
8330 }
8331
8332 private SqlUpdate _sqlUpdate;
8333 private UserPersistenceImpl _persistenceImpl;
8334 }
8335
8336 protected class ClearUserGroups {
8337 protected ClearUserGroups(UserPersistenceImpl persistenceImpl) {
8338 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
8339 "DELETE FROM Users_UserGroups WHERE userId = ?",
8340 new int[] { java.sql.Types.BIGINT });
8341 }
8342
8343 protected void clear(long userId) throws SystemException {
8344 ModelListener<com.liferay.portal.model.UserGroup>[] userGroupListeners =
8345 userGroupPersistence.getListeners();
8346
8347 List<com.liferay.portal.model.UserGroup> userGroups = null;
8348
8349 if ((listeners.length > 0) || (userGroupListeners.length > 0)) {
8350 userGroups = getUserGroups(userId);
8351
8352 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
8353 for (ModelListener<User> listener : listeners) {
8354 listener.onBeforeRemoveAssociation(userId,
8355 com.liferay.portal.model.UserGroup.class.getName(),
8356 userGroup.getPrimaryKey());
8357 }
8358
8359 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
8360 listener.onBeforeRemoveAssociation(userGroup.getPrimaryKey(),
8361 User.class.getName(), userId);
8362 }
8363 }
8364 }
8365
8366 _sqlUpdate.update(new Object[] { new Long(userId) });
8367
8368 if ((listeners.length > 0) || (userGroupListeners.length > 0)) {
8369 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
8370 for (ModelListener<User> listener : listeners) {
8371 listener.onAfterRemoveAssociation(userId,
8372 com.liferay.portal.model.UserGroup.class.getName(),
8373 userGroup.getPrimaryKey());
8374 }
8375
8376 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
8377 listener.onAfterRemoveAssociation(userGroup.getPrimaryKey(),
8378 User.class.getName(), userId);
8379 }
8380 }
8381 }
8382 }
8383
8384 private SqlUpdate _sqlUpdate;
8385 }
8386
8387 protected class RemoveUserGroup {
8388 protected RemoveUserGroup(UserPersistenceImpl persistenceImpl) {
8389 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
8390 "DELETE FROM Users_UserGroups WHERE userId = ? AND userGroupId = ?",
8391 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
8392 _persistenceImpl = persistenceImpl;
8393 }
8394
8395 protected void remove(long userId, long userGroupId)
8396 throws SystemException {
8397 if (_persistenceImpl.containsUserGroup.contains(userId, userGroupId)) {
8398 ModelListener<com.liferay.portal.model.UserGroup>[] userGroupListeners =
8399 userGroupPersistence.getListeners();
8400
8401 for (ModelListener<User> listener : listeners) {
8402 listener.onBeforeRemoveAssociation(userId,
8403 com.liferay.portal.model.UserGroup.class.getName(),
8404 userGroupId);
8405 }
8406
8407 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
8408 listener.onBeforeRemoveAssociation(userGroupId,
8409 User.class.getName(), userId);
8410 }
8411
8412 _sqlUpdate.update(new Object[] {
8413 new Long(userId), new Long(userGroupId)
8414 });
8415
8416 for (ModelListener<User> listener : listeners) {
8417 listener.onAfterRemoveAssociation(userId,
8418 com.liferay.portal.model.UserGroup.class.getName(),
8419 userGroupId);
8420 }
8421
8422 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
8423 listener.onAfterRemoveAssociation(userGroupId,
8424 User.class.getName(), userId);
8425 }
8426 }
8427 }
8428
8429 private SqlUpdate _sqlUpdate;
8430 private UserPersistenceImpl _persistenceImpl;
8431 }
8432
8433 private static final String _SQL_SELECT_USER = "SELECT user FROM User user";
8434 private static final String _SQL_SELECT_USER_WHERE = "SELECT user FROM User user WHERE ";
8435 private static final String _SQL_COUNT_USER = "SELECT COUNT(user) FROM User user";
8436 private static final String _SQL_COUNT_USER_WHERE = "SELECT COUNT(user) FROM User user WHERE ";
8437 private static final String _SQL_GETGROUPS = "SELECT {Group_.*} FROM Group_ INNER JOIN Users_Groups ON (Users_Groups.groupId = Group_.groupId) WHERE (Users_Groups.userId = ?)";
8438 private static final String _SQL_GETGROUPSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Groups WHERE userId = ?";
8439 private static final String _SQL_CONTAINSGROUP = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Groups WHERE userId = ? AND groupId = ?";
8440 private static final String _SQL_GETORGANIZATIONS = "SELECT {Organization_.*} FROM Organization_ INNER JOIN Users_Orgs ON (Users_Orgs.organizationId = Organization_.organizationId) WHERE (Users_Orgs.userId = ?)";
8441 private static final String _SQL_GETORGANIZATIONSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Orgs WHERE userId = ?";
8442 private static final String _SQL_CONTAINSORGANIZATION = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Orgs WHERE userId = ? AND organizationId = ?";
8443 private static final String _SQL_GETPERMISSIONS = "SELECT {Permission_.*} FROM Permission_ INNER JOIN Users_Permissions ON (Users_Permissions.permissionId = Permission_.permissionId) WHERE (Users_Permissions.userId = ?)";
8444 private static final String _SQL_GETPERMISSIONSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Permissions WHERE userId = ?";
8445 private static final String _SQL_CONTAINSPERMISSION = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Permissions WHERE userId = ? AND permissionId = ?";
8446 private static final String _SQL_GETROLES = "SELECT {Role_.*} FROM Role_ INNER JOIN Users_Roles ON (Users_Roles.roleId = Role_.roleId) WHERE (Users_Roles.userId = ?)";
8447 private static final String _SQL_GETROLESSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Roles WHERE userId = ?";
8448 private static final String _SQL_CONTAINSROLE = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Roles WHERE userId = ? AND roleId = ?";
8449 private static final String _SQL_GETTEAMS = "SELECT {Team.*} FROM Team INNER JOIN Users_Teams ON (Users_Teams.teamId = Team.teamId) WHERE (Users_Teams.userId = ?)";
8450 private static final String _SQL_GETTEAMSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Teams WHERE userId = ?";
8451 private static final String _SQL_CONTAINSTEAM = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Teams WHERE userId = ? AND teamId = ?";
8452 private static final String _SQL_GETUSERGROUPS = "SELECT {UserGroup.*} FROM UserGroup INNER JOIN Users_UserGroups ON (Users_UserGroups.userGroupId = UserGroup.userGroupId) WHERE (Users_UserGroups.userId = ?)";
8453 private static final String _SQL_GETUSERGROUPSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_UserGroups WHERE userId = ?";
8454 private static final String _SQL_CONTAINSUSERGROUP = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_UserGroups WHERE userId = ? AND userGroupId = ?";
8455 private static final String _FINDER_COLUMN_UUID_UUID_1 = "user.uuid IS NULL";
8456 private static final String _FINDER_COLUMN_UUID_UUID_2 = "user.uuid = ?";
8457 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(user.uuid IS NULL OR user.uuid = ?)";
8458 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "user.companyId = ?";
8459 private static final String _FINDER_COLUMN_CONTACTID_CONTACTID_2 = "user.contactId = ?";
8460 private static final String _FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_1 = "user.emailAddress IS NULL";
8461 private static final String _FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_2 = "user.emailAddress = ?";
8462 private static final String _FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_3 = "(user.emailAddress IS NULL OR user.emailAddress = ?)";
8463 private static final String _FINDER_COLUMN_PORTRAITID_PORTRAITID_2 = "user.portraitId = ?";
8464 private static final String _FINDER_COLUMN_C_U_COMPANYID_2 = "user.companyId = ? AND ";
8465 private static final String _FINDER_COLUMN_C_U_USERID_2 = "user.userId = ?";
8466 private static final String _FINDER_COLUMN_C_DU_COMPANYID_2 = "user.companyId = ? AND ";
8467 private static final String _FINDER_COLUMN_C_DU_DEFAULTUSER_2 = "user.defaultUser = ?";
8468 private static final String _FINDER_COLUMN_C_SN_COMPANYID_2 = "user.companyId = ? AND ";
8469 private static final String _FINDER_COLUMN_C_SN_SCREENNAME_1 = "user.screenName IS NULL";
8470 private static final String _FINDER_COLUMN_C_SN_SCREENNAME_2 = "user.screenName = ?";
8471 private static final String _FINDER_COLUMN_C_SN_SCREENNAME_3 = "(user.screenName IS NULL OR user.screenName = ?)";
8472 private static final String _FINDER_COLUMN_C_EA_COMPANYID_2 = "user.companyId = ? AND ";
8473 private static final String _FINDER_COLUMN_C_EA_EMAILADDRESS_1 = "user.emailAddress IS NULL";
8474 private static final String _FINDER_COLUMN_C_EA_EMAILADDRESS_2 = "user.emailAddress = ?";
8475 private static final String _FINDER_COLUMN_C_EA_EMAILADDRESS_3 = "(user.emailAddress IS NULL OR user.emailAddress = ?)";
8476 private static final String _FINDER_COLUMN_C_FID_COMPANYID_2 = "user.companyId = ? AND ";
8477 private static final String _FINDER_COLUMN_C_FID_FACEBOOKID_2 = "user.facebookId = ?";
8478 private static final String _FINDER_COLUMN_C_O_COMPANYID_2 = "user.companyId = ? AND ";
8479 private static final String _FINDER_COLUMN_C_O_OPENID_1 = "user.openId IS NULL";
8480 private static final String _FINDER_COLUMN_C_O_OPENID_2 = "user.openId = ?";
8481 private static final String _FINDER_COLUMN_C_O_OPENID_3 = "(user.openId IS NULL OR user.openId = ?)";
8482 private static final String _FINDER_COLUMN_C_A_COMPANYID_2 = "user.companyId = ? AND ";
8483 private static final String _FINDER_COLUMN_C_A_ACTIVE_2 = "user.active = ?";
8484 private static final String _ORDER_BY_ENTITY_ALIAS = "user.";
8485 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No User exists with the primary key ";
8486 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No User exists with the key {";
8487 private static Log _log = LogFactoryUtil.getLog(UserPersistenceImpl.class);
8488 }