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 if (user.isCachedModel() || BatchSessionUtil.isEnabled()) {
463 Object staleObject = session.get(UserImpl.class,
464 user.getPrimaryKeyObj());
465
466 if (staleObject != null) {
467 session.evict(staleObject);
468 }
469 }
470
471 session.delete(user);
472
473 session.flush();
474 }
475 catch (Exception e) {
476 throw processException(e);
477 }
478 finally {
479 closeSession(session);
480 }
481
482 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
483
484 UserModelImpl userModelImpl = (UserModelImpl)user;
485
486 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_CONTACTID,
487 new Object[] { new Long(userModelImpl.getOriginalContactId()) });
488
489 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_PORTRAITID,
490 new Object[] { new Long(userModelImpl.getOriginalPortraitId()) });
491
492 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_U,
493 new Object[] {
494 new Long(userModelImpl.getOriginalCompanyId()),
495 new Long(userModelImpl.getOriginalUserId())
496 });
497
498 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_DU,
499 new Object[] {
500 new Long(userModelImpl.getOriginalCompanyId()),
501 Boolean.valueOf(userModelImpl.getOriginalDefaultUser())
502 });
503
504 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_SN,
505 new Object[] {
506 new Long(userModelImpl.getOriginalCompanyId()),
507
508 userModelImpl.getOriginalScreenName()
509 });
510
511 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_EA,
512 new Object[] {
513 new Long(userModelImpl.getOriginalCompanyId()),
514
515 userModelImpl.getOriginalEmailAddress()
516 });
517
518 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_FID,
519 new Object[] {
520 new Long(userModelImpl.getOriginalCompanyId()),
521 new Long(userModelImpl.getOriginalFacebookId())
522 });
523
524 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_O,
525 new Object[] {
526 new Long(userModelImpl.getOriginalCompanyId()),
527
528 userModelImpl.getOriginalOpenId()
529 });
530
531 EntityCacheUtil.removeResult(UserModelImpl.ENTITY_CACHE_ENABLED,
532 UserImpl.class, user.getPrimaryKey());
533
534 return user;
535 }
536
537 public User updateImpl(com.liferay.portal.model.User user, boolean merge)
538 throws SystemException {
539 user = toUnwrappedModel(user);
540
541 boolean isNew = user.isNew();
542
543 UserModelImpl userModelImpl = (UserModelImpl)user;
544
545 if (Validator.isNull(user.getUuid())) {
546 String uuid = PortalUUIDUtil.generate();
547
548 user.setUuid(uuid);
549 }
550
551 Session session = null;
552
553 try {
554 session = openSession();
555
556 BatchSessionUtil.update(session, user, merge);
557
558 user.setNew(false);
559 }
560 catch (Exception e) {
561 throw processException(e);
562 }
563 finally {
564 closeSession(session);
565 }
566
567 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
568
569 EntityCacheUtil.putResult(UserModelImpl.ENTITY_CACHE_ENABLED,
570 UserImpl.class, user.getPrimaryKey(), user);
571
572 if (!isNew &&
573 (user.getContactId() != userModelImpl.getOriginalContactId())) {
574 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_CONTACTID,
575 new Object[] { new Long(userModelImpl.getOriginalContactId()) });
576 }
577
578 if (isNew ||
579 (user.getContactId() != userModelImpl.getOriginalContactId())) {
580 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CONTACTID,
581 new Object[] { new Long(user.getContactId()) }, user);
582 }
583
584 if (!isNew &&
585 (user.getPortraitId() != userModelImpl.getOriginalPortraitId())) {
586 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_PORTRAITID,
587 new Object[] { new Long(userModelImpl.getOriginalPortraitId()) });
588 }
589
590 if (isNew ||
591 (user.getPortraitId() != userModelImpl.getOriginalPortraitId())) {
592 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_PORTRAITID,
593 new Object[] { new Long(user.getPortraitId()) }, user);
594 }
595
596 if (!isNew &&
597 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
598 (user.getUserId() != userModelImpl.getOriginalUserId()))) {
599 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_U,
600 new Object[] {
601 new Long(userModelImpl.getOriginalCompanyId()),
602 new Long(userModelImpl.getOriginalUserId())
603 });
604 }
605
606 if (isNew ||
607 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
608 (user.getUserId() != userModelImpl.getOriginalUserId()))) {
609 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_U,
610 new Object[] {
611 new Long(user.getCompanyId()), new Long(user.getUserId())
612 }, user);
613 }
614
615 if (!isNew &&
616 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
617 (user.getDefaultUser() != userModelImpl.getOriginalDefaultUser()))) {
618 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_DU,
619 new Object[] {
620 new Long(userModelImpl.getOriginalCompanyId()),
621 Boolean.valueOf(userModelImpl.getOriginalDefaultUser())
622 });
623 }
624
625 if (isNew ||
626 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
627 (user.getDefaultUser() != userModelImpl.getOriginalDefaultUser()))) {
628 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_DU,
629 new Object[] {
630 new Long(user.getCompanyId()),
631 Boolean.valueOf(user.getDefaultUser())
632 }, user);
633 }
634
635 if (!isNew &&
636 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
637 !Validator.equals(user.getScreenName(),
638 userModelImpl.getOriginalScreenName()))) {
639 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_SN,
640 new Object[] {
641 new Long(userModelImpl.getOriginalCompanyId()),
642
643 userModelImpl.getOriginalScreenName()
644 });
645 }
646
647 if (isNew ||
648 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
649 !Validator.equals(user.getScreenName(),
650 userModelImpl.getOriginalScreenName()))) {
651 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_SN,
652 new Object[] { new Long(user.getCompanyId()), user.getScreenName() },
653 user);
654 }
655
656 if (!isNew &&
657 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
658 !Validator.equals(user.getEmailAddress(),
659 userModelImpl.getOriginalEmailAddress()))) {
660 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_EA,
661 new Object[] {
662 new Long(userModelImpl.getOriginalCompanyId()),
663
664 userModelImpl.getOriginalEmailAddress()
665 });
666 }
667
668 if (isNew ||
669 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
670 !Validator.equals(user.getEmailAddress(),
671 userModelImpl.getOriginalEmailAddress()))) {
672 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_EA,
673 new Object[] {
674 new Long(user.getCompanyId()),
675
676 user.getEmailAddress()
677 }, user);
678 }
679
680 if (!isNew &&
681 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
682 (user.getFacebookId() != userModelImpl.getOriginalFacebookId()))) {
683 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_FID,
684 new Object[] {
685 new Long(userModelImpl.getOriginalCompanyId()),
686 new Long(userModelImpl.getOriginalFacebookId())
687 });
688 }
689
690 if (isNew ||
691 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
692 (user.getFacebookId() != userModelImpl.getOriginalFacebookId()))) {
693 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_FID,
694 new Object[] {
695 new Long(user.getCompanyId()),
696 new Long(user.getFacebookId())
697 }, user);
698 }
699
700 if (!isNew &&
701 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
702 !Validator.equals(user.getOpenId(),
703 userModelImpl.getOriginalOpenId()))) {
704 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_O,
705 new Object[] {
706 new Long(userModelImpl.getOriginalCompanyId()),
707
708 userModelImpl.getOriginalOpenId()
709 });
710 }
711
712 if (isNew ||
713 ((user.getCompanyId() != userModelImpl.getOriginalCompanyId()) ||
714 !Validator.equals(user.getOpenId(),
715 userModelImpl.getOriginalOpenId()))) {
716 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_O,
717 new Object[] { new Long(user.getCompanyId()), user.getOpenId() },
718 user);
719 }
720
721 return user;
722 }
723
724 protected User toUnwrappedModel(User user) {
725 if (user instanceof UserImpl) {
726 return user;
727 }
728
729 UserImpl userImpl = new UserImpl();
730
731 userImpl.setNew(user.isNew());
732 userImpl.setPrimaryKey(user.getPrimaryKey());
733
734 userImpl.setUuid(user.getUuid());
735 userImpl.setUserId(user.getUserId());
736 userImpl.setCompanyId(user.getCompanyId());
737 userImpl.setCreateDate(user.getCreateDate());
738 userImpl.setModifiedDate(user.getModifiedDate());
739 userImpl.setDefaultUser(user.isDefaultUser());
740 userImpl.setContactId(user.getContactId());
741 userImpl.setPassword(user.getPassword());
742 userImpl.setPasswordEncrypted(user.isPasswordEncrypted());
743 userImpl.setPasswordReset(user.isPasswordReset());
744 userImpl.setPasswordModifiedDate(user.getPasswordModifiedDate());
745 userImpl.setReminderQueryQuestion(user.getReminderQueryQuestion());
746 userImpl.setReminderQueryAnswer(user.getReminderQueryAnswer());
747 userImpl.setGraceLoginCount(user.getGraceLoginCount());
748 userImpl.setScreenName(user.getScreenName());
749 userImpl.setEmailAddress(user.getEmailAddress());
750 userImpl.setFacebookId(user.getFacebookId());
751 userImpl.setOpenId(user.getOpenId());
752 userImpl.setPortraitId(user.getPortraitId());
753 userImpl.setLanguageId(user.getLanguageId());
754 userImpl.setTimeZoneId(user.getTimeZoneId());
755 userImpl.setGreeting(user.getGreeting());
756 userImpl.setComments(user.getComments());
757 userImpl.setFirstName(user.getFirstName());
758 userImpl.setMiddleName(user.getMiddleName());
759 userImpl.setLastName(user.getLastName());
760 userImpl.setJobTitle(user.getJobTitle());
761 userImpl.setLoginDate(user.getLoginDate());
762 userImpl.setLoginIP(user.getLoginIP());
763 userImpl.setLastLoginDate(user.getLastLoginDate());
764 userImpl.setLastLoginIP(user.getLastLoginIP());
765 userImpl.setLastFailedLoginDate(user.getLastFailedLoginDate());
766 userImpl.setFailedLoginAttempts(user.getFailedLoginAttempts());
767 userImpl.setLockout(user.isLockout());
768 userImpl.setLockoutDate(user.getLockoutDate());
769 userImpl.setAgreedToTermsOfUse(user.isAgreedToTermsOfUse());
770 userImpl.setActive(user.isActive());
771
772 return userImpl;
773 }
774
775
783 public User findByPrimaryKey(Serializable primaryKey)
784 throws NoSuchModelException, SystemException {
785 return findByPrimaryKey(((Long)primaryKey).longValue());
786 }
787
788
796 public User findByPrimaryKey(long userId)
797 throws NoSuchUserException, SystemException {
798 User user = fetchByPrimaryKey(userId);
799
800 if (user == null) {
801 if (_log.isWarnEnabled()) {
802 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + userId);
803 }
804
805 throw new NoSuchUserException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
806 userId);
807 }
808
809 return user;
810 }
811
812
819 public User fetchByPrimaryKey(Serializable primaryKey)
820 throws SystemException {
821 return fetchByPrimaryKey(((Long)primaryKey).longValue());
822 }
823
824
831 public User fetchByPrimaryKey(long userId) throws SystemException {
832 User user = (User)EntityCacheUtil.getResult(UserModelImpl.ENTITY_CACHE_ENABLED,
833 UserImpl.class, userId, this);
834
835 if (user == null) {
836 Session session = null;
837
838 try {
839 session = openSession();
840
841 user = (User)session.get(UserImpl.class, new Long(userId));
842 }
843 catch (Exception e) {
844 throw processException(e);
845 }
846 finally {
847 if (user != null) {
848 cacheResult(user);
849 }
850
851 closeSession(session);
852 }
853 }
854
855 return user;
856 }
857
858
865 public List<User> findByUuid(String uuid) throws SystemException {
866 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
867 }
868
869
882 public List<User> findByUuid(String uuid, int start, int end)
883 throws SystemException {
884 return findByUuid(uuid, start, end, null);
885 }
886
887
901 public List<User> findByUuid(String uuid, int start, int end,
902 OrderByComparator orderByComparator) throws SystemException {
903 Object[] finderArgs = new Object[] {
904 uuid,
905
906 String.valueOf(start), String.valueOf(end),
907 String.valueOf(orderByComparator)
908 };
909
910 List<User> list = (List<User>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
911 finderArgs, this);
912
913 if (list == null) {
914 Session session = null;
915
916 try {
917 session = openSession();
918
919 StringBundler query = null;
920
921 if (orderByComparator != null) {
922 query = new StringBundler(3 +
923 (orderByComparator.getOrderByFields().length * 3));
924 }
925 else {
926 query = new StringBundler(2);
927 }
928
929 query.append(_SQL_SELECT_USER_WHERE);
930
931 if (uuid == null) {
932 query.append(_FINDER_COLUMN_UUID_UUID_1);
933 }
934 else {
935 if (uuid.equals(StringPool.BLANK)) {
936 query.append(_FINDER_COLUMN_UUID_UUID_3);
937 }
938 else {
939 query.append(_FINDER_COLUMN_UUID_UUID_2);
940 }
941 }
942
943 if (orderByComparator != null) {
944 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
945 orderByComparator);
946 }
947
948 String sql = query.toString();
949
950 Query q = session.createQuery(sql);
951
952 QueryPos qPos = QueryPos.getInstance(q);
953
954 if (uuid != null) {
955 qPos.add(uuid);
956 }
957
958 list = (List<User>)QueryUtil.list(q, getDialect(), start, end);
959 }
960 catch (Exception e) {
961 throw processException(e);
962 }
963 finally {
964 if (list == null) {
965 list = new ArrayList<User>();
966 }
967
968 cacheResult(list);
969
970 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
971 list);
972
973 closeSession(session);
974 }
975 }
976
977 return list;
978 }
979
980
993 public User findByUuid_First(String uuid,
994 OrderByComparator orderByComparator)
995 throws NoSuchUserException, SystemException {
996 List<User> list = findByUuid(uuid, 0, 1, orderByComparator);
997
998 if (list.isEmpty()) {
999 StringBundler msg = new StringBundler(4);
1000
1001 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1002
1003 msg.append("uuid=");
1004 msg.append(uuid);
1005
1006 msg.append(StringPool.CLOSE_CURLY_BRACE);
1007
1008 throw new NoSuchUserException(msg.toString());
1009 }
1010 else {
1011 return list.get(0);
1012 }
1013 }
1014
1015
1028 public User findByUuid_Last(String uuid, OrderByComparator orderByComparator)
1029 throws NoSuchUserException, SystemException {
1030 int count = countByUuid(uuid);
1031
1032 List<User> list = findByUuid(uuid, count - 1, count, orderByComparator);
1033
1034 if (list.isEmpty()) {
1035 StringBundler msg = new StringBundler(4);
1036
1037 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1038
1039 msg.append("uuid=");
1040 msg.append(uuid);
1041
1042 msg.append(StringPool.CLOSE_CURLY_BRACE);
1043
1044 throw new NoSuchUserException(msg.toString());
1045 }
1046 else {
1047 return list.get(0);
1048 }
1049 }
1050
1051
1065 public User[] findByUuid_PrevAndNext(long userId, String uuid,
1066 OrderByComparator orderByComparator)
1067 throws NoSuchUserException, SystemException {
1068 User user = findByPrimaryKey(userId);
1069
1070 Session session = null;
1071
1072 try {
1073 session = openSession();
1074
1075 User[] array = new UserImpl[3];
1076
1077 array[0] = getByUuid_PrevAndNext(session, user, uuid,
1078 orderByComparator, true);
1079
1080 array[1] = user;
1081
1082 array[2] = getByUuid_PrevAndNext(session, user, uuid,
1083 orderByComparator, false);
1084
1085 return array;
1086 }
1087 catch (Exception e) {
1088 throw processException(e);
1089 }
1090 finally {
1091 closeSession(session);
1092 }
1093 }
1094
1095 protected User getByUuid_PrevAndNext(Session session, User user,
1096 String uuid, OrderByComparator orderByComparator, boolean previous) {
1097 StringBundler query = null;
1098
1099 if (orderByComparator != null) {
1100 query = new StringBundler(6 +
1101 (orderByComparator.getOrderByFields().length * 6));
1102 }
1103 else {
1104 query = new StringBundler(3);
1105 }
1106
1107 query.append(_SQL_SELECT_USER_WHERE);
1108
1109 if (uuid == null) {
1110 query.append(_FINDER_COLUMN_UUID_UUID_1);
1111 }
1112 else {
1113 if (uuid.equals(StringPool.BLANK)) {
1114 query.append(_FINDER_COLUMN_UUID_UUID_3);
1115 }
1116 else {
1117 query.append(_FINDER_COLUMN_UUID_UUID_2);
1118 }
1119 }
1120
1121 if (orderByComparator != null) {
1122 String[] orderByFields = orderByComparator.getOrderByFields();
1123
1124 if (orderByFields.length > 0) {
1125 query.append(WHERE_AND);
1126 }
1127
1128 for (int i = 0; i < orderByFields.length; i++) {
1129 query.append(_ORDER_BY_ENTITY_ALIAS);
1130 query.append(orderByFields[i]);
1131
1132 if ((i + 1) < orderByFields.length) {
1133 if (orderByComparator.isAscending() ^ previous) {
1134 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1135 }
1136 else {
1137 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1138 }
1139 }
1140 else {
1141 if (orderByComparator.isAscending() ^ previous) {
1142 query.append(WHERE_GREATER_THAN);
1143 }
1144 else {
1145 query.append(WHERE_LESSER_THAN);
1146 }
1147 }
1148 }
1149
1150 query.append(ORDER_BY_CLAUSE);
1151
1152 for (int i = 0; i < orderByFields.length; i++) {
1153 query.append(_ORDER_BY_ENTITY_ALIAS);
1154 query.append(orderByFields[i]);
1155
1156 if ((i + 1) < orderByFields.length) {
1157 if (orderByComparator.isAscending() ^ previous) {
1158 query.append(ORDER_BY_ASC_HAS_NEXT);
1159 }
1160 else {
1161 query.append(ORDER_BY_DESC_HAS_NEXT);
1162 }
1163 }
1164 else {
1165 if (orderByComparator.isAscending() ^ previous) {
1166 query.append(ORDER_BY_ASC);
1167 }
1168 else {
1169 query.append(ORDER_BY_DESC);
1170 }
1171 }
1172 }
1173 }
1174
1175 String sql = query.toString();
1176
1177 Query q = session.createQuery(sql);
1178
1179 q.setFirstResult(0);
1180 q.setMaxResults(2);
1181
1182 QueryPos qPos = QueryPos.getInstance(q);
1183
1184 if (uuid != null) {
1185 qPos.add(uuid);
1186 }
1187
1188 if (orderByComparator != null) {
1189 Object[] values = orderByComparator.getOrderByValues(user);
1190
1191 for (Object value : values) {
1192 qPos.add(value);
1193 }
1194 }
1195
1196 List<User> list = q.list();
1197
1198 if (list.size() == 2) {
1199 return list.get(1);
1200 }
1201 else {
1202 return null;
1203 }
1204 }
1205
1206
1213 public List<User> findByCompanyId(long companyId) throws SystemException {
1214 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1215 null);
1216 }
1217
1218
1231 public List<User> findByCompanyId(long companyId, int start, int end)
1232 throws SystemException {
1233 return findByCompanyId(companyId, start, end, null);
1234 }
1235
1236
1250 public List<User> findByCompanyId(long companyId, int start, int end,
1251 OrderByComparator orderByComparator) throws SystemException {
1252 Object[] finderArgs = new Object[] {
1253 companyId,
1254
1255 String.valueOf(start), String.valueOf(end),
1256 String.valueOf(orderByComparator)
1257 };
1258
1259 List<User> list = (List<User>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
1260 finderArgs, this);
1261
1262 if (list == null) {
1263 Session session = null;
1264
1265 try {
1266 session = openSession();
1267
1268 StringBundler query = null;
1269
1270 if (orderByComparator != null) {
1271 query = new StringBundler(3 +
1272 (orderByComparator.getOrderByFields().length * 3));
1273 }
1274 else {
1275 query = new StringBundler(2);
1276 }
1277
1278 query.append(_SQL_SELECT_USER_WHERE);
1279
1280 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1281
1282 if (orderByComparator != null) {
1283 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1284 orderByComparator);
1285 }
1286
1287 String sql = query.toString();
1288
1289 Query q = session.createQuery(sql);
1290
1291 QueryPos qPos = QueryPos.getInstance(q);
1292
1293 qPos.add(companyId);
1294
1295 list = (List<User>)QueryUtil.list(q, getDialect(), start, end);
1296 }
1297 catch (Exception e) {
1298 throw processException(e);
1299 }
1300 finally {
1301 if (list == null) {
1302 list = new ArrayList<User>();
1303 }
1304
1305 cacheResult(list);
1306
1307 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
1308 finderArgs, list);
1309
1310 closeSession(session);
1311 }
1312 }
1313
1314 return list;
1315 }
1316
1317
1330 public User findByCompanyId_First(long companyId,
1331 OrderByComparator orderByComparator)
1332 throws NoSuchUserException, SystemException {
1333 List<User> list = findByCompanyId(companyId, 0, 1, orderByComparator);
1334
1335 if (list.isEmpty()) {
1336 StringBundler msg = new StringBundler(4);
1337
1338 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1339
1340 msg.append("companyId=");
1341 msg.append(companyId);
1342
1343 msg.append(StringPool.CLOSE_CURLY_BRACE);
1344
1345 throw new NoSuchUserException(msg.toString());
1346 }
1347 else {
1348 return list.get(0);
1349 }
1350 }
1351
1352
1365 public User findByCompanyId_Last(long companyId,
1366 OrderByComparator orderByComparator)
1367 throws NoSuchUserException, SystemException {
1368 int count = countByCompanyId(companyId);
1369
1370 List<User> list = findByCompanyId(companyId, count - 1, count,
1371 orderByComparator);
1372
1373 if (list.isEmpty()) {
1374 StringBundler msg = new StringBundler(4);
1375
1376 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1377
1378 msg.append("companyId=");
1379 msg.append(companyId);
1380
1381 msg.append(StringPool.CLOSE_CURLY_BRACE);
1382
1383 throw new NoSuchUserException(msg.toString());
1384 }
1385 else {
1386 return list.get(0);
1387 }
1388 }
1389
1390
1404 public User[] findByCompanyId_PrevAndNext(long userId, long companyId,
1405 OrderByComparator orderByComparator)
1406 throws NoSuchUserException, SystemException {
1407 User user = findByPrimaryKey(userId);
1408
1409 Session session = null;
1410
1411 try {
1412 session = openSession();
1413
1414 User[] array = new UserImpl[3];
1415
1416 array[0] = getByCompanyId_PrevAndNext(session, user, companyId,
1417 orderByComparator, true);
1418
1419 array[1] = user;
1420
1421 array[2] = getByCompanyId_PrevAndNext(session, user, companyId,
1422 orderByComparator, false);
1423
1424 return array;
1425 }
1426 catch (Exception e) {
1427 throw processException(e);
1428 }
1429 finally {
1430 closeSession(session);
1431 }
1432 }
1433
1434 protected User getByCompanyId_PrevAndNext(Session session, User user,
1435 long companyId, OrderByComparator orderByComparator, boolean previous) {
1436 StringBundler query = null;
1437
1438 if (orderByComparator != null) {
1439 query = new StringBundler(6 +
1440 (orderByComparator.getOrderByFields().length * 6));
1441 }
1442 else {
1443 query = new StringBundler(3);
1444 }
1445
1446 query.append(_SQL_SELECT_USER_WHERE);
1447
1448 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1449
1450 if (orderByComparator != null) {
1451 String[] orderByFields = orderByComparator.getOrderByFields();
1452
1453 if (orderByFields.length > 0) {
1454 query.append(WHERE_AND);
1455 }
1456
1457 for (int i = 0; i < orderByFields.length; i++) {
1458 query.append(_ORDER_BY_ENTITY_ALIAS);
1459 query.append(orderByFields[i]);
1460
1461 if ((i + 1) < orderByFields.length) {
1462 if (orderByComparator.isAscending() ^ previous) {
1463 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1464 }
1465 else {
1466 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1467 }
1468 }
1469 else {
1470 if (orderByComparator.isAscending() ^ previous) {
1471 query.append(WHERE_GREATER_THAN);
1472 }
1473 else {
1474 query.append(WHERE_LESSER_THAN);
1475 }
1476 }
1477 }
1478
1479 query.append(ORDER_BY_CLAUSE);
1480
1481 for (int i = 0; i < orderByFields.length; i++) {
1482 query.append(_ORDER_BY_ENTITY_ALIAS);
1483 query.append(orderByFields[i]);
1484
1485 if ((i + 1) < orderByFields.length) {
1486 if (orderByComparator.isAscending() ^ previous) {
1487 query.append(ORDER_BY_ASC_HAS_NEXT);
1488 }
1489 else {
1490 query.append(ORDER_BY_DESC_HAS_NEXT);
1491 }
1492 }
1493 else {
1494 if (orderByComparator.isAscending() ^ previous) {
1495 query.append(ORDER_BY_ASC);
1496 }
1497 else {
1498 query.append(ORDER_BY_DESC);
1499 }
1500 }
1501 }
1502 }
1503
1504 String sql = query.toString();
1505
1506 Query q = session.createQuery(sql);
1507
1508 q.setFirstResult(0);
1509 q.setMaxResults(2);
1510
1511 QueryPos qPos = QueryPos.getInstance(q);
1512
1513 qPos.add(companyId);
1514
1515 if (orderByComparator != null) {
1516 Object[] values = orderByComparator.getOrderByValues(user);
1517
1518 for (Object value : values) {
1519 qPos.add(value);
1520 }
1521 }
1522
1523 List<User> list = q.list();
1524
1525 if (list.size() == 2) {
1526 return list.get(1);
1527 }
1528 else {
1529 return null;
1530 }
1531 }
1532
1533
1541 public User findByContactId(long contactId)
1542 throws NoSuchUserException, SystemException {
1543 User user = fetchByContactId(contactId);
1544
1545 if (user == null) {
1546 StringBundler msg = new StringBundler(4);
1547
1548 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1549
1550 msg.append("contactId=");
1551 msg.append(contactId);
1552
1553 msg.append(StringPool.CLOSE_CURLY_BRACE);
1554
1555 if (_log.isWarnEnabled()) {
1556 _log.warn(msg.toString());
1557 }
1558
1559 throw new NoSuchUserException(msg.toString());
1560 }
1561
1562 return user;
1563 }
1564
1565
1572 public User fetchByContactId(long contactId) throws SystemException {
1573 return fetchByContactId(contactId, true);
1574 }
1575
1576
1583 public User fetchByContactId(long contactId, boolean retrieveFromCache)
1584 throws SystemException {
1585 Object[] finderArgs = new Object[] { contactId };
1586
1587 Object result = null;
1588
1589 if (retrieveFromCache) {
1590 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_CONTACTID,
1591 finderArgs, this);
1592 }
1593
1594 if (result == null) {
1595 Session session = null;
1596
1597 try {
1598 session = openSession();
1599
1600 StringBundler query = new StringBundler(2);
1601
1602 query.append(_SQL_SELECT_USER_WHERE);
1603
1604 query.append(_FINDER_COLUMN_CONTACTID_CONTACTID_2);
1605
1606 String sql = query.toString();
1607
1608 Query q = session.createQuery(sql);
1609
1610 QueryPos qPos = QueryPos.getInstance(q);
1611
1612 qPos.add(contactId);
1613
1614 List<User> list = q.list();
1615
1616 result = list;
1617
1618 User user = null;
1619
1620 if (list.isEmpty()) {
1621 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CONTACTID,
1622 finderArgs, list);
1623 }
1624 else {
1625 user = list.get(0);
1626
1627 cacheResult(user);
1628
1629 if ((user.getContactId() != contactId)) {
1630 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CONTACTID,
1631 finderArgs, user);
1632 }
1633 }
1634
1635 return user;
1636 }
1637 catch (Exception e) {
1638 throw processException(e);
1639 }
1640 finally {
1641 if (result == null) {
1642 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CONTACTID,
1643 finderArgs, new ArrayList<User>());
1644 }
1645
1646 closeSession(session);
1647 }
1648 }
1649 else {
1650 if (result instanceof List<?>) {
1651 return null;
1652 }
1653 else {
1654 return (User)result;
1655 }
1656 }
1657 }
1658
1659
1666 public List<User> findByEmailAddress(String emailAddress)
1667 throws SystemException {
1668 return findByEmailAddress(emailAddress, QueryUtil.ALL_POS,
1669 QueryUtil.ALL_POS, null);
1670 }
1671
1672
1685 public List<User> findByEmailAddress(String emailAddress, int start, int end)
1686 throws SystemException {
1687 return findByEmailAddress(emailAddress, start, end, null);
1688 }
1689
1690
1704 public List<User> findByEmailAddress(String emailAddress, int start,
1705 int end, OrderByComparator orderByComparator) throws SystemException {
1706 Object[] finderArgs = new Object[] {
1707 emailAddress,
1708
1709 String.valueOf(start), String.valueOf(end),
1710 String.valueOf(orderByComparator)
1711 };
1712
1713 List<User> list = (List<User>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_EMAILADDRESS,
1714 finderArgs, this);
1715
1716 if (list == null) {
1717 Session session = null;
1718
1719 try {
1720 session = openSession();
1721
1722 StringBundler query = null;
1723
1724 if (orderByComparator != null) {
1725 query = new StringBundler(3 +
1726 (orderByComparator.getOrderByFields().length * 3));
1727 }
1728 else {
1729 query = new StringBundler(2);
1730 }
1731
1732 query.append(_SQL_SELECT_USER_WHERE);
1733
1734 if (emailAddress == null) {
1735 query.append(_FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_1);
1736 }
1737 else {
1738 if (emailAddress.equals(StringPool.BLANK)) {
1739 query.append(_FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_3);
1740 }
1741 else {
1742 query.append(_FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_2);
1743 }
1744 }
1745
1746 if (orderByComparator != null) {
1747 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1748 orderByComparator);
1749 }
1750
1751 String sql = query.toString();
1752
1753 Query q = session.createQuery(sql);
1754
1755 QueryPos qPos = QueryPos.getInstance(q);
1756
1757 if (emailAddress != null) {
1758 qPos.add(emailAddress);
1759 }
1760
1761 list = (List<User>)QueryUtil.list(q, getDialect(), start, end);
1762 }
1763 catch (Exception e) {
1764 throw processException(e);
1765 }
1766 finally {
1767 if (list == null) {
1768 list = new ArrayList<User>();
1769 }
1770
1771 cacheResult(list);
1772
1773 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_EMAILADDRESS,
1774 finderArgs, list);
1775
1776 closeSession(session);
1777 }
1778 }
1779
1780 return list;
1781 }
1782
1783
1796 public User findByEmailAddress_First(String emailAddress,
1797 OrderByComparator orderByComparator)
1798 throws NoSuchUserException, SystemException {
1799 List<User> list = findByEmailAddress(emailAddress, 0, 1,
1800 orderByComparator);
1801
1802 if (list.isEmpty()) {
1803 StringBundler msg = new StringBundler(4);
1804
1805 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1806
1807 msg.append("emailAddress=");
1808 msg.append(emailAddress);
1809
1810 msg.append(StringPool.CLOSE_CURLY_BRACE);
1811
1812 throw new NoSuchUserException(msg.toString());
1813 }
1814 else {
1815 return list.get(0);
1816 }
1817 }
1818
1819
1832 public User findByEmailAddress_Last(String emailAddress,
1833 OrderByComparator orderByComparator)
1834 throws NoSuchUserException, SystemException {
1835 int count = countByEmailAddress(emailAddress);
1836
1837 List<User> list = findByEmailAddress(emailAddress, count - 1, count,
1838 orderByComparator);
1839
1840 if (list.isEmpty()) {
1841 StringBundler msg = new StringBundler(4);
1842
1843 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1844
1845 msg.append("emailAddress=");
1846 msg.append(emailAddress);
1847
1848 msg.append(StringPool.CLOSE_CURLY_BRACE);
1849
1850 throw new NoSuchUserException(msg.toString());
1851 }
1852 else {
1853 return list.get(0);
1854 }
1855 }
1856
1857
1871 public User[] findByEmailAddress_PrevAndNext(long userId,
1872 String emailAddress, OrderByComparator orderByComparator)
1873 throws NoSuchUserException, SystemException {
1874 User user = findByPrimaryKey(userId);
1875
1876 Session session = null;
1877
1878 try {
1879 session = openSession();
1880
1881 User[] array = new UserImpl[3];
1882
1883 array[0] = getByEmailAddress_PrevAndNext(session, user,
1884 emailAddress, orderByComparator, true);
1885
1886 array[1] = user;
1887
1888 array[2] = getByEmailAddress_PrevAndNext(session, user,
1889 emailAddress, orderByComparator, false);
1890
1891 return array;
1892 }
1893 catch (Exception e) {
1894 throw processException(e);
1895 }
1896 finally {
1897 closeSession(session);
1898 }
1899 }
1900
1901 protected User getByEmailAddress_PrevAndNext(Session session, User user,
1902 String emailAddress, OrderByComparator orderByComparator,
1903 boolean previous) {
1904 StringBundler query = null;
1905
1906 if (orderByComparator != null) {
1907 query = new StringBundler(6 +
1908 (orderByComparator.getOrderByFields().length * 6));
1909 }
1910 else {
1911 query = new StringBundler(3);
1912 }
1913
1914 query.append(_SQL_SELECT_USER_WHERE);
1915
1916 if (emailAddress == null) {
1917 query.append(_FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_1);
1918 }
1919 else {
1920 if (emailAddress.equals(StringPool.BLANK)) {
1921 query.append(_FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_3);
1922 }
1923 else {
1924 query.append(_FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_2);
1925 }
1926 }
1927
1928 if (orderByComparator != null) {
1929 String[] orderByFields = orderByComparator.getOrderByFields();
1930
1931 if (orderByFields.length > 0) {
1932 query.append(WHERE_AND);
1933 }
1934
1935 for (int i = 0; i < orderByFields.length; i++) {
1936 query.append(_ORDER_BY_ENTITY_ALIAS);
1937 query.append(orderByFields[i]);
1938
1939 if ((i + 1) < orderByFields.length) {
1940 if (orderByComparator.isAscending() ^ previous) {
1941 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1942 }
1943 else {
1944 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1945 }
1946 }
1947 else {
1948 if (orderByComparator.isAscending() ^ previous) {
1949 query.append(WHERE_GREATER_THAN);
1950 }
1951 else {
1952 query.append(WHERE_LESSER_THAN);
1953 }
1954 }
1955 }
1956
1957 query.append(ORDER_BY_CLAUSE);
1958
1959 for (int i = 0; i < orderByFields.length; i++) {
1960 query.append(_ORDER_BY_ENTITY_ALIAS);
1961 query.append(orderByFields[i]);
1962
1963 if ((i + 1) < orderByFields.length) {
1964 if (orderByComparator.isAscending() ^ previous) {
1965 query.append(ORDER_BY_ASC_HAS_NEXT);
1966 }
1967 else {
1968 query.append(ORDER_BY_DESC_HAS_NEXT);
1969 }
1970 }
1971 else {
1972 if (orderByComparator.isAscending() ^ previous) {
1973 query.append(ORDER_BY_ASC);
1974 }
1975 else {
1976 query.append(ORDER_BY_DESC);
1977 }
1978 }
1979 }
1980 }
1981
1982 String sql = query.toString();
1983
1984 Query q = session.createQuery(sql);
1985
1986 q.setFirstResult(0);
1987 q.setMaxResults(2);
1988
1989 QueryPos qPos = QueryPos.getInstance(q);
1990
1991 if (emailAddress != null) {
1992 qPos.add(emailAddress);
1993 }
1994
1995 if (orderByComparator != null) {
1996 Object[] values = orderByComparator.getOrderByValues(user);
1997
1998 for (Object value : values) {
1999 qPos.add(value);
2000 }
2001 }
2002
2003 List<User> list = q.list();
2004
2005 if (list.size() == 2) {
2006 return list.get(1);
2007 }
2008 else {
2009 return null;
2010 }
2011 }
2012
2013
2021 public User findByPortraitId(long portraitId)
2022 throws NoSuchUserException, SystemException {
2023 User user = fetchByPortraitId(portraitId);
2024
2025 if (user == null) {
2026 StringBundler msg = new StringBundler(4);
2027
2028 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2029
2030 msg.append("portraitId=");
2031 msg.append(portraitId);
2032
2033 msg.append(StringPool.CLOSE_CURLY_BRACE);
2034
2035 if (_log.isWarnEnabled()) {
2036 _log.warn(msg.toString());
2037 }
2038
2039 throw new NoSuchUserException(msg.toString());
2040 }
2041
2042 return user;
2043 }
2044
2045
2052 public User fetchByPortraitId(long portraitId) throws SystemException {
2053 return fetchByPortraitId(portraitId, true);
2054 }
2055
2056
2063 public User fetchByPortraitId(long portraitId, boolean retrieveFromCache)
2064 throws SystemException {
2065 Object[] finderArgs = new Object[] { portraitId };
2066
2067 Object result = null;
2068
2069 if (retrieveFromCache) {
2070 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_PORTRAITID,
2071 finderArgs, this);
2072 }
2073
2074 if (result == null) {
2075 Session session = null;
2076
2077 try {
2078 session = openSession();
2079
2080 StringBundler query = new StringBundler(2);
2081
2082 query.append(_SQL_SELECT_USER_WHERE);
2083
2084 query.append(_FINDER_COLUMN_PORTRAITID_PORTRAITID_2);
2085
2086 String sql = query.toString();
2087
2088 Query q = session.createQuery(sql);
2089
2090 QueryPos qPos = QueryPos.getInstance(q);
2091
2092 qPos.add(portraitId);
2093
2094 List<User> list = q.list();
2095
2096 result = list;
2097
2098 User user = null;
2099
2100 if (list.isEmpty()) {
2101 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_PORTRAITID,
2102 finderArgs, list);
2103 }
2104 else {
2105 user = list.get(0);
2106
2107 cacheResult(user);
2108
2109 if ((user.getPortraitId() != portraitId)) {
2110 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_PORTRAITID,
2111 finderArgs, user);
2112 }
2113 }
2114
2115 return user;
2116 }
2117 catch (Exception e) {
2118 throw processException(e);
2119 }
2120 finally {
2121 if (result == null) {
2122 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_PORTRAITID,
2123 finderArgs, new ArrayList<User>());
2124 }
2125
2126 closeSession(session);
2127 }
2128 }
2129 else {
2130 if (result instanceof List<?>) {
2131 return null;
2132 }
2133 else {
2134 return (User)result;
2135 }
2136 }
2137 }
2138
2139
2148 public User findByC_U(long companyId, long userId)
2149 throws NoSuchUserException, SystemException {
2150 User user = fetchByC_U(companyId, userId);
2151
2152 if (user == null) {
2153 StringBundler msg = new StringBundler(6);
2154
2155 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2156
2157 msg.append("companyId=");
2158 msg.append(companyId);
2159
2160 msg.append(", userId=");
2161 msg.append(userId);
2162
2163 msg.append(StringPool.CLOSE_CURLY_BRACE);
2164
2165 if (_log.isWarnEnabled()) {
2166 _log.warn(msg.toString());
2167 }
2168
2169 throw new NoSuchUserException(msg.toString());
2170 }
2171
2172 return user;
2173 }
2174
2175
2183 public User fetchByC_U(long companyId, long userId)
2184 throws SystemException {
2185 return fetchByC_U(companyId, userId, true);
2186 }
2187
2188
2196 public User fetchByC_U(long companyId, long userId,
2197 boolean retrieveFromCache) throws SystemException {
2198 Object[] finderArgs = new Object[] { companyId, userId };
2199
2200 Object result = null;
2201
2202 if (retrieveFromCache) {
2203 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_U,
2204 finderArgs, this);
2205 }
2206
2207 if (result == null) {
2208 Session session = null;
2209
2210 try {
2211 session = openSession();
2212
2213 StringBundler query = new StringBundler(3);
2214
2215 query.append(_SQL_SELECT_USER_WHERE);
2216
2217 query.append(_FINDER_COLUMN_C_U_COMPANYID_2);
2218
2219 query.append(_FINDER_COLUMN_C_U_USERID_2);
2220
2221 String sql = query.toString();
2222
2223 Query q = session.createQuery(sql);
2224
2225 QueryPos qPos = QueryPos.getInstance(q);
2226
2227 qPos.add(companyId);
2228
2229 qPos.add(userId);
2230
2231 List<User> list = q.list();
2232
2233 result = list;
2234
2235 User user = null;
2236
2237 if (list.isEmpty()) {
2238 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_U,
2239 finderArgs, list);
2240 }
2241 else {
2242 user = list.get(0);
2243
2244 cacheResult(user);
2245
2246 if ((user.getCompanyId() != companyId) ||
2247 (user.getUserId() != userId)) {
2248 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_U,
2249 finderArgs, user);
2250 }
2251 }
2252
2253 return user;
2254 }
2255 catch (Exception e) {
2256 throw processException(e);
2257 }
2258 finally {
2259 if (result == null) {
2260 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_U,
2261 finderArgs, new ArrayList<User>());
2262 }
2263
2264 closeSession(session);
2265 }
2266 }
2267 else {
2268 if (result instanceof List<?>) {
2269 return null;
2270 }
2271 else {
2272 return (User)result;
2273 }
2274 }
2275 }
2276
2277
2286 public User findByC_DU(long companyId, boolean defaultUser)
2287 throws NoSuchUserException, SystemException {
2288 User user = fetchByC_DU(companyId, defaultUser);
2289
2290 if (user == null) {
2291 StringBundler msg = new StringBundler(6);
2292
2293 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2294
2295 msg.append("companyId=");
2296 msg.append(companyId);
2297
2298 msg.append(", defaultUser=");
2299 msg.append(defaultUser);
2300
2301 msg.append(StringPool.CLOSE_CURLY_BRACE);
2302
2303 if (_log.isWarnEnabled()) {
2304 _log.warn(msg.toString());
2305 }
2306
2307 throw new NoSuchUserException(msg.toString());
2308 }
2309
2310 return user;
2311 }
2312
2313
2321 public User fetchByC_DU(long companyId, boolean defaultUser)
2322 throws SystemException {
2323 return fetchByC_DU(companyId, defaultUser, true);
2324 }
2325
2326
2334 public User fetchByC_DU(long companyId, boolean defaultUser,
2335 boolean retrieveFromCache) throws SystemException {
2336 Object[] finderArgs = new Object[] { companyId, defaultUser };
2337
2338 Object result = null;
2339
2340 if (retrieveFromCache) {
2341 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_DU,
2342 finderArgs, this);
2343 }
2344
2345 if (result == null) {
2346 Session session = null;
2347
2348 try {
2349 session = openSession();
2350
2351 StringBundler query = new StringBundler(3);
2352
2353 query.append(_SQL_SELECT_USER_WHERE);
2354
2355 query.append(_FINDER_COLUMN_C_DU_COMPANYID_2);
2356
2357 query.append(_FINDER_COLUMN_C_DU_DEFAULTUSER_2);
2358
2359 String sql = query.toString();
2360
2361 Query q = session.createQuery(sql);
2362
2363 QueryPos qPos = QueryPos.getInstance(q);
2364
2365 qPos.add(companyId);
2366
2367 qPos.add(defaultUser);
2368
2369 List<User> list = q.list();
2370
2371 result = list;
2372
2373 User user = null;
2374
2375 if (list.isEmpty()) {
2376 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_DU,
2377 finderArgs, list);
2378 }
2379 else {
2380 user = list.get(0);
2381
2382 cacheResult(user);
2383
2384 if ((user.getCompanyId() != companyId) ||
2385 (user.getDefaultUser() != defaultUser)) {
2386 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_DU,
2387 finderArgs, user);
2388 }
2389 }
2390
2391 return user;
2392 }
2393 catch (Exception e) {
2394 throw processException(e);
2395 }
2396 finally {
2397 if (result == null) {
2398 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_DU,
2399 finderArgs, new ArrayList<User>());
2400 }
2401
2402 closeSession(session);
2403 }
2404 }
2405 else {
2406 if (result instanceof List<?>) {
2407 return null;
2408 }
2409 else {
2410 return (User)result;
2411 }
2412 }
2413 }
2414
2415
2424 public User findByC_SN(long companyId, String screenName)
2425 throws NoSuchUserException, SystemException {
2426 User user = fetchByC_SN(companyId, screenName);
2427
2428 if (user == null) {
2429 StringBundler msg = new StringBundler(6);
2430
2431 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2432
2433 msg.append("companyId=");
2434 msg.append(companyId);
2435
2436 msg.append(", screenName=");
2437 msg.append(screenName);
2438
2439 msg.append(StringPool.CLOSE_CURLY_BRACE);
2440
2441 if (_log.isWarnEnabled()) {
2442 _log.warn(msg.toString());
2443 }
2444
2445 throw new NoSuchUserException(msg.toString());
2446 }
2447
2448 return user;
2449 }
2450
2451
2459 public User fetchByC_SN(long companyId, String screenName)
2460 throws SystemException {
2461 return fetchByC_SN(companyId, screenName, true);
2462 }
2463
2464
2472 public User fetchByC_SN(long companyId, String screenName,
2473 boolean retrieveFromCache) throws SystemException {
2474 Object[] finderArgs = new Object[] { companyId, screenName };
2475
2476 Object result = null;
2477
2478 if (retrieveFromCache) {
2479 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_SN,
2480 finderArgs, this);
2481 }
2482
2483 if (result == null) {
2484 Session session = null;
2485
2486 try {
2487 session = openSession();
2488
2489 StringBundler query = new StringBundler(3);
2490
2491 query.append(_SQL_SELECT_USER_WHERE);
2492
2493 query.append(_FINDER_COLUMN_C_SN_COMPANYID_2);
2494
2495 if (screenName == null) {
2496 query.append(_FINDER_COLUMN_C_SN_SCREENNAME_1);
2497 }
2498 else {
2499 if (screenName.equals(StringPool.BLANK)) {
2500 query.append(_FINDER_COLUMN_C_SN_SCREENNAME_3);
2501 }
2502 else {
2503 query.append(_FINDER_COLUMN_C_SN_SCREENNAME_2);
2504 }
2505 }
2506
2507 String sql = query.toString();
2508
2509 Query q = session.createQuery(sql);
2510
2511 QueryPos qPos = QueryPos.getInstance(q);
2512
2513 qPos.add(companyId);
2514
2515 if (screenName != null) {
2516 qPos.add(screenName);
2517 }
2518
2519 List<User> list = q.list();
2520
2521 result = list;
2522
2523 User user = null;
2524
2525 if (list.isEmpty()) {
2526 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_SN,
2527 finderArgs, list);
2528 }
2529 else {
2530 user = list.get(0);
2531
2532 cacheResult(user);
2533
2534 if ((user.getCompanyId() != companyId) ||
2535 (user.getScreenName() == null) ||
2536 !user.getScreenName().equals(screenName)) {
2537 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_SN,
2538 finderArgs, user);
2539 }
2540 }
2541
2542 return user;
2543 }
2544 catch (Exception e) {
2545 throw processException(e);
2546 }
2547 finally {
2548 if (result == null) {
2549 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_SN,
2550 finderArgs, new ArrayList<User>());
2551 }
2552
2553 closeSession(session);
2554 }
2555 }
2556 else {
2557 if (result instanceof List<?>) {
2558 return null;
2559 }
2560 else {
2561 return (User)result;
2562 }
2563 }
2564 }
2565
2566
2575 public User findByC_EA(long companyId, String emailAddress)
2576 throws NoSuchUserException, SystemException {
2577 User user = fetchByC_EA(companyId, emailAddress);
2578
2579 if (user == null) {
2580 StringBundler msg = new StringBundler(6);
2581
2582 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2583
2584 msg.append("companyId=");
2585 msg.append(companyId);
2586
2587 msg.append(", emailAddress=");
2588 msg.append(emailAddress);
2589
2590 msg.append(StringPool.CLOSE_CURLY_BRACE);
2591
2592 if (_log.isWarnEnabled()) {
2593 _log.warn(msg.toString());
2594 }
2595
2596 throw new NoSuchUserException(msg.toString());
2597 }
2598
2599 return user;
2600 }
2601
2602
2610 public User fetchByC_EA(long companyId, String emailAddress)
2611 throws SystemException {
2612 return fetchByC_EA(companyId, emailAddress, true);
2613 }
2614
2615
2623 public User fetchByC_EA(long companyId, String emailAddress,
2624 boolean retrieveFromCache) throws SystemException {
2625 Object[] finderArgs = new Object[] { companyId, emailAddress };
2626
2627 Object result = null;
2628
2629 if (retrieveFromCache) {
2630 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_EA,
2631 finderArgs, this);
2632 }
2633
2634 if (result == null) {
2635 Session session = null;
2636
2637 try {
2638 session = openSession();
2639
2640 StringBundler query = new StringBundler(3);
2641
2642 query.append(_SQL_SELECT_USER_WHERE);
2643
2644 query.append(_FINDER_COLUMN_C_EA_COMPANYID_2);
2645
2646 if (emailAddress == null) {
2647 query.append(_FINDER_COLUMN_C_EA_EMAILADDRESS_1);
2648 }
2649 else {
2650 if (emailAddress.equals(StringPool.BLANK)) {
2651 query.append(_FINDER_COLUMN_C_EA_EMAILADDRESS_3);
2652 }
2653 else {
2654 query.append(_FINDER_COLUMN_C_EA_EMAILADDRESS_2);
2655 }
2656 }
2657
2658 String sql = query.toString();
2659
2660 Query q = session.createQuery(sql);
2661
2662 QueryPos qPos = QueryPos.getInstance(q);
2663
2664 qPos.add(companyId);
2665
2666 if (emailAddress != null) {
2667 qPos.add(emailAddress);
2668 }
2669
2670 List<User> list = q.list();
2671
2672 result = list;
2673
2674 User user = null;
2675
2676 if (list.isEmpty()) {
2677 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_EA,
2678 finderArgs, list);
2679 }
2680 else {
2681 user = list.get(0);
2682
2683 cacheResult(user);
2684
2685 if ((user.getCompanyId() != companyId) ||
2686 (user.getEmailAddress() == null) ||
2687 !user.getEmailAddress().equals(emailAddress)) {
2688 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_EA,
2689 finderArgs, user);
2690 }
2691 }
2692
2693 return user;
2694 }
2695 catch (Exception e) {
2696 throw processException(e);
2697 }
2698 finally {
2699 if (result == null) {
2700 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_EA,
2701 finderArgs, new ArrayList<User>());
2702 }
2703
2704 closeSession(session);
2705 }
2706 }
2707 else {
2708 if (result instanceof List<?>) {
2709 return null;
2710 }
2711 else {
2712 return (User)result;
2713 }
2714 }
2715 }
2716
2717
2726 public User findByC_FID(long companyId, long facebookId)
2727 throws NoSuchUserException, SystemException {
2728 User user = fetchByC_FID(companyId, facebookId);
2729
2730 if (user == null) {
2731 StringBundler msg = new StringBundler(6);
2732
2733 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2734
2735 msg.append("companyId=");
2736 msg.append(companyId);
2737
2738 msg.append(", facebookId=");
2739 msg.append(facebookId);
2740
2741 msg.append(StringPool.CLOSE_CURLY_BRACE);
2742
2743 if (_log.isWarnEnabled()) {
2744 _log.warn(msg.toString());
2745 }
2746
2747 throw new NoSuchUserException(msg.toString());
2748 }
2749
2750 return user;
2751 }
2752
2753
2761 public User fetchByC_FID(long companyId, long facebookId)
2762 throws SystemException {
2763 return fetchByC_FID(companyId, facebookId, true);
2764 }
2765
2766
2774 public User fetchByC_FID(long companyId, long facebookId,
2775 boolean retrieveFromCache) throws SystemException {
2776 Object[] finderArgs = new Object[] { companyId, facebookId };
2777
2778 Object result = null;
2779
2780 if (retrieveFromCache) {
2781 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_FID,
2782 finderArgs, this);
2783 }
2784
2785 if (result == null) {
2786 Session session = null;
2787
2788 try {
2789 session = openSession();
2790
2791 StringBundler query = new StringBundler(3);
2792
2793 query.append(_SQL_SELECT_USER_WHERE);
2794
2795 query.append(_FINDER_COLUMN_C_FID_COMPANYID_2);
2796
2797 query.append(_FINDER_COLUMN_C_FID_FACEBOOKID_2);
2798
2799 String sql = query.toString();
2800
2801 Query q = session.createQuery(sql);
2802
2803 QueryPos qPos = QueryPos.getInstance(q);
2804
2805 qPos.add(companyId);
2806
2807 qPos.add(facebookId);
2808
2809 List<User> list = q.list();
2810
2811 result = list;
2812
2813 User user = null;
2814
2815 if (list.isEmpty()) {
2816 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_FID,
2817 finderArgs, list);
2818 }
2819 else {
2820 user = list.get(0);
2821
2822 cacheResult(user);
2823
2824 if ((user.getCompanyId() != companyId) ||
2825 (user.getFacebookId() != facebookId)) {
2826 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_FID,
2827 finderArgs, user);
2828 }
2829 }
2830
2831 return user;
2832 }
2833 catch (Exception e) {
2834 throw processException(e);
2835 }
2836 finally {
2837 if (result == null) {
2838 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_FID,
2839 finderArgs, new ArrayList<User>());
2840 }
2841
2842 closeSession(session);
2843 }
2844 }
2845 else {
2846 if (result instanceof List<?>) {
2847 return null;
2848 }
2849 else {
2850 return (User)result;
2851 }
2852 }
2853 }
2854
2855
2864 public User findByC_O(long companyId, String openId)
2865 throws NoSuchUserException, SystemException {
2866 User user = fetchByC_O(companyId, openId);
2867
2868 if (user == null) {
2869 StringBundler msg = new StringBundler(6);
2870
2871 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2872
2873 msg.append("companyId=");
2874 msg.append(companyId);
2875
2876 msg.append(", openId=");
2877 msg.append(openId);
2878
2879 msg.append(StringPool.CLOSE_CURLY_BRACE);
2880
2881 if (_log.isWarnEnabled()) {
2882 _log.warn(msg.toString());
2883 }
2884
2885 throw new NoSuchUserException(msg.toString());
2886 }
2887
2888 return user;
2889 }
2890
2891
2899 public User fetchByC_O(long companyId, String openId)
2900 throws SystemException {
2901 return fetchByC_O(companyId, openId, true);
2902 }
2903
2904
2912 public User fetchByC_O(long companyId, String openId,
2913 boolean retrieveFromCache) throws SystemException {
2914 Object[] finderArgs = new Object[] { companyId, openId };
2915
2916 Object result = null;
2917
2918 if (retrieveFromCache) {
2919 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_O,
2920 finderArgs, this);
2921 }
2922
2923 if (result == null) {
2924 Session session = null;
2925
2926 try {
2927 session = openSession();
2928
2929 StringBundler query = new StringBundler(3);
2930
2931 query.append(_SQL_SELECT_USER_WHERE);
2932
2933 query.append(_FINDER_COLUMN_C_O_COMPANYID_2);
2934
2935 if (openId == null) {
2936 query.append(_FINDER_COLUMN_C_O_OPENID_1);
2937 }
2938 else {
2939 if (openId.equals(StringPool.BLANK)) {
2940 query.append(_FINDER_COLUMN_C_O_OPENID_3);
2941 }
2942 else {
2943 query.append(_FINDER_COLUMN_C_O_OPENID_2);
2944 }
2945 }
2946
2947 String sql = query.toString();
2948
2949 Query q = session.createQuery(sql);
2950
2951 QueryPos qPos = QueryPos.getInstance(q);
2952
2953 qPos.add(companyId);
2954
2955 if (openId != null) {
2956 qPos.add(openId);
2957 }
2958
2959 List<User> list = q.list();
2960
2961 result = list;
2962
2963 User user = null;
2964
2965 if (list.isEmpty()) {
2966 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_O,
2967 finderArgs, list);
2968 }
2969 else {
2970 user = list.get(0);
2971
2972 cacheResult(user);
2973
2974 if ((user.getCompanyId() != companyId) ||
2975 (user.getOpenId() == null) ||
2976 !user.getOpenId().equals(openId)) {
2977 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_O,
2978 finderArgs, user);
2979 }
2980 }
2981
2982 return user;
2983 }
2984 catch (Exception e) {
2985 throw processException(e);
2986 }
2987 finally {
2988 if (result == null) {
2989 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_O,
2990 finderArgs, new ArrayList<User>());
2991 }
2992
2993 closeSession(session);
2994 }
2995 }
2996 else {
2997 if (result instanceof List<?>) {
2998 return null;
2999 }
3000 else {
3001 return (User)result;
3002 }
3003 }
3004 }
3005
3006
3014 public List<User> findByC_A(long companyId, boolean active)
3015 throws SystemException {
3016 return findByC_A(companyId, active, QueryUtil.ALL_POS,
3017 QueryUtil.ALL_POS, null);
3018 }
3019
3020
3034 public List<User> findByC_A(long companyId, boolean active, int start,
3035 int end) throws SystemException {
3036 return findByC_A(companyId, active, start, end, null);
3037 }
3038
3039
3054 public List<User> findByC_A(long companyId, boolean active, int start,
3055 int end, OrderByComparator orderByComparator) throws SystemException {
3056 Object[] finderArgs = new Object[] {
3057 companyId, active,
3058
3059 String.valueOf(start), String.valueOf(end),
3060 String.valueOf(orderByComparator)
3061 };
3062
3063 List<User> list = (List<User>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_A,
3064 finderArgs, this);
3065
3066 if (list == null) {
3067 Session session = null;
3068
3069 try {
3070 session = openSession();
3071
3072 StringBundler query = null;
3073
3074 if (orderByComparator != null) {
3075 query = new StringBundler(4 +
3076 (orderByComparator.getOrderByFields().length * 3));
3077 }
3078 else {
3079 query = new StringBundler(3);
3080 }
3081
3082 query.append(_SQL_SELECT_USER_WHERE);
3083
3084 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
3085
3086 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
3087
3088 if (orderByComparator != null) {
3089 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3090 orderByComparator);
3091 }
3092
3093 String sql = query.toString();
3094
3095 Query q = session.createQuery(sql);
3096
3097 QueryPos qPos = QueryPos.getInstance(q);
3098
3099 qPos.add(companyId);
3100
3101 qPos.add(active);
3102
3103 list = (List<User>)QueryUtil.list(q, getDialect(), start, end);
3104 }
3105 catch (Exception e) {
3106 throw processException(e);
3107 }
3108 finally {
3109 if (list == null) {
3110 list = new ArrayList<User>();
3111 }
3112
3113 cacheResult(list);
3114
3115 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_A, finderArgs,
3116 list);
3117
3118 closeSession(session);
3119 }
3120 }
3121
3122 return list;
3123 }
3124
3125
3139 public User findByC_A_First(long companyId, boolean active,
3140 OrderByComparator orderByComparator)
3141 throws NoSuchUserException, SystemException {
3142 List<User> list = findByC_A(companyId, active, 0, 1, orderByComparator);
3143
3144 if (list.isEmpty()) {
3145 StringBundler msg = new StringBundler(6);
3146
3147 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3148
3149 msg.append("companyId=");
3150 msg.append(companyId);
3151
3152 msg.append(", active=");
3153 msg.append(active);
3154
3155 msg.append(StringPool.CLOSE_CURLY_BRACE);
3156
3157 throw new NoSuchUserException(msg.toString());
3158 }
3159 else {
3160 return list.get(0);
3161 }
3162 }
3163
3164
3178 public User findByC_A_Last(long companyId, boolean active,
3179 OrderByComparator orderByComparator)
3180 throws NoSuchUserException, SystemException {
3181 int count = countByC_A(companyId, active);
3182
3183 List<User> list = findByC_A(companyId, active, count - 1, count,
3184 orderByComparator);
3185
3186 if (list.isEmpty()) {
3187 StringBundler msg = new StringBundler(6);
3188
3189 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3190
3191 msg.append("companyId=");
3192 msg.append(companyId);
3193
3194 msg.append(", active=");
3195 msg.append(active);
3196
3197 msg.append(StringPool.CLOSE_CURLY_BRACE);
3198
3199 throw new NoSuchUserException(msg.toString());
3200 }
3201 else {
3202 return list.get(0);
3203 }
3204 }
3205
3206
3221 public User[] findByC_A_PrevAndNext(long userId, long companyId,
3222 boolean active, OrderByComparator orderByComparator)
3223 throws NoSuchUserException, SystemException {
3224 User user = findByPrimaryKey(userId);
3225
3226 Session session = null;
3227
3228 try {
3229 session = openSession();
3230
3231 User[] array = new UserImpl[3];
3232
3233 array[0] = getByC_A_PrevAndNext(session, user, companyId, active,
3234 orderByComparator, true);
3235
3236 array[1] = user;
3237
3238 array[2] = getByC_A_PrevAndNext(session, user, companyId, active,
3239 orderByComparator, false);
3240
3241 return array;
3242 }
3243 catch (Exception e) {
3244 throw processException(e);
3245 }
3246 finally {
3247 closeSession(session);
3248 }
3249 }
3250
3251 protected User getByC_A_PrevAndNext(Session session, User user,
3252 long companyId, boolean active, OrderByComparator orderByComparator,
3253 boolean previous) {
3254 StringBundler query = null;
3255
3256 if (orderByComparator != null) {
3257 query = new StringBundler(6 +
3258 (orderByComparator.getOrderByFields().length * 6));
3259 }
3260 else {
3261 query = new StringBundler(3);
3262 }
3263
3264 query.append(_SQL_SELECT_USER_WHERE);
3265
3266 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
3267
3268 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
3269
3270 if (orderByComparator != null) {
3271 String[] orderByFields = orderByComparator.getOrderByFields();
3272
3273 if (orderByFields.length > 0) {
3274 query.append(WHERE_AND);
3275 }
3276
3277 for (int i = 0; i < orderByFields.length; i++) {
3278 query.append(_ORDER_BY_ENTITY_ALIAS);
3279 query.append(orderByFields[i]);
3280
3281 if ((i + 1) < orderByFields.length) {
3282 if (orderByComparator.isAscending() ^ previous) {
3283 query.append(WHERE_GREATER_THAN_HAS_NEXT);
3284 }
3285 else {
3286 query.append(WHERE_LESSER_THAN_HAS_NEXT);
3287 }
3288 }
3289 else {
3290 if (orderByComparator.isAscending() ^ previous) {
3291 query.append(WHERE_GREATER_THAN);
3292 }
3293 else {
3294 query.append(WHERE_LESSER_THAN);
3295 }
3296 }
3297 }
3298
3299 query.append(ORDER_BY_CLAUSE);
3300
3301 for (int i = 0; i < orderByFields.length; i++) {
3302 query.append(_ORDER_BY_ENTITY_ALIAS);
3303 query.append(orderByFields[i]);
3304
3305 if ((i + 1) < orderByFields.length) {
3306 if (orderByComparator.isAscending() ^ previous) {
3307 query.append(ORDER_BY_ASC_HAS_NEXT);
3308 }
3309 else {
3310 query.append(ORDER_BY_DESC_HAS_NEXT);
3311 }
3312 }
3313 else {
3314 if (orderByComparator.isAscending() ^ previous) {
3315 query.append(ORDER_BY_ASC);
3316 }
3317 else {
3318 query.append(ORDER_BY_DESC);
3319 }
3320 }
3321 }
3322 }
3323
3324 String sql = query.toString();
3325
3326 Query q = session.createQuery(sql);
3327
3328 q.setFirstResult(0);
3329 q.setMaxResults(2);
3330
3331 QueryPos qPos = QueryPos.getInstance(q);
3332
3333 qPos.add(companyId);
3334
3335 qPos.add(active);
3336
3337 if (orderByComparator != null) {
3338 Object[] values = orderByComparator.getOrderByValues(user);
3339
3340 for (Object value : values) {
3341 qPos.add(value);
3342 }
3343 }
3344
3345 List<User> list = q.list();
3346
3347 if (list.size() == 2) {
3348 return list.get(1);
3349 }
3350 else {
3351 return null;
3352 }
3353 }
3354
3355
3361 public List<User> findAll() throws SystemException {
3362 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
3363 }
3364
3365
3377 public List<User> findAll(int start, int end) throws SystemException {
3378 return findAll(start, end, null);
3379 }
3380
3381
3394 public List<User> findAll(int start, int end,
3395 OrderByComparator orderByComparator) throws SystemException {
3396 Object[] finderArgs = new Object[] {
3397 String.valueOf(start), String.valueOf(end),
3398 String.valueOf(orderByComparator)
3399 };
3400
3401 List<User> list = (List<User>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
3402 finderArgs, this);
3403
3404 if (list == null) {
3405 Session session = null;
3406
3407 try {
3408 session = openSession();
3409
3410 StringBundler query = null;
3411 String sql = null;
3412
3413 if (orderByComparator != null) {
3414 query = new StringBundler(2 +
3415 (orderByComparator.getOrderByFields().length * 3));
3416
3417 query.append(_SQL_SELECT_USER);
3418
3419 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3420 orderByComparator);
3421
3422 sql = query.toString();
3423 }
3424 else {
3425 sql = _SQL_SELECT_USER;
3426 }
3427
3428 Query q = session.createQuery(sql);
3429
3430 if (orderByComparator == null) {
3431 list = (List<User>)QueryUtil.list(q, getDialect(), start,
3432 end, false);
3433
3434 Collections.sort(list);
3435 }
3436 else {
3437 list = (List<User>)QueryUtil.list(q, getDialect(), start,
3438 end);
3439 }
3440 }
3441 catch (Exception e) {
3442 throw processException(e);
3443 }
3444 finally {
3445 if (list == null) {
3446 list = new ArrayList<User>();
3447 }
3448
3449 cacheResult(list);
3450
3451 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
3452
3453 closeSession(session);
3454 }
3455 }
3456
3457 return list;
3458 }
3459
3460
3466 public void removeByUuid(String uuid) throws SystemException {
3467 for (User user : findByUuid(uuid)) {
3468 remove(user);
3469 }
3470 }
3471
3472
3478 public void removeByCompanyId(long companyId) throws SystemException {
3479 for (User user : findByCompanyId(companyId)) {
3480 remove(user);
3481 }
3482 }
3483
3484
3490 public void removeByContactId(long contactId)
3491 throws NoSuchUserException, SystemException {
3492 User user = findByContactId(contactId);
3493
3494 remove(user);
3495 }
3496
3497
3503 public void removeByEmailAddress(String emailAddress)
3504 throws SystemException {
3505 for (User user : findByEmailAddress(emailAddress)) {
3506 remove(user);
3507 }
3508 }
3509
3510
3516 public void removeByPortraitId(long portraitId)
3517 throws NoSuchUserException, SystemException {
3518 User user = findByPortraitId(portraitId);
3519
3520 remove(user);
3521 }
3522
3523
3530 public void removeByC_U(long companyId, long userId)
3531 throws NoSuchUserException, SystemException {
3532 User user = findByC_U(companyId, userId);
3533
3534 remove(user);
3535 }
3536
3537
3544 public void removeByC_DU(long companyId, boolean defaultUser)
3545 throws NoSuchUserException, SystemException {
3546 User user = findByC_DU(companyId, defaultUser);
3547
3548 remove(user);
3549 }
3550
3551
3558 public void removeByC_SN(long companyId, String screenName)
3559 throws NoSuchUserException, SystemException {
3560 User user = findByC_SN(companyId, screenName);
3561
3562 remove(user);
3563 }
3564
3565
3572 public void removeByC_EA(long companyId, String emailAddress)
3573 throws NoSuchUserException, SystemException {
3574 User user = findByC_EA(companyId, emailAddress);
3575
3576 remove(user);
3577 }
3578
3579
3586 public void removeByC_FID(long companyId, long facebookId)
3587 throws NoSuchUserException, SystemException {
3588 User user = findByC_FID(companyId, facebookId);
3589
3590 remove(user);
3591 }
3592
3593
3600 public void removeByC_O(long companyId, String openId)
3601 throws NoSuchUserException, SystemException {
3602 User user = findByC_O(companyId, openId);
3603
3604 remove(user);
3605 }
3606
3607
3614 public void removeByC_A(long companyId, boolean active)
3615 throws SystemException {
3616 for (User user : findByC_A(companyId, active)) {
3617 remove(user);
3618 }
3619 }
3620
3621
3626 public void removeAll() throws SystemException {
3627 for (User user : findAll()) {
3628 remove(user);
3629 }
3630 }
3631
3632
3639 public int countByUuid(String uuid) throws SystemException {
3640 Object[] finderArgs = new Object[] { uuid };
3641
3642 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
3643 finderArgs, this);
3644
3645 if (count == null) {
3646 Session session = null;
3647
3648 try {
3649 session = openSession();
3650
3651 StringBundler query = new StringBundler(2);
3652
3653 query.append(_SQL_COUNT_USER_WHERE);
3654
3655 if (uuid == null) {
3656 query.append(_FINDER_COLUMN_UUID_UUID_1);
3657 }
3658 else {
3659 if (uuid.equals(StringPool.BLANK)) {
3660 query.append(_FINDER_COLUMN_UUID_UUID_3);
3661 }
3662 else {
3663 query.append(_FINDER_COLUMN_UUID_UUID_2);
3664 }
3665 }
3666
3667 String sql = query.toString();
3668
3669 Query q = session.createQuery(sql);
3670
3671 QueryPos qPos = QueryPos.getInstance(q);
3672
3673 if (uuid != null) {
3674 qPos.add(uuid);
3675 }
3676
3677 count = (Long)q.uniqueResult();
3678 }
3679 catch (Exception e) {
3680 throw processException(e);
3681 }
3682 finally {
3683 if (count == null) {
3684 count = Long.valueOf(0);
3685 }
3686
3687 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
3688 finderArgs, count);
3689
3690 closeSession(session);
3691 }
3692 }
3693
3694 return count.intValue();
3695 }
3696
3697
3704 public int countByCompanyId(long companyId) throws SystemException {
3705 Object[] finderArgs = new Object[] { companyId };
3706
3707 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
3708 finderArgs, this);
3709
3710 if (count == null) {
3711 Session session = null;
3712
3713 try {
3714 session = openSession();
3715
3716 StringBundler query = new StringBundler(2);
3717
3718 query.append(_SQL_COUNT_USER_WHERE);
3719
3720 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
3721
3722 String sql = query.toString();
3723
3724 Query q = session.createQuery(sql);
3725
3726 QueryPos qPos = QueryPos.getInstance(q);
3727
3728 qPos.add(companyId);
3729
3730 count = (Long)q.uniqueResult();
3731 }
3732 catch (Exception e) {
3733 throw processException(e);
3734 }
3735 finally {
3736 if (count == null) {
3737 count = Long.valueOf(0);
3738 }
3739
3740 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
3741 finderArgs, count);
3742
3743 closeSession(session);
3744 }
3745 }
3746
3747 return count.intValue();
3748 }
3749
3750
3757 public int countByContactId(long contactId) throws SystemException {
3758 Object[] finderArgs = new Object[] { contactId };
3759
3760 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_CONTACTID,
3761 finderArgs, this);
3762
3763 if (count == null) {
3764 Session session = null;
3765
3766 try {
3767 session = openSession();
3768
3769 StringBundler query = new StringBundler(2);
3770
3771 query.append(_SQL_COUNT_USER_WHERE);
3772
3773 query.append(_FINDER_COLUMN_CONTACTID_CONTACTID_2);
3774
3775 String sql = query.toString();
3776
3777 Query q = session.createQuery(sql);
3778
3779 QueryPos qPos = QueryPos.getInstance(q);
3780
3781 qPos.add(contactId);
3782
3783 count = (Long)q.uniqueResult();
3784 }
3785 catch (Exception e) {
3786 throw processException(e);
3787 }
3788 finally {
3789 if (count == null) {
3790 count = Long.valueOf(0);
3791 }
3792
3793 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_CONTACTID,
3794 finderArgs, count);
3795
3796 closeSession(session);
3797 }
3798 }
3799
3800 return count.intValue();
3801 }
3802
3803
3810 public int countByEmailAddress(String emailAddress)
3811 throws SystemException {
3812 Object[] finderArgs = new Object[] { emailAddress };
3813
3814 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_EMAILADDRESS,
3815 finderArgs, this);
3816
3817 if (count == null) {
3818 Session session = null;
3819
3820 try {
3821 session = openSession();
3822
3823 StringBundler query = new StringBundler(2);
3824
3825 query.append(_SQL_COUNT_USER_WHERE);
3826
3827 if (emailAddress == null) {
3828 query.append(_FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_1);
3829 }
3830 else {
3831 if (emailAddress.equals(StringPool.BLANK)) {
3832 query.append(_FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_3);
3833 }
3834 else {
3835 query.append(_FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_2);
3836 }
3837 }
3838
3839 String sql = query.toString();
3840
3841 Query q = session.createQuery(sql);
3842
3843 QueryPos qPos = QueryPos.getInstance(q);
3844
3845 if (emailAddress != null) {
3846 qPos.add(emailAddress);
3847 }
3848
3849 count = (Long)q.uniqueResult();
3850 }
3851 catch (Exception e) {
3852 throw processException(e);
3853 }
3854 finally {
3855 if (count == null) {
3856 count = Long.valueOf(0);
3857 }
3858
3859 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_EMAILADDRESS,
3860 finderArgs, count);
3861
3862 closeSession(session);
3863 }
3864 }
3865
3866 return count.intValue();
3867 }
3868
3869
3876 public int countByPortraitId(long portraitId) throws SystemException {
3877 Object[] finderArgs = new Object[] { portraitId };
3878
3879 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_PORTRAITID,
3880 finderArgs, this);
3881
3882 if (count == null) {
3883 Session session = null;
3884
3885 try {
3886 session = openSession();
3887
3888 StringBundler query = new StringBundler(2);
3889
3890 query.append(_SQL_COUNT_USER_WHERE);
3891
3892 query.append(_FINDER_COLUMN_PORTRAITID_PORTRAITID_2);
3893
3894 String sql = query.toString();
3895
3896 Query q = session.createQuery(sql);
3897
3898 QueryPos qPos = QueryPos.getInstance(q);
3899
3900 qPos.add(portraitId);
3901
3902 count = (Long)q.uniqueResult();
3903 }
3904 catch (Exception e) {
3905 throw processException(e);
3906 }
3907 finally {
3908 if (count == null) {
3909 count = Long.valueOf(0);
3910 }
3911
3912 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_PORTRAITID,
3913 finderArgs, count);
3914
3915 closeSession(session);
3916 }
3917 }
3918
3919 return count.intValue();
3920 }
3921
3922
3930 public int countByC_U(long companyId, long userId)
3931 throws SystemException {
3932 Object[] finderArgs = new Object[] { companyId, userId };
3933
3934 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_U,
3935 finderArgs, this);
3936
3937 if (count == null) {
3938 Session session = null;
3939
3940 try {
3941 session = openSession();
3942
3943 StringBundler query = new StringBundler(3);
3944
3945 query.append(_SQL_COUNT_USER_WHERE);
3946
3947 query.append(_FINDER_COLUMN_C_U_COMPANYID_2);
3948
3949 query.append(_FINDER_COLUMN_C_U_USERID_2);
3950
3951 String sql = query.toString();
3952
3953 Query q = session.createQuery(sql);
3954
3955 QueryPos qPos = QueryPos.getInstance(q);
3956
3957 qPos.add(companyId);
3958
3959 qPos.add(userId);
3960
3961 count = (Long)q.uniqueResult();
3962 }
3963 catch (Exception e) {
3964 throw processException(e);
3965 }
3966 finally {
3967 if (count == null) {
3968 count = Long.valueOf(0);
3969 }
3970
3971 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_U, finderArgs,
3972 count);
3973
3974 closeSession(session);
3975 }
3976 }
3977
3978 return count.intValue();
3979 }
3980
3981
3989 public int countByC_DU(long companyId, boolean defaultUser)
3990 throws SystemException {
3991 Object[] finderArgs = new Object[] { companyId, defaultUser };
3992
3993 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_DU,
3994 finderArgs, this);
3995
3996 if (count == null) {
3997 Session session = null;
3998
3999 try {
4000 session = openSession();
4001
4002 StringBundler query = new StringBundler(3);
4003
4004 query.append(_SQL_COUNT_USER_WHERE);
4005
4006 query.append(_FINDER_COLUMN_C_DU_COMPANYID_2);
4007
4008 query.append(_FINDER_COLUMN_C_DU_DEFAULTUSER_2);
4009
4010 String sql = query.toString();
4011
4012 Query q = session.createQuery(sql);
4013
4014 QueryPos qPos = QueryPos.getInstance(q);
4015
4016 qPos.add(companyId);
4017
4018 qPos.add(defaultUser);
4019
4020 count = (Long)q.uniqueResult();
4021 }
4022 catch (Exception e) {
4023 throw processException(e);
4024 }
4025 finally {
4026 if (count == null) {
4027 count = Long.valueOf(0);
4028 }
4029
4030 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_DU,
4031 finderArgs, count);
4032
4033 closeSession(session);
4034 }
4035 }
4036
4037 return count.intValue();
4038 }
4039
4040
4048 public int countByC_SN(long companyId, String screenName)
4049 throws SystemException {
4050 Object[] finderArgs = new Object[] { companyId, screenName };
4051
4052 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_SN,
4053 finderArgs, this);
4054
4055 if (count == null) {
4056 Session session = null;
4057
4058 try {
4059 session = openSession();
4060
4061 StringBundler query = new StringBundler(3);
4062
4063 query.append(_SQL_COUNT_USER_WHERE);
4064
4065 query.append(_FINDER_COLUMN_C_SN_COMPANYID_2);
4066
4067 if (screenName == null) {
4068 query.append(_FINDER_COLUMN_C_SN_SCREENNAME_1);
4069 }
4070 else {
4071 if (screenName.equals(StringPool.BLANK)) {
4072 query.append(_FINDER_COLUMN_C_SN_SCREENNAME_3);
4073 }
4074 else {
4075 query.append(_FINDER_COLUMN_C_SN_SCREENNAME_2);
4076 }
4077 }
4078
4079 String sql = query.toString();
4080
4081 Query q = session.createQuery(sql);
4082
4083 QueryPos qPos = QueryPos.getInstance(q);
4084
4085 qPos.add(companyId);
4086
4087 if (screenName != null) {
4088 qPos.add(screenName);
4089 }
4090
4091 count = (Long)q.uniqueResult();
4092 }
4093 catch (Exception e) {
4094 throw processException(e);
4095 }
4096 finally {
4097 if (count == null) {
4098 count = Long.valueOf(0);
4099 }
4100
4101 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_SN,
4102 finderArgs, count);
4103
4104 closeSession(session);
4105 }
4106 }
4107
4108 return count.intValue();
4109 }
4110
4111
4119 public int countByC_EA(long companyId, String emailAddress)
4120 throws SystemException {
4121 Object[] finderArgs = new Object[] { companyId, emailAddress };
4122
4123 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_EA,
4124 finderArgs, this);
4125
4126 if (count == null) {
4127 Session session = null;
4128
4129 try {
4130 session = openSession();
4131
4132 StringBundler query = new StringBundler(3);
4133
4134 query.append(_SQL_COUNT_USER_WHERE);
4135
4136 query.append(_FINDER_COLUMN_C_EA_COMPANYID_2);
4137
4138 if (emailAddress == null) {
4139 query.append(_FINDER_COLUMN_C_EA_EMAILADDRESS_1);
4140 }
4141 else {
4142 if (emailAddress.equals(StringPool.BLANK)) {
4143 query.append(_FINDER_COLUMN_C_EA_EMAILADDRESS_3);
4144 }
4145 else {
4146 query.append(_FINDER_COLUMN_C_EA_EMAILADDRESS_2);
4147 }
4148 }
4149
4150 String sql = query.toString();
4151
4152 Query q = session.createQuery(sql);
4153
4154 QueryPos qPos = QueryPos.getInstance(q);
4155
4156 qPos.add(companyId);
4157
4158 if (emailAddress != null) {
4159 qPos.add(emailAddress);
4160 }
4161
4162 count = (Long)q.uniqueResult();
4163 }
4164 catch (Exception e) {
4165 throw processException(e);
4166 }
4167 finally {
4168 if (count == null) {
4169 count = Long.valueOf(0);
4170 }
4171
4172 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_EA,
4173 finderArgs, count);
4174
4175 closeSession(session);
4176 }
4177 }
4178
4179 return count.intValue();
4180 }
4181
4182
4190 public int countByC_FID(long companyId, long facebookId)
4191 throws SystemException {
4192 Object[] finderArgs = new Object[] { companyId, facebookId };
4193
4194 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_FID,
4195 finderArgs, this);
4196
4197 if (count == null) {
4198 Session session = null;
4199
4200 try {
4201 session = openSession();
4202
4203 StringBundler query = new StringBundler(3);
4204
4205 query.append(_SQL_COUNT_USER_WHERE);
4206
4207 query.append(_FINDER_COLUMN_C_FID_COMPANYID_2);
4208
4209 query.append(_FINDER_COLUMN_C_FID_FACEBOOKID_2);
4210
4211 String sql = query.toString();
4212
4213 Query q = session.createQuery(sql);
4214
4215 QueryPos qPos = QueryPos.getInstance(q);
4216
4217 qPos.add(companyId);
4218
4219 qPos.add(facebookId);
4220
4221 count = (Long)q.uniqueResult();
4222 }
4223 catch (Exception e) {
4224 throw processException(e);
4225 }
4226 finally {
4227 if (count == null) {
4228 count = Long.valueOf(0);
4229 }
4230
4231 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_FID,
4232 finderArgs, count);
4233
4234 closeSession(session);
4235 }
4236 }
4237
4238 return count.intValue();
4239 }
4240
4241
4249 public int countByC_O(long companyId, String openId)
4250 throws SystemException {
4251 Object[] finderArgs = new Object[] { companyId, openId };
4252
4253 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_O,
4254 finderArgs, this);
4255
4256 if (count == null) {
4257 Session session = null;
4258
4259 try {
4260 session = openSession();
4261
4262 StringBundler query = new StringBundler(3);
4263
4264 query.append(_SQL_COUNT_USER_WHERE);
4265
4266 query.append(_FINDER_COLUMN_C_O_COMPANYID_2);
4267
4268 if (openId == null) {
4269 query.append(_FINDER_COLUMN_C_O_OPENID_1);
4270 }
4271 else {
4272 if (openId.equals(StringPool.BLANK)) {
4273 query.append(_FINDER_COLUMN_C_O_OPENID_3);
4274 }
4275 else {
4276 query.append(_FINDER_COLUMN_C_O_OPENID_2);
4277 }
4278 }
4279
4280 String sql = query.toString();
4281
4282 Query q = session.createQuery(sql);
4283
4284 QueryPos qPos = QueryPos.getInstance(q);
4285
4286 qPos.add(companyId);
4287
4288 if (openId != null) {
4289 qPos.add(openId);
4290 }
4291
4292 count = (Long)q.uniqueResult();
4293 }
4294 catch (Exception e) {
4295 throw processException(e);
4296 }
4297 finally {
4298 if (count == null) {
4299 count = Long.valueOf(0);
4300 }
4301
4302 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_O, finderArgs,
4303 count);
4304
4305 closeSession(session);
4306 }
4307 }
4308
4309 return count.intValue();
4310 }
4311
4312
4320 public int countByC_A(long companyId, boolean active)
4321 throws SystemException {
4322 Object[] finderArgs = new Object[] { companyId, active };
4323
4324 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_A,
4325 finderArgs, this);
4326
4327 if (count == null) {
4328 Session session = null;
4329
4330 try {
4331 session = openSession();
4332
4333 StringBundler query = new StringBundler(3);
4334
4335 query.append(_SQL_COUNT_USER_WHERE);
4336
4337 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
4338
4339 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
4340
4341 String sql = query.toString();
4342
4343 Query q = session.createQuery(sql);
4344
4345 QueryPos qPos = QueryPos.getInstance(q);
4346
4347 qPos.add(companyId);
4348
4349 qPos.add(active);
4350
4351 count = (Long)q.uniqueResult();
4352 }
4353 catch (Exception e) {
4354 throw processException(e);
4355 }
4356 finally {
4357 if (count == null) {
4358 count = Long.valueOf(0);
4359 }
4360
4361 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_A, finderArgs,
4362 count);
4363
4364 closeSession(session);
4365 }
4366 }
4367
4368 return count.intValue();
4369 }
4370
4371
4377 public int countAll() throws SystemException {
4378 Object[] finderArgs = new Object[0];
4379
4380 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
4381 finderArgs, this);
4382
4383 if (count == null) {
4384 Session session = null;
4385
4386 try {
4387 session = openSession();
4388
4389 Query q = session.createQuery(_SQL_COUNT_USER);
4390
4391 count = (Long)q.uniqueResult();
4392 }
4393 catch (Exception e) {
4394 throw processException(e);
4395 }
4396 finally {
4397 if (count == null) {
4398 count = Long.valueOf(0);
4399 }
4400
4401 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
4402 count);
4403
4404 closeSession(session);
4405 }
4406 }
4407
4408 return count.intValue();
4409 }
4410
4411
4418 public List<com.liferay.portal.model.Group> getGroups(long pk)
4419 throws SystemException {
4420 return getGroups(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
4421 }
4422
4423
4436 public List<com.liferay.portal.model.Group> getGroups(long pk, int start,
4437 int end) throws SystemException {
4438 return getGroups(pk, start, end, null);
4439 }
4440
4441 public static final FinderPath FINDER_PATH_GET_GROUPS = new FinderPath(com.liferay.portal.model.impl.GroupModelImpl.ENTITY_CACHE_ENABLED,
4442 UserModelImpl.FINDER_CACHE_ENABLED_USERS_GROUPS,
4443 UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME, "getGroups",
4444 new String[] {
4445 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
4446 "com.liferay.portal.kernel.util.OrderByComparator"
4447 });
4448
4449
4463 public List<com.liferay.portal.model.Group> getGroups(long pk, int start,
4464 int end, OrderByComparator orderByComparator) throws SystemException {
4465 Object[] finderArgs = new Object[] {
4466 pk, String.valueOf(start), String.valueOf(end),
4467 String.valueOf(orderByComparator)
4468 };
4469
4470 List<com.liferay.portal.model.Group> list = (List<com.liferay.portal.model.Group>)FinderCacheUtil.getResult(FINDER_PATH_GET_GROUPS,
4471 finderArgs, this);
4472
4473 if (list == null) {
4474 Session session = null;
4475
4476 try {
4477 session = openSession();
4478
4479 String sql = null;
4480
4481 if (orderByComparator != null) {
4482 sql = _SQL_GETGROUPS.concat(ORDER_BY_CLAUSE)
4483 .concat(orderByComparator.getOrderBy());
4484 }
4485 else {
4486 sql = _SQL_GETGROUPS.concat(com.liferay.portal.model.impl.GroupModelImpl.ORDER_BY_SQL);
4487 }
4488
4489 SQLQuery q = session.createSQLQuery(sql);
4490
4491 q.addEntity("Group_",
4492 com.liferay.portal.model.impl.GroupImpl.class);
4493
4494 QueryPos qPos = QueryPos.getInstance(q);
4495
4496 qPos.add(pk);
4497
4498 list = (List<com.liferay.portal.model.Group>)QueryUtil.list(q,
4499 getDialect(), start, end);
4500 }
4501 catch (Exception e) {
4502 throw processException(e);
4503 }
4504 finally {
4505 if (list == null) {
4506 list = new ArrayList<com.liferay.portal.model.Group>();
4507 }
4508
4509 groupPersistence.cacheResult(list);
4510
4511 FinderCacheUtil.putResult(FINDER_PATH_GET_GROUPS, finderArgs,
4512 list);
4513
4514 closeSession(session);
4515 }
4516 }
4517
4518 return list;
4519 }
4520
4521 public static final FinderPath FINDER_PATH_GET_GROUPS_SIZE = new FinderPath(com.liferay.portal.model.impl.GroupModelImpl.ENTITY_CACHE_ENABLED,
4522 UserModelImpl.FINDER_CACHE_ENABLED_USERS_GROUPS,
4523 UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME, "getGroupsSize",
4524 new String[] { Long.class.getName() });
4525
4526
4533 public int getGroupsSize(long pk) throws SystemException {
4534 Object[] finderArgs = new Object[] { pk };
4535
4536 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_GROUPS_SIZE,
4537 finderArgs, this);
4538
4539 if (count == null) {
4540 Session session = null;
4541
4542 try {
4543 session = openSession();
4544
4545 SQLQuery q = session.createSQLQuery(_SQL_GETGROUPSSIZE);
4546
4547 q.addScalar(COUNT_COLUMN_NAME,
4548 com.liferay.portal.kernel.dao.orm.Type.LONG);
4549
4550 QueryPos qPos = QueryPos.getInstance(q);
4551
4552 qPos.add(pk);
4553
4554 count = (Long)q.uniqueResult();
4555 }
4556 catch (Exception e) {
4557 throw processException(e);
4558 }
4559 finally {
4560 if (count == null) {
4561 count = Long.valueOf(0);
4562 }
4563
4564 FinderCacheUtil.putResult(FINDER_PATH_GET_GROUPS_SIZE,
4565 finderArgs, count);
4566
4567 closeSession(session);
4568 }
4569 }
4570
4571 return count.intValue();
4572 }
4573
4574 public static final FinderPath FINDER_PATH_CONTAINS_GROUP = new FinderPath(com.liferay.portal.model.impl.GroupModelImpl.ENTITY_CACHE_ENABLED,
4575 UserModelImpl.FINDER_CACHE_ENABLED_USERS_GROUPS,
4576 UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME, "containsGroup",
4577 new String[] { Long.class.getName(), Long.class.getName() });
4578
4579
4587 public boolean containsGroup(long pk, long groupPK)
4588 throws SystemException {
4589 Object[] finderArgs = new Object[] { pk, groupPK };
4590
4591 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_GROUP,
4592 finderArgs, this);
4593
4594 if (value == null) {
4595 try {
4596 value = Boolean.valueOf(containsGroup.contains(pk, groupPK));
4597 }
4598 catch (Exception e) {
4599 throw processException(e);
4600 }
4601 finally {
4602 if (value == null) {
4603 value = Boolean.FALSE;
4604 }
4605
4606 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_GROUP,
4607 finderArgs, value);
4608 }
4609 }
4610
4611 return value.booleanValue();
4612 }
4613
4614
4621 public boolean containsGroups(long pk) throws SystemException {
4622 if (getGroupsSize(pk) > 0) {
4623 return true;
4624 }
4625 else {
4626 return false;
4627 }
4628 }
4629
4630
4637 public void addGroup(long pk, long groupPK) throws SystemException {
4638 try {
4639 addGroup.add(pk, groupPK);
4640 }
4641 catch (Exception e) {
4642 throw processException(e);
4643 }
4644 finally {
4645 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
4646 }
4647 }
4648
4649
4656 public void addGroup(long pk, com.liferay.portal.model.Group group)
4657 throws SystemException {
4658 try {
4659 addGroup.add(pk, group.getPrimaryKey());
4660 }
4661 catch (Exception e) {
4662 throw processException(e);
4663 }
4664 finally {
4665 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
4666 }
4667 }
4668
4669
4676 public void addGroups(long pk, long[] groupPKs) throws SystemException {
4677 try {
4678 for (long groupPK : groupPKs) {
4679 addGroup.add(pk, groupPK);
4680 }
4681 }
4682 catch (Exception e) {
4683 throw processException(e);
4684 }
4685 finally {
4686 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
4687 }
4688 }
4689
4690
4697 public void addGroups(long pk, List<com.liferay.portal.model.Group> groups)
4698 throws SystemException {
4699 try {
4700 for (com.liferay.portal.model.Group group : groups) {
4701 addGroup.add(pk, group.getPrimaryKey());
4702 }
4703 }
4704 catch (Exception e) {
4705 throw processException(e);
4706 }
4707 finally {
4708 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
4709 }
4710 }
4711
4712
4718 public void clearGroups(long pk) throws SystemException {
4719 try {
4720 clearGroups.clear(pk);
4721 }
4722 catch (Exception e) {
4723 throw processException(e);
4724 }
4725 finally {
4726 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
4727 }
4728 }
4729
4730
4737 public void removeGroup(long pk, long groupPK) throws SystemException {
4738 try {
4739 removeGroup.remove(pk, groupPK);
4740 }
4741 catch (Exception e) {
4742 throw processException(e);
4743 }
4744 finally {
4745 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
4746 }
4747 }
4748
4749
4756 public void removeGroup(long pk, com.liferay.portal.model.Group group)
4757 throws SystemException {
4758 try {
4759 removeGroup.remove(pk, group.getPrimaryKey());
4760 }
4761 catch (Exception e) {
4762 throw processException(e);
4763 }
4764 finally {
4765 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
4766 }
4767 }
4768
4769
4776 public void removeGroups(long pk, long[] groupPKs)
4777 throws SystemException {
4778 try {
4779 for (long groupPK : groupPKs) {
4780 removeGroup.remove(pk, groupPK);
4781 }
4782 }
4783 catch (Exception e) {
4784 throw processException(e);
4785 }
4786 finally {
4787 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
4788 }
4789 }
4790
4791
4798 public void removeGroups(long pk,
4799 List<com.liferay.portal.model.Group> groups) throws SystemException {
4800 try {
4801 for (com.liferay.portal.model.Group group : groups) {
4802 removeGroup.remove(pk, group.getPrimaryKey());
4803 }
4804 }
4805 catch (Exception e) {
4806 throw processException(e);
4807 }
4808 finally {
4809 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
4810 }
4811 }
4812
4813
4820 public void setGroups(long pk, long[] groupPKs) throws SystemException {
4821 try {
4822 Set<Long> groupPKSet = SetUtil.fromArray(groupPKs);
4823
4824 List<com.liferay.portal.model.Group> groups = getGroups(pk);
4825
4826 for (com.liferay.portal.model.Group group : groups) {
4827 if (!groupPKSet.remove(group.getPrimaryKey())) {
4828 removeGroup.remove(pk, group.getPrimaryKey());
4829 }
4830 }
4831
4832 for (Long groupPK : groupPKSet) {
4833 addGroup.add(pk, groupPK);
4834 }
4835 }
4836 catch (Exception e) {
4837 throw processException(e);
4838 }
4839 finally {
4840 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
4841 }
4842 }
4843
4844
4851 public void setGroups(long pk, List<com.liferay.portal.model.Group> groups)
4852 throws SystemException {
4853 try {
4854 long[] groupPKs = new long[groups.size()];
4855
4856 for (int i = 0; i < groups.size(); i++) {
4857 com.liferay.portal.model.Group group = groups.get(i);
4858
4859 groupPKs[i] = group.getPrimaryKey();
4860 }
4861
4862 setGroups(pk, groupPKs);
4863 }
4864 catch (Exception e) {
4865 throw processException(e);
4866 }
4867 finally {
4868 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
4869 }
4870 }
4871
4872
4879 public List<com.liferay.portal.model.Organization> getOrganizations(long pk)
4880 throws SystemException {
4881 return getOrganizations(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
4882 }
4883
4884
4897 public List<com.liferay.portal.model.Organization> getOrganizations(
4898 long pk, int start, int end) throws SystemException {
4899 return getOrganizations(pk, start, end, null);
4900 }
4901
4902 public static final FinderPath FINDER_PATH_GET_ORGANIZATIONS = new FinderPath(com.liferay.portal.model.impl.OrganizationModelImpl.ENTITY_CACHE_ENABLED,
4903 UserModelImpl.FINDER_CACHE_ENABLED_USERS_ORGS,
4904 UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME, "getOrganizations",
4905 new String[] {
4906 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
4907 "com.liferay.portal.kernel.util.OrderByComparator"
4908 });
4909
4910
4924 public List<com.liferay.portal.model.Organization> getOrganizations(
4925 long pk, int start, int end, OrderByComparator orderByComparator)
4926 throws SystemException {
4927 Object[] finderArgs = new Object[] {
4928 pk, String.valueOf(start), String.valueOf(end),
4929 String.valueOf(orderByComparator)
4930 };
4931
4932 List<com.liferay.portal.model.Organization> list = (List<com.liferay.portal.model.Organization>)FinderCacheUtil.getResult(FINDER_PATH_GET_ORGANIZATIONS,
4933 finderArgs, this);
4934
4935 if (list == null) {
4936 Session session = null;
4937
4938 try {
4939 session = openSession();
4940
4941 String sql = null;
4942
4943 if (orderByComparator != null) {
4944 sql = _SQL_GETORGANIZATIONS.concat(ORDER_BY_CLAUSE)
4945 .concat(orderByComparator.getOrderBy());
4946 }
4947 else {
4948 sql = _SQL_GETORGANIZATIONS.concat(com.liferay.portal.model.impl.OrganizationModelImpl.ORDER_BY_SQL);
4949 }
4950
4951 SQLQuery q = session.createSQLQuery(sql);
4952
4953 q.addEntity("Organization_",
4954 com.liferay.portal.model.impl.OrganizationImpl.class);
4955
4956 QueryPos qPos = QueryPos.getInstance(q);
4957
4958 qPos.add(pk);
4959
4960 list = (List<com.liferay.portal.model.Organization>)QueryUtil.list(q,
4961 getDialect(), start, end);
4962 }
4963 catch (Exception e) {
4964 throw processException(e);
4965 }
4966 finally {
4967 if (list == null) {
4968 list = new ArrayList<com.liferay.portal.model.Organization>();
4969 }
4970
4971 organizationPersistence.cacheResult(list);
4972
4973 FinderCacheUtil.putResult(FINDER_PATH_GET_ORGANIZATIONS,
4974 finderArgs, list);
4975
4976 closeSession(session);
4977 }
4978 }
4979
4980 return list;
4981 }
4982
4983 public static final FinderPath FINDER_PATH_GET_ORGANIZATIONS_SIZE = new FinderPath(com.liferay.portal.model.impl.OrganizationModelImpl.ENTITY_CACHE_ENABLED,
4984 UserModelImpl.FINDER_CACHE_ENABLED_USERS_ORGS,
4985 UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME,
4986 "getOrganizationsSize", new String[] { Long.class.getName() });
4987
4988
4995 public int getOrganizationsSize(long pk) throws SystemException {
4996 Object[] finderArgs = new Object[] { pk };
4997
4998 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_ORGANIZATIONS_SIZE,
4999 finderArgs, this);
5000
5001 if (count == null) {
5002 Session session = null;
5003
5004 try {
5005 session = openSession();
5006
5007 SQLQuery q = session.createSQLQuery(_SQL_GETORGANIZATIONSSIZE);
5008
5009 q.addScalar(COUNT_COLUMN_NAME,
5010 com.liferay.portal.kernel.dao.orm.Type.LONG);
5011
5012 QueryPos qPos = QueryPos.getInstance(q);
5013
5014 qPos.add(pk);
5015
5016 count = (Long)q.uniqueResult();
5017 }
5018 catch (Exception e) {
5019 throw processException(e);
5020 }
5021 finally {
5022 if (count == null) {
5023 count = Long.valueOf(0);
5024 }
5025
5026 FinderCacheUtil.putResult(FINDER_PATH_GET_ORGANIZATIONS_SIZE,
5027 finderArgs, count);
5028
5029 closeSession(session);
5030 }
5031 }
5032
5033 return count.intValue();
5034 }
5035
5036 public static final FinderPath FINDER_PATH_CONTAINS_ORGANIZATION = new FinderPath(com.liferay.portal.model.impl.OrganizationModelImpl.ENTITY_CACHE_ENABLED,
5037 UserModelImpl.FINDER_CACHE_ENABLED_USERS_ORGS,
5038 UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME,
5039 "containsOrganization",
5040 new String[] { Long.class.getName(), Long.class.getName() });
5041
5042
5050 public boolean containsOrganization(long pk, long organizationPK)
5051 throws SystemException {
5052 Object[] finderArgs = new Object[] { pk, organizationPK };
5053
5054 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_ORGANIZATION,
5055 finderArgs, this);
5056
5057 if (value == null) {
5058 try {
5059 value = Boolean.valueOf(containsOrganization.contains(pk,
5060 organizationPK));
5061 }
5062 catch (Exception e) {
5063 throw processException(e);
5064 }
5065 finally {
5066 if (value == null) {
5067 value = Boolean.FALSE;
5068 }
5069
5070 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_ORGANIZATION,
5071 finderArgs, value);
5072 }
5073 }
5074
5075 return value.booleanValue();
5076 }
5077
5078
5085 public boolean containsOrganizations(long pk) throws SystemException {
5086 if (getOrganizationsSize(pk) > 0) {
5087 return true;
5088 }
5089 else {
5090 return false;
5091 }
5092 }
5093
5094
5101 public void addOrganization(long pk, long organizationPK)
5102 throws SystemException {
5103 try {
5104 addOrganization.add(pk, organizationPK);
5105 }
5106 catch (Exception e) {
5107 throw processException(e);
5108 }
5109 finally {
5110 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
5111 }
5112 }
5113
5114
5121 public void addOrganization(long pk,
5122 com.liferay.portal.model.Organization organization)
5123 throws SystemException {
5124 try {
5125 addOrganization.add(pk, organization.getPrimaryKey());
5126 }
5127 catch (Exception e) {
5128 throw processException(e);
5129 }
5130 finally {
5131 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
5132 }
5133 }
5134
5135
5142 public void addOrganizations(long pk, long[] organizationPKs)
5143 throws SystemException {
5144 try {
5145 for (long organizationPK : organizationPKs) {
5146 addOrganization.add(pk, organizationPK);
5147 }
5148 }
5149 catch (Exception e) {
5150 throw processException(e);
5151 }
5152 finally {
5153 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
5154 }
5155 }
5156
5157
5164 public void addOrganizations(long pk,
5165 List<com.liferay.portal.model.Organization> organizations)
5166 throws SystemException {
5167 try {
5168 for (com.liferay.portal.model.Organization organization : organizations) {
5169 addOrganization.add(pk, organization.getPrimaryKey());
5170 }
5171 }
5172 catch (Exception e) {
5173 throw processException(e);
5174 }
5175 finally {
5176 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
5177 }
5178 }
5179
5180
5186 public void clearOrganizations(long pk) throws SystemException {
5187 try {
5188 clearOrganizations.clear(pk);
5189 }
5190 catch (Exception e) {
5191 throw processException(e);
5192 }
5193 finally {
5194 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
5195 }
5196 }
5197
5198
5205 public void removeOrganization(long pk, long organizationPK)
5206 throws SystemException {
5207 try {
5208 removeOrganization.remove(pk, organizationPK);
5209 }
5210 catch (Exception e) {
5211 throw processException(e);
5212 }
5213 finally {
5214 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
5215 }
5216 }
5217
5218
5225 public void removeOrganization(long pk,
5226 com.liferay.portal.model.Organization organization)
5227 throws SystemException {
5228 try {
5229 removeOrganization.remove(pk, organization.getPrimaryKey());
5230 }
5231 catch (Exception e) {
5232 throw processException(e);
5233 }
5234 finally {
5235 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
5236 }
5237 }
5238
5239
5246 public void removeOrganizations(long pk, long[] organizationPKs)
5247 throws SystemException {
5248 try {
5249 for (long organizationPK : organizationPKs) {
5250 removeOrganization.remove(pk, organizationPK);
5251 }
5252 }
5253 catch (Exception e) {
5254 throw processException(e);
5255 }
5256 finally {
5257 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
5258 }
5259 }
5260
5261
5268 public void removeOrganizations(long pk,
5269 List<com.liferay.portal.model.Organization> organizations)
5270 throws SystemException {
5271 try {
5272 for (com.liferay.portal.model.Organization organization : organizations) {
5273 removeOrganization.remove(pk, organization.getPrimaryKey());
5274 }
5275 }
5276 catch (Exception e) {
5277 throw processException(e);
5278 }
5279 finally {
5280 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
5281 }
5282 }
5283
5284
5291 public void setOrganizations(long pk, long[] organizationPKs)
5292 throws SystemException {
5293 try {
5294 Set<Long> organizationPKSet = SetUtil.fromArray(organizationPKs);
5295
5296 List<com.liferay.portal.model.Organization> organizations = getOrganizations(pk);
5297
5298 for (com.liferay.portal.model.Organization organization : organizations) {
5299 if (!organizationPKSet.remove(organization.getPrimaryKey())) {
5300 removeOrganization.remove(pk, organization.getPrimaryKey());
5301 }
5302 }
5303
5304 for (Long organizationPK : organizationPKSet) {
5305 addOrganization.add(pk, organizationPK);
5306 }
5307 }
5308 catch (Exception e) {
5309 throw processException(e);
5310 }
5311 finally {
5312 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
5313 }
5314 }
5315
5316
5323 public void setOrganizations(long pk,
5324 List<com.liferay.portal.model.Organization> organizations)
5325 throws SystemException {
5326 try {
5327 long[] organizationPKs = new long[organizations.size()];
5328
5329 for (int i = 0; i < organizations.size(); i++) {
5330 com.liferay.portal.model.Organization organization = organizations.get(i);
5331
5332 organizationPKs[i] = organization.getPrimaryKey();
5333 }
5334
5335 setOrganizations(pk, organizationPKs);
5336 }
5337 catch (Exception e) {
5338 throw processException(e);
5339 }
5340 finally {
5341 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ORGS_NAME);
5342 }
5343 }
5344
5345
5352 public List<com.liferay.portal.model.Permission> getPermissions(long pk)
5353 throws SystemException {
5354 return getPermissions(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
5355 }
5356
5357
5370 public List<com.liferay.portal.model.Permission> getPermissions(long pk,
5371 int start, int end) throws SystemException {
5372 return getPermissions(pk, start, end, null);
5373 }
5374
5375 public static final FinderPath FINDER_PATH_GET_PERMISSIONS = new FinderPath(com.liferay.portal.model.impl.PermissionModelImpl.ENTITY_CACHE_ENABLED,
5376 UserModelImpl.FINDER_CACHE_ENABLED_USERS_PERMISSIONS,
5377 UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME,
5378 "getPermissions",
5379 new String[] {
5380 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
5381 "com.liferay.portal.kernel.util.OrderByComparator"
5382 });
5383
5384
5398 public List<com.liferay.portal.model.Permission> getPermissions(long pk,
5399 int start, int end, OrderByComparator orderByComparator)
5400 throws SystemException {
5401 Object[] finderArgs = new Object[] {
5402 pk, String.valueOf(start), String.valueOf(end),
5403 String.valueOf(orderByComparator)
5404 };
5405
5406 List<com.liferay.portal.model.Permission> list = (List<com.liferay.portal.model.Permission>)FinderCacheUtil.getResult(FINDER_PATH_GET_PERMISSIONS,
5407 finderArgs, this);
5408
5409 if (list == null) {
5410 Session session = null;
5411
5412 try {
5413 session = openSession();
5414
5415 String sql = null;
5416
5417 if (orderByComparator != null) {
5418 sql = _SQL_GETPERMISSIONS.concat(ORDER_BY_CLAUSE)
5419 .concat(orderByComparator.getOrderBy());
5420 }
5421 else {
5422 sql = _SQL_GETPERMISSIONS;
5423 }
5424
5425 SQLQuery q = session.createSQLQuery(sql);
5426
5427 q.addEntity("Permission_",
5428 com.liferay.portal.model.impl.PermissionImpl.class);
5429
5430 QueryPos qPos = QueryPos.getInstance(q);
5431
5432 qPos.add(pk);
5433
5434 list = (List<com.liferay.portal.model.Permission>)QueryUtil.list(q,
5435 getDialect(), start, end);
5436 }
5437 catch (Exception e) {
5438 throw processException(e);
5439 }
5440 finally {
5441 if (list == null) {
5442 list = new ArrayList<com.liferay.portal.model.Permission>();
5443 }
5444
5445 permissionPersistence.cacheResult(list);
5446
5447 FinderCacheUtil.putResult(FINDER_PATH_GET_PERMISSIONS,
5448 finderArgs, list);
5449
5450 closeSession(session);
5451 }
5452 }
5453
5454 return list;
5455 }
5456
5457 public static final FinderPath FINDER_PATH_GET_PERMISSIONS_SIZE = new FinderPath(com.liferay.portal.model.impl.PermissionModelImpl.ENTITY_CACHE_ENABLED,
5458 UserModelImpl.FINDER_CACHE_ENABLED_USERS_PERMISSIONS,
5459 UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME,
5460 "getPermissionsSize", new String[] { Long.class.getName() });
5461
5462
5469 public int getPermissionsSize(long pk) throws SystemException {
5470 Object[] finderArgs = new Object[] { pk };
5471
5472 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_PERMISSIONS_SIZE,
5473 finderArgs, this);
5474
5475 if (count == null) {
5476 Session session = null;
5477
5478 try {
5479 session = openSession();
5480
5481 SQLQuery q = session.createSQLQuery(_SQL_GETPERMISSIONSSIZE);
5482
5483 q.addScalar(COUNT_COLUMN_NAME,
5484 com.liferay.portal.kernel.dao.orm.Type.LONG);
5485
5486 QueryPos qPos = QueryPos.getInstance(q);
5487
5488 qPos.add(pk);
5489
5490 count = (Long)q.uniqueResult();
5491 }
5492 catch (Exception e) {
5493 throw processException(e);
5494 }
5495 finally {
5496 if (count == null) {
5497 count = Long.valueOf(0);
5498 }
5499
5500 FinderCacheUtil.putResult(FINDER_PATH_GET_PERMISSIONS_SIZE,
5501 finderArgs, count);
5502
5503 closeSession(session);
5504 }
5505 }
5506
5507 return count.intValue();
5508 }
5509
5510 public static final FinderPath FINDER_PATH_CONTAINS_PERMISSION = new FinderPath(com.liferay.portal.model.impl.PermissionModelImpl.ENTITY_CACHE_ENABLED,
5511 UserModelImpl.FINDER_CACHE_ENABLED_USERS_PERMISSIONS,
5512 UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME,
5513 "containsPermission",
5514 new String[] { Long.class.getName(), Long.class.getName() });
5515
5516
5524 public boolean containsPermission(long pk, long permissionPK)
5525 throws SystemException {
5526 Object[] finderArgs = new Object[] { pk, permissionPK };
5527
5528 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_PERMISSION,
5529 finderArgs, this);
5530
5531 if (value == null) {
5532 try {
5533 value = Boolean.valueOf(containsPermission.contains(pk,
5534 permissionPK));
5535 }
5536 catch (Exception e) {
5537 throw processException(e);
5538 }
5539 finally {
5540 if (value == null) {
5541 value = Boolean.FALSE;
5542 }
5543
5544 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_PERMISSION,
5545 finderArgs, value);
5546 }
5547 }
5548
5549 return value.booleanValue();
5550 }
5551
5552
5559 public boolean containsPermissions(long pk) throws SystemException {
5560 if (getPermissionsSize(pk) > 0) {
5561 return true;
5562 }
5563 else {
5564 return false;
5565 }
5566 }
5567
5568
5575 public void addPermission(long pk, long permissionPK)
5576 throws SystemException {
5577 try {
5578 addPermission.add(pk, permissionPK);
5579 }
5580 catch (Exception e) {
5581 throw processException(e);
5582 }
5583 finally {
5584 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
5585 }
5586 }
5587
5588
5595 public void addPermission(long pk,
5596 com.liferay.portal.model.Permission permission)
5597 throws SystemException {
5598 try {
5599 addPermission.add(pk, permission.getPrimaryKey());
5600 }
5601 catch (Exception e) {
5602 throw processException(e);
5603 }
5604 finally {
5605 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
5606 }
5607 }
5608
5609
5616 public void addPermissions(long pk, long[] permissionPKs)
5617 throws SystemException {
5618 try {
5619 for (long permissionPK : permissionPKs) {
5620 addPermission.add(pk, permissionPK);
5621 }
5622 }
5623 catch (Exception e) {
5624 throw processException(e);
5625 }
5626 finally {
5627 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
5628 }
5629 }
5630
5631
5638 public void addPermissions(long pk,
5639 List<com.liferay.portal.model.Permission> permissions)
5640 throws SystemException {
5641 try {
5642 for (com.liferay.portal.model.Permission permission : permissions) {
5643 addPermission.add(pk, permission.getPrimaryKey());
5644 }
5645 }
5646 catch (Exception e) {
5647 throw processException(e);
5648 }
5649 finally {
5650 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
5651 }
5652 }
5653
5654
5660 public void clearPermissions(long pk) throws SystemException {
5661 try {
5662 clearPermissions.clear(pk);
5663 }
5664 catch (Exception e) {
5665 throw processException(e);
5666 }
5667 finally {
5668 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
5669 }
5670 }
5671
5672
5679 public void removePermission(long pk, long permissionPK)
5680 throws SystemException {
5681 try {
5682 removePermission.remove(pk, permissionPK);
5683 }
5684 catch (Exception e) {
5685 throw processException(e);
5686 }
5687 finally {
5688 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
5689 }
5690 }
5691
5692
5699 public void removePermission(long pk,
5700 com.liferay.portal.model.Permission permission)
5701 throws SystemException {
5702 try {
5703 removePermission.remove(pk, permission.getPrimaryKey());
5704 }
5705 catch (Exception e) {
5706 throw processException(e);
5707 }
5708 finally {
5709 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
5710 }
5711 }
5712
5713
5720 public void removePermissions(long pk, long[] permissionPKs)
5721 throws SystemException {
5722 try {
5723 for (long permissionPK : permissionPKs) {
5724 removePermission.remove(pk, permissionPK);
5725 }
5726 }
5727 catch (Exception e) {
5728 throw processException(e);
5729 }
5730 finally {
5731 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
5732 }
5733 }
5734
5735
5742 public void removePermissions(long pk,
5743 List<com.liferay.portal.model.Permission> permissions)
5744 throws SystemException {
5745 try {
5746 for (com.liferay.portal.model.Permission permission : permissions) {
5747 removePermission.remove(pk, permission.getPrimaryKey());
5748 }
5749 }
5750 catch (Exception e) {
5751 throw processException(e);
5752 }
5753 finally {
5754 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
5755 }
5756 }
5757
5758
5765 public void setPermissions(long pk, long[] permissionPKs)
5766 throws SystemException {
5767 try {
5768 Set<Long> permissionPKSet = SetUtil.fromArray(permissionPKs);
5769
5770 List<com.liferay.portal.model.Permission> permissions = getPermissions(pk);
5771
5772 for (com.liferay.portal.model.Permission permission : permissions) {
5773 if (!permissionPKSet.remove(permission.getPrimaryKey())) {
5774 removePermission.remove(pk, permission.getPrimaryKey());
5775 }
5776 }
5777
5778 for (Long permissionPK : permissionPKSet) {
5779 addPermission.add(pk, permissionPK);
5780 }
5781 }
5782 catch (Exception e) {
5783 throw processException(e);
5784 }
5785 finally {
5786 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
5787 }
5788 }
5789
5790
5797 public void setPermissions(long pk,
5798 List<com.liferay.portal.model.Permission> permissions)
5799 throws SystemException {
5800 try {
5801 long[] permissionPKs = new long[permissions.size()];
5802
5803 for (int i = 0; i < permissions.size(); i++) {
5804 com.liferay.portal.model.Permission permission = permissions.get(i);
5805
5806 permissionPKs[i] = permission.getPrimaryKey();
5807 }
5808
5809 setPermissions(pk, permissionPKs);
5810 }
5811 catch (Exception e) {
5812 throw processException(e);
5813 }
5814 finally {
5815 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_PERMISSIONS_NAME);
5816 }
5817 }
5818
5819
5826 public List<com.liferay.portal.model.Role> getRoles(long pk)
5827 throws SystemException {
5828 return getRoles(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
5829 }
5830
5831
5844 public List<com.liferay.portal.model.Role> getRoles(long pk, int start,
5845 int end) throws SystemException {
5846 return getRoles(pk, start, end, null);
5847 }
5848
5849 public static final FinderPath FINDER_PATH_GET_ROLES = new FinderPath(com.liferay.portal.model.impl.RoleModelImpl.ENTITY_CACHE_ENABLED,
5850 UserModelImpl.FINDER_CACHE_ENABLED_USERS_ROLES,
5851 UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME, "getRoles",
5852 new String[] {
5853 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
5854 "com.liferay.portal.kernel.util.OrderByComparator"
5855 });
5856
5857
5871 public List<com.liferay.portal.model.Role> getRoles(long pk, int start,
5872 int end, OrderByComparator orderByComparator) throws SystemException {
5873 Object[] finderArgs = new Object[] {
5874 pk, String.valueOf(start), String.valueOf(end),
5875 String.valueOf(orderByComparator)
5876 };
5877
5878 List<com.liferay.portal.model.Role> list = (List<com.liferay.portal.model.Role>)FinderCacheUtil.getResult(FINDER_PATH_GET_ROLES,
5879 finderArgs, this);
5880
5881 if (list == null) {
5882 Session session = null;
5883
5884 try {
5885 session = openSession();
5886
5887 String sql = null;
5888
5889 if (orderByComparator != null) {
5890 sql = _SQL_GETROLES.concat(ORDER_BY_CLAUSE)
5891 .concat(orderByComparator.getOrderBy());
5892 }
5893 else {
5894 sql = _SQL_GETROLES.concat(com.liferay.portal.model.impl.RoleModelImpl.ORDER_BY_SQL);
5895 }
5896
5897 SQLQuery q = session.createSQLQuery(sql);
5898
5899 q.addEntity("Role_",
5900 com.liferay.portal.model.impl.RoleImpl.class);
5901
5902 QueryPos qPos = QueryPos.getInstance(q);
5903
5904 qPos.add(pk);
5905
5906 list = (List<com.liferay.portal.model.Role>)QueryUtil.list(q,
5907 getDialect(), start, end);
5908 }
5909 catch (Exception e) {
5910 throw processException(e);
5911 }
5912 finally {
5913 if (list == null) {
5914 list = new ArrayList<com.liferay.portal.model.Role>();
5915 }
5916
5917 rolePersistence.cacheResult(list);
5918
5919 FinderCacheUtil.putResult(FINDER_PATH_GET_ROLES, finderArgs,
5920 list);
5921
5922 closeSession(session);
5923 }
5924 }
5925
5926 return list;
5927 }
5928
5929 public static final FinderPath FINDER_PATH_GET_ROLES_SIZE = new FinderPath(com.liferay.portal.model.impl.RoleModelImpl.ENTITY_CACHE_ENABLED,
5930 UserModelImpl.FINDER_CACHE_ENABLED_USERS_ROLES,
5931 UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME, "getRolesSize",
5932 new String[] { Long.class.getName() });
5933
5934
5941 public int getRolesSize(long pk) throws SystemException {
5942 Object[] finderArgs = new Object[] { pk };
5943
5944 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_ROLES_SIZE,
5945 finderArgs, this);
5946
5947 if (count == null) {
5948 Session session = null;
5949
5950 try {
5951 session = openSession();
5952
5953 SQLQuery q = session.createSQLQuery(_SQL_GETROLESSIZE);
5954
5955 q.addScalar(COUNT_COLUMN_NAME,
5956 com.liferay.portal.kernel.dao.orm.Type.LONG);
5957
5958 QueryPos qPos = QueryPos.getInstance(q);
5959
5960 qPos.add(pk);
5961
5962 count = (Long)q.uniqueResult();
5963 }
5964 catch (Exception e) {
5965 throw processException(e);
5966 }
5967 finally {
5968 if (count == null) {
5969 count = Long.valueOf(0);
5970 }
5971
5972 FinderCacheUtil.putResult(FINDER_PATH_GET_ROLES_SIZE,
5973 finderArgs, count);
5974
5975 closeSession(session);
5976 }
5977 }
5978
5979 return count.intValue();
5980 }
5981
5982 public static final FinderPath FINDER_PATH_CONTAINS_ROLE = new FinderPath(com.liferay.portal.model.impl.RoleModelImpl.ENTITY_CACHE_ENABLED,
5983 UserModelImpl.FINDER_CACHE_ENABLED_USERS_ROLES,
5984 UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME, "containsRole",
5985 new String[] { Long.class.getName(), Long.class.getName() });
5986
5987
5995 public boolean containsRole(long pk, long rolePK) throws SystemException {
5996 Object[] finderArgs = new Object[] { pk, rolePK };
5997
5998 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_ROLE,
5999 finderArgs, this);
6000
6001 if (value == null) {
6002 try {
6003 value = Boolean.valueOf(containsRole.contains(pk, rolePK));
6004 }
6005 catch (Exception e) {
6006 throw processException(e);
6007 }
6008 finally {
6009 if (value == null) {
6010 value = Boolean.FALSE;
6011 }
6012
6013 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_ROLE,
6014 finderArgs, value);
6015 }
6016 }
6017
6018 return value.booleanValue();
6019 }
6020
6021
6028 public boolean containsRoles(long pk) throws SystemException {
6029 if (getRolesSize(pk) > 0) {
6030 return true;
6031 }
6032 else {
6033 return false;
6034 }
6035 }
6036
6037
6044 public void addRole(long pk, long rolePK) throws SystemException {
6045 try {
6046 addRole.add(pk, rolePK);
6047 }
6048 catch (Exception e) {
6049 throw processException(e);
6050 }
6051 finally {
6052 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
6053 }
6054 }
6055
6056
6063 public void addRole(long pk, com.liferay.portal.model.Role role)
6064 throws SystemException {
6065 try {
6066 addRole.add(pk, role.getPrimaryKey());
6067 }
6068 catch (Exception e) {
6069 throw processException(e);
6070 }
6071 finally {
6072 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
6073 }
6074 }
6075
6076
6083 public void addRoles(long pk, long[] rolePKs) throws SystemException {
6084 try {
6085 for (long rolePK : rolePKs) {
6086 addRole.add(pk, rolePK);
6087 }
6088 }
6089 catch (Exception e) {
6090 throw processException(e);
6091 }
6092 finally {
6093 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
6094 }
6095 }
6096
6097
6104 public void addRoles(long pk, List<com.liferay.portal.model.Role> roles)
6105 throws SystemException {
6106 try {
6107 for (com.liferay.portal.model.Role role : roles) {
6108 addRole.add(pk, role.getPrimaryKey());
6109 }
6110 }
6111 catch (Exception e) {
6112 throw processException(e);
6113 }
6114 finally {
6115 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
6116 }
6117 }
6118
6119
6125 public void clearRoles(long pk) throws SystemException {
6126 try {
6127 clearRoles.clear(pk);
6128 }
6129 catch (Exception e) {
6130 throw processException(e);
6131 }
6132 finally {
6133 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
6134 }
6135 }
6136
6137
6144 public void removeRole(long pk, long rolePK) throws SystemException {
6145 try {
6146 removeRole.remove(pk, rolePK);
6147 }
6148 catch (Exception e) {
6149 throw processException(e);
6150 }
6151 finally {
6152 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
6153 }
6154 }
6155
6156
6163 public void removeRole(long pk, com.liferay.portal.model.Role role)
6164 throws SystemException {
6165 try {
6166 removeRole.remove(pk, role.getPrimaryKey());
6167 }
6168 catch (Exception e) {
6169 throw processException(e);
6170 }
6171 finally {
6172 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
6173 }
6174 }
6175
6176
6183 public void removeRoles(long pk, long[] rolePKs) throws SystemException {
6184 try {
6185 for (long rolePK : rolePKs) {
6186 removeRole.remove(pk, rolePK);
6187 }
6188 }
6189 catch (Exception e) {
6190 throw processException(e);
6191 }
6192 finally {
6193 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
6194 }
6195 }
6196
6197
6204 public void removeRoles(long pk, List<com.liferay.portal.model.Role> roles)
6205 throws SystemException {
6206 try {
6207 for (com.liferay.portal.model.Role role : roles) {
6208 removeRole.remove(pk, role.getPrimaryKey());
6209 }
6210 }
6211 catch (Exception e) {
6212 throw processException(e);
6213 }
6214 finally {
6215 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
6216 }
6217 }
6218
6219
6226 public void setRoles(long pk, long[] rolePKs) throws SystemException {
6227 try {
6228 Set<Long> rolePKSet = SetUtil.fromArray(rolePKs);
6229
6230 List<com.liferay.portal.model.Role> roles = getRoles(pk);
6231
6232 for (com.liferay.portal.model.Role role : roles) {
6233 if (!rolePKSet.remove(role.getPrimaryKey())) {
6234 removeRole.remove(pk, role.getPrimaryKey());
6235 }
6236 }
6237
6238 for (Long rolePK : rolePKSet) {
6239 addRole.add(pk, rolePK);
6240 }
6241 }
6242 catch (Exception e) {
6243 throw processException(e);
6244 }
6245 finally {
6246 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
6247 }
6248 }
6249
6250
6257 public void setRoles(long pk, List<com.liferay.portal.model.Role> roles)
6258 throws SystemException {
6259 try {
6260 long[] rolePKs = new long[roles.size()];
6261
6262 for (int i = 0; i < roles.size(); i++) {
6263 com.liferay.portal.model.Role role = roles.get(i);
6264
6265 rolePKs[i] = role.getPrimaryKey();
6266 }
6267
6268 setRoles(pk, rolePKs);
6269 }
6270 catch (Exception e) {
6271 throw processException(e);
6272 }
6273 finally {
6274 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_ROLES_NAME);
6275 }
6276 }
6277
6278
6285 public List<com.liferay.portal.model.Team> getTeams(long pk)
6286 throws SystemException {
6287 return getTeams(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
6288 }
6289
6290
6303 public List<com.liferay.portal.model.Team> getTeams(long pk, int start,
6304 int end) throws SystemException {
6305 return getTeams(pk, start, end, null);
6306 }
6307
6308 public static final FinderPath FINDER_PATH_GET_TEAMS = new FinderPath(com.liferay.portal.model.impl.TeamModelImpl.ENTITY_CACHE_ENABLED,
6309 UserModelImpl.FINDER_CACHE_ENABLED_USERS_TEAMS,
6310 UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME, "getTeams",
6311 new String[] {
6312 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
6313 "com.liferay.portal.kernel.util.OrderByComparator"
6314 });
6315
6316
6330 public List<com.liferay.portal.model.Team> getTeams(long pk, int start,
6331 int end, OrderByComparator orderByComparator) throws SystemException {
6332 Object[] finderArgs = new Object[] {
6333 pk, String.valueOf(start), String.valueOf(end),
6334 String.valueOf(orderByComparator)
6335 };
6336
6337 List<com.liferay.portal.model.Team> list = (List<com.liferay.portal.model.Team>)FinderCacheUtil.getResult(FINDER_PATH_GET_TEAMS,
6338 finderArgs, this);
6339
6340 if (list == null) {
6341 Session session = null;
6342
6343 try {
6344 session = openSession();
6345
6346 String sql = null;
6347
6348 if (orderByComparator != null) {
6349 sql = _SQL_GETTEAMS.concat(ORDER_BY_CLAUSE)
6350 .concat(orderByComparator.getOrderBy());
6351 }
6352 else {
6353 sql = _SQL_GETTEAMS.concat(com.liferay.portal.model.impl.TeamModelImpl.ORDER_BY_SQL);
6354 }
6355
6356 SQLQuery q = session.createSQLQuery(sql);
6357
6358 q.addEntity("Team", com.liferay.portal.model.impl.TeamImpl.class);
6359
6360 QueryPos qPos = QueryPos.getInstance(q);
6361
6362 qPos.add(pk);
6363
6364 list = (List<com.liferay.portal.model.Team>)QueryUtil.list(q,
6365 getDialect(), start, end);
6366 }
6367 catch (Exception e) {
6368 throw processException(e);
6369 }
6370 finally {
6371 if (list == null) {
6372 list = new ArrayList<com.liferay.portal.model.Team>();
6373 }
6374
6375 teamPersistence.cacheResult(list);
6376
6377 FinderCacheUtil.putResult(FINDER_PATH_GET_TEAMS, finderArgs,
6378 list);
6379
6380 closeSession(session);
6381 }
6382 }
6383
6384 return list;
6385 }
6386
6387 public static final FinderPath FINDER_PATH_GET_TEAMS_SIZE = new FinderPath(com.liferay.portal.model.impl.TeamModelImpl.ENTITY_CACHE_ENABLED,
6388 UserModelImpl.FINDER_CACHE_ENABLED_USERS_TEAMS,
6389 UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME, "getTeamsSize",
6390 new String[] { Long.class.getName() });
6391
6392
6399 public int getTeamsSize(long pk) throws SystemException {
6400 Object[] finderArgs = new Object[] { pk };
6401
6402 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_TEAMS_SIZE,
6403 finderArgs, this);
6404
6405 if (count == null) {
6406 Session session = null;
6407
6408 try {
6409 session = openSession();
6410
6411 SQLQuery q = session.createSQLQuery(_SQL_GETTEAMSSIZE);
6412
6413 q.addScalar(COUNT_COLUMN_NAME,
6414 com.liferay.portal.kernel.dao.orm.Type.LONG);
6415
6416 QueryPos qPos = QueryPos.getInstance(q);
6417
6418 qPos.add(pk);
6419
6420 count = (Long)q.uniqueResult();
6421 }
6422 catch (Exception e) {
6423 throw processException(e);
6424 }
6425 finally {
6426 if (count == null) {
6427 count = Long.valueOf(0);
6428 }
6429
6430 FinderCacheUtil.putResult(FINDER_PATH_GET_TEAMS_SIZE,
6431 finderArgs, count);
6432
6433 closeSession(session);
6434 }
6435 }
6436
6437 return count.intValue();
6438 }
6439
6440 public static final FinderPath FINDER_PATH_CONTAINS_TEAM = new FinderPath(com.liferay.portal.model.impl.TeamModelImpl.ENTITY_CACHE_ENABLED,
6441 UserModelImpl.FINDER_CACHE_ENABLED_USERS_TEAMS,
6442 UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME, "containsTeam",
6443 new String[] { Long.class.getName(), Long.class.getName() });
6444
6445
6453 public boolean containsTeam(long pk, long teamPK) throws SystemException {
6454 Object[] finderArgs = new Object[] { pk, teamPK };
6455
6456 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_TEAM,
6457 finderArgs, this);
6458
6459 if (value == null) {
6460 try {
6461 value = Boolean.valueOf(containsTeam.contains(pk, teamPK));
6462 }
6463 catch (Exception e) {
6464 throw processException(e);
6465 }
6466 finally {
6467 if (value == null) {
6468 value = Boolean.FALSE;
6469 }
6470
6471 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_TEAM,
6472 finderArgs, value);
6473 }
6474 }
6475
6476 return value.booleanValue();
6477 }
6478
6479
6486 public boolean containsTeams(long pk) throws SystemException {
6487 if (getTeamsSize(pk) > 0) {
6488 return true;
6489 }
6490 else {
6491 return false;
6492 }
6493 }
6494
6495
6502 public void addTeam(long pk, long teamPK) throws SystemException {
6503 try {
6504 addTeam.add(pk, teamPK);
6505 }
6506 catch (Exception e) {
6507 throw processException(e);
6508 }
6509 finally {
6510 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
6511 }
6512 }
6513
6514
6521 public void addTeam(long pk, com.liferay.portal.model.Team team)
6522 throws SystemException {
6523 try {
6524 addTeam.add(pk, team.getPrimaryKey());
6525 }
6526 catch (Exception e) {
6527 throw processException(e);
6528 }
6529 finally {
6530 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
6531 }
6532 }
6533
6534
6541 public void addTeams(long pk, long[] teamPKs) throws SystemException {
6542 try {
6543 for (long teamPK : teamPKs) {
6544 addTeam.add(pk, teamPK);
6545 }
6546 }
6547 catch (Exception e) {
6548 throw processException(e);
6549 }
6550 finally {
6551 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
6552 }
6553 }
6554
6555
6562 public void addTeams(long pk, List<com.liferay.portal.model.Team> teams)
6563 throws SystemException {
6564 try {
6565 for (com.liferay.portal.model.Team team : teams) {
6566 addTeam.add(pk, team.getPrimaryKey());
6567 }
6568 }
6569 catch (Exception e) {
6570 throw processException(e);
6571 }
6572 finally {
6573 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
6574 }
6575 }
6576
6577
6583 public void clearTeams(long pk) throws SystemException {
6584 try {
6585 clearTeams.clear(pk);
6586 }
6587 catch (Exception e) {
6588 throw processException(e);
6589 }
6590 finally {
6591 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
6592 }
6593 }
6594
6595
6602 public void removeTeam(long pk, long teamPK) throws SystemException {
6603 try {
6604 removeTeam.remove(pk, teamPK);
6605 }
6606 catch (Exception e) {
6607 throw processException(e);
6608 }
6609 finally {
6610 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
6611 }
6612 }
6613
6614
6621 public void removeTeam(long pk, com.liferay.portal.model.Team team)
6622 throws SystemException {
6623 try {
6624 removeTeam.remove(pk, team.getPrimaryKey());
6625 }
6626 catch (Exception e) {
6627 throw processException(e);
6628 }
6629 finally {
6630 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
6631 }
6632 }
6633
6634
6641 public void removeTeams(long pk, long[] teamPKs) throws SystemException {
6642 try {
6643 for (long teamPK : teamPKs) {
6644 removeTeam.remove(pk, teamPK);
6645 }
6646 }
6647 catch (Exception e) {
6648 throw processException(e);
6649 }
6650 finally {
6651 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
6652 }
6653 }
6654
6655
6662 public void removeTeams(long pk, List<com.liferay.portal.model.Team> teams)
6663 throws SystemException {
6664 try {
6665 for (com.liferay.portal.model.Team team : teams) {
6666 removeTeam.remove(pk, team.getPrimaryKey());
6667 }
6668 }
6669 catch (Exception e) {
6670 throw processException(e);
6671 }
6672 finally {
6673 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
6674 }
6675 }
6676
6677
6684 public void setTeams(long pk, long[] teamPKs) throws SystemException {
6685 try {
6686 Set<Long> teamPKSet = SetUtil.fromArray(teamPKs);
6687
6688 List<com.liferay.portal.model.Team> teams = getTeams(pk);
6689
6690 for (com.liferay.portal.model.Team team : teams) {
6691 if (!teamPKSet.remove(team.getPrimaryKey())) {
6692 removeTeam.remove(pk, team.getPrimaryKey());
6693 }
6694 }
6695
6696 for (Long teamPK : teamPKSet) {
6697 addTeam.add(pk, teamPK);
6698 }
6699 }
6700 catch (Exception e) {
6701 throw processException(e);
6702 }
6703 finally {
6704 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
6705 }
6706 }
6707
6708
6715 public void setTeams(long pk, List<com.liferay.portal.model.Team> teams)
6716 throws SystemException {
6717 try {
6718 long[] teamPKs = new long[teams.size()];
6719
6720 for (int i = 0; i < teams.size(); i++) {
6721 com.liferay.portal.model.Team team = teams.get(i);
6722
6723 teamPKs[i] = team.getPrimaryKey();
6724 }
6725
6726 setTeams(pk, teamPKs);
6727 }
6728 catch (Exception e) {
6729 throw processException(e);
6730 }
6731 finally {
6732 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
6733 }
6734 }
6735
6736
6743 public List<com.liferay.portal.model.UserGroup> getUserGroups(long pk)
6744 throws SystemException {
6745 return getUserGroups(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
6746 }
6747
6748
6761 public List<com.liferay.portal.model.UserGroup> getUserGroups(long pk,
6762 int start, int end) throws SystemException {
6763 return getUserGroups(pk, start, end, null);
6764 }
6765
6766 public static final FinderPath FINDER_PATH_GET_USERGROUPS = new FinderPath(com.liferay.portal.model.impl.UserGroupModelImpl.ENTITY_CACHE_ENABLED,
6767 UserModelImpl.FINDER_CACHE_ENABLED_USERS_USERGROUPS,
6768 UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME, "getUserGroups",
6769 new String[] {
6770 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
6771 "com.liferay.portal.kernel.util.OrderByComparator"
6772 });
6773
6774
6788 public List<com.liferay.portal.model.UserGroup> getUserGroups(long pk,
6789 int start, int end, OrderByComparator orderByComparator)
6790 throws SystemException {
6791 Object[] finderArgs = new Object[] {
6792 pk, String.valueOf(start), String.valueOf(end),
6793 String.valueOf(orderByComparator)
6794 };
6795
6796 List<com.liferay.portal.model.UserGroup> list = (List<com.liferay.portal.model.UserGroup>)FinderCacheUtil.getResult(FINDER_PATH_GET_USERGROUPS,
6797 finderArgs, this);
6798
6799 if (list == null) {
6800 Session session = null;
6801
6802 try {
6803 session = openSession();
6804
6805 String sql = null;
6806
6807 if (orderByComparator != null) {
6808 sql = _SQL_GETUSERGROUPS.concat(ORDER_BY_CLAUSE)
6809 .concat(orderByComparator.getOrderBy());
6810 }
6811 else {
6812 sql = _SQL_GETUSERGROUPS.concat(com.liferay.portal.model.impl.UserGroupModelImpl.ORDER_BY_SQL);
6813 }
6814
6815 SQLQuery q = session.createSQLQuery(sql);
6816
6817 q.addEntity("UserGroup",
6818 com.liferay.portal.model.impl.UserGroupImpl.class);
6819
6820 QueryPos qPos = QueryPos.getInstance(q);
6821
6822 qPos.add(pk);
6823
6824 list = (List<com.liferay.portal.model.UserGroup>)QueryUtil.list(q,
6825 getDialect(), start, end);
6826 }
6827 catch (Exception e) {
6828 throw processException(e);
6829 }
6830 finally {
6831 if (list == null) {
6832 list = new ArrayList<com.liferay.portal.model.UserGroup>();
6833 }
6834
6835 userGroupPersistence.cacheResult(list);
6836
6837 FinderCacheUtil.putResult(FINDER_PATH_GET_USERGROUPS,
6838 finderArgs, list);
6839
6840 closeSession(session);
6841 }
6842 }
6843
6844 return list;
6845 }
6846
6847 public static final FinderPath FINDER_PATH_GET_USERGROUPS_SIZE = new FinderPath(com.liferay.portal.model.impl.UserGroupModelImpl.ENTITY_CACHE_ENABLED,
6848 UserModelImpl.FINDER_CACHE_ENABLED_USERS_USERGROUPS,
6849 UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME,
6850 "getUserGroupsSize", new String[] { Long.class.getName() });
6851
6852
6859 public int getUserGroupsSize(long pk) throws SystemException {
6860 Object[] finderArgs = new Object[] { pk };
6861
6862 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_USERGROUPS_SIZE,
6863 finderArgs, this);
6864
6865 if (count == null) {
6866 Session session = null;
6867
6868 try {
6869 session = openSession();
6870
6871 SQLQuery q = session.createSQLQuery(_SQL_GETUSERGROUPSSIZE);
6872
6873 q.addScalar(COUNT_COLUMN_NAME,
6874 com.liferay.portal.kernel.dao.orm.Type.LONG);
6875
6876 QueryPos qPos = QueryPos.getInstance(q);
6877
6878 qPos.add(pk);
6879
6880 count = (Long)q.uniqueResult();
6881 }
6882 catch (Exception e) {
6883 throw processException(e);
6884 }
6885 finally {
6886 if (count == null) {
6887 count = Long.valueOf(0);
6888 }
6889
6890 FinderCacheUtil.putResult(FINDER_PATH_GET_USERGROUPS_SIZE,
6891 finderArgs, count);
6892
6893 closeSession(session);
6894 }
6895 }
6896
6897 return count.intValue();
6898 }
6899
6900 public static final FinderPath FINDER_PATH_CONTAINS_USERGROUP = new FinderPath(com.liferay.portal.model.impl.UserGroupModelImpl.ENTITY_CACHE_ENABLED,
6901 UserModelImpl.FINDER_CACHE_ENABLED_USERS_USERGROUPS,
6902 UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME,
6903 "containsUserGroup",
6904 new String[] { Long.class.getName(), Long.class.getName() });
6905
6906
6914 public boolean containsUserGroup(long pk, long userGroupPK)
6915 throws SystemException {
6916 Object[] finderArgs = new Object[] { pk, userGroupPK };
6917
6918 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_USERGROUP,
6919 finderArgs, this);
6920
6921 if (value == null) {
6922 try {
6923 value = Boolean.valueOf(containsUserGroup.contains(pk,
6924 userGroupPK));
6925 }
6926 catch (Exception e) {
6927 throw processException(e);
6928 }
6929 finally {
6930 if (value == null) {
6931 value = Boolean.FALSE;
6932 }
6933
6934 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_USERGROUP,
6935 finderArgs, value);
6936 }
6937 }
6938
6939 return value.booleanValue();
6940 }
6941
6942
6949 public boolean containsUserGroups(long pk) throws SystemException {
6950 if (getUserGroupsSize(pk) > 0) {
6951 return true;
6952 }
6953 else {
6954 return false;
6955 }
6956 }
6957
6958
6965 public void addUserGroup(long pk, long userGroupPK)
6966 throws SystemException {
6967 try {
6968 addUserGroup.add(pk, userGroupPK);
6969 }
6970 catch (Exception e) {
6971 throw processException(e);
6972 }
6973 finally {
6974 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
6975 }
6976 }
6977
6978
6985 public void addUserGroup(long pk,
6986 com.liferay.portal.model.UserGroup userGroup) throws SystemException {
6987 try {
6988 addUserGroup.add(pk, userGroup.getPrimaryKey());
6989 }
6990 catch (Exception e) {
6991 throw processException(e);
6992 }
6993 finally {
6994 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
6995 }
6996 }
6997
6998
7005 public void addUserGroups(long pk, long[] userGroupPKs)
7006 throws SystemException {
7007 try {
7008 for (long userGroupPK : userGroupPKs) {
7009 addUserGroup.add(pk, userGroupPK);
7010 }
7011 }
7012 catch (Exception e) {
7013 throw processException(e);
7014 }
7015 finally {
7016 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
7017 }
7018 }
7019
7020
7027 public void addUserGroups(long pk,
7028 List<com.liferay.portal.model.UserGroup> userGroups)
7029 throws SystemException {
7030 try {
7031 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
7032 addUserGroup.add(pk, userGroup.getPrimaryKey());
7033 }
7034 }
7035 catch (Exception e) {
7036 throw processException(e);
7037 }
7038 finally {
7039 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
7040 }
7041 }
7042
7043
7049 public void clearUserGroups(long pk) throws SystemException {
7050 try {
7051 clearUserGroups.clear(pk);
7052 }
7053 catch (Exception e) {
7054 throw processException(e);
7055 }
7056 finally {
7057 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
7058 }
7059 }
7060
7061
7068 public void removeUserGroup(long pk, long userGroupPK)
7069 throws SystemException {
7070 try {
7071 removeUserGroup.remove(pk, userGroupPK);
7072 }
7073 catch (Exception e) {
7074 throw processException(e);
7075 }
7076 finally {
7077 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
7078 }
7079 }
7080
7081
7088 public void removeUserGroup(long pk,
7089 com.liferay.portal.model.UserGroup userGroup) throws SystemException {
7090 try {
7091 removeUserGroup.remove(pk, userGroup.getPrimaryKey());
7092 }
7093 catch (Exception e) {
7094 throw processException(e);
7095 }
7096 finally {
7097 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
7098 }
7099 }
7100
7101
7108 public void removeUserGroups(long pk, long[] userGroupPKs)
7109 throws SystemException {
7110 try {
7111 for (long userGroupPK : userGroupPKs) {
7112 removeUserGroup.remove(pk, userGroupPK);
7113 }
7114 }
7115 catch (Exception e) {
7116 throw processException(e);
7117 }
7118 finally {
7119 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
7120 }
7121 }
7122
7123
7130 public void removeUserGroups(long pk,
7131 List<com.liferay.portal.model.UserGroup> userGroups)
7132 throws SystemException {
7133 try {
7134 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
7135 removeUserGroup.remove(pk, userGroup.getPrimaryKey());
7136 }
7137 }
7138 catch (Exception e) {
7139 throw processException(e);
7140 }
7141 finally {
7142 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
7143 }
7144 }
7145
7146
7153 public void setUserGroups(long pk, long[] userGroupPKs)
7154 throws SystemException {
7155 try {
7156 Set<Long> userGroupPKSet = SetUtil.fromArray(userGroupPKs);
7157
7158 List<com.liferay.portal.model.UserGroup> userGroups = getUserGroups(pk);
7159
7160 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
7161 if (!userGroupPKSet.remove(userGroup.getPrimaryKey())) {
7162 removeUserGroup.remove(pk, userGroup.getPrimaryKey());
7163 }
7164 }
7165
7166 for (Long userGroupPK : userGroupPKSet) {
7167 addUserGroup.add(pk, userGroupPK);
7168 }
7169 }
7170 catch (Exception e) {
7171 throw processException(e);
7172 }
7173 finally {
7174 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
7175 }
7176 }
7177
7178
7185 public void setUserGroups(long pk,
7186 List<com.liferay.portal.model.UserGroup> userGroups)
7187 throws SystemException {
7188 try {
7189 long[] userGroupPKs = new long[userGroups.size()];
7190
7191 for (int i = 0; i < userGroups.size(); i++) {
7192 com.liferay.portal.model.UserGroup userGroup = userGroups.get(i);
7193
7194 userGroupPKs[i] = userGroup.getPrimaryKey();
7195 }
7196
7197 setUserGroups(pk, userGroupPKs);
7198 }
7199 catch (Exception e) {
7200 throw processException(e);
7201 }
7202 finally {
7203 FinderCacheUtil.clearCache(UserModelImpl.MAPPING_TABLE_USERS_USERGROUPS_NAME);
7204 }
7205 }
7206
7207
7210 public void afterPropertiesSet() {
7211 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
7212 com.liferay.portal.util.PropsUtil.get(
7213 "value.object.listener.com.liferay.portal.model.User")));
7214
7215 if (listenerClassNames.length > 0) {
7216 try {
7217 List<ModelListener<User>> listenersList = new ArrayList<ModelListener<User>>();
7218
7219 for (String listenerClassName : listenerClassNames) {
7220 listenersList.add((ModelListener<User>)InstanceFactory.newInstance(
7221 listenerClassName));
7222 }
7223
7224 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
7225 }
7226 catch (Exception e) {
7227 _log.error(e);
7228 }
7229 }
7230
7231 containsGroup = new ContainsGroup(this);
7232
7233 addGroup = new AddGroup(this);
7234 clearGroups = new ClearGroups(this);
7235 removeGroup = new RemoveGroup(this);
7236
7237 containsOrganization = new ContainsOrganization(this);
7238
7239 addOrganization = new AddOrganization(this);
7240 clearOrganizations = new ClearOrganizations(this);
7241 removeOrganization = new RemoveOrganization(this);
7242
7243 containsPermission = new ContainsPermission(this);
7244
7245 addPermission = new AddPermission(this);
7246 clearPermissions = new ClearPermissions(this);
7247 removePermission = new RemovePermission(this);
7248
7249 containsRole = new ContainsRole(this);
7250
7251 addRole = new AddRole(this);
7252 clearRoles = new ClearRoles(this);
7253 removeRole = new RemoveRole(this);
7254
7255 containsTeam = new ContainsTeam(this);
7256
7257 addTeam = new AddTeam(this);
7258 clearTeams = new ClearTeams(this);
7259 removeTeam = new RemoveTeam(this);
7260
7261 containsUserGroup = new ContainsUserGroup(this);
7262
7263 addUserGroup = new AddUserGroup(this);
7264 clearUserGroups = new ClearUserGroups(this);
7265 removeUserGroup = new RemoveUserGroup(this);
7266 }
7267
7268 @BeanReference(type = AccountPersistence.class)
7269 protected AccountPersistence accountPersistence;
7270 @BeanReference(type = AddressPersistence.class)
7271 protected AddressPersistence addressPersistence;
7272 @BeanReference(type = BrowserTrackerPersistence.class)
7273 protected BrowserTrackerPersistence browserTrackerPersistence;
7274 @BeanReference(type = ClassNamePersistence.class)
7275 protected ClassNamePersistence classNamePersistence;
7276 @BeanReference(type = CompanyPersistence.class)
7277 protected CompanyPersistence companyPersistence;
7278 @BeanReference(type = ContactPersistence.class)
7279 protected ContactPersistence contactPersistence;
7280 @BeanReference(type = CountryPersistence.class)
7281 protected CountryPersistence countryPersistence;
7282 @BeanReference(type = EmailAddressPersistence.class)
7283 protected EmailAddressPersistence emailAddressPersistence;
7284 @BeanReference(type = GroupPersistence.class)
7285 protected GroupPersistence groupPersistence;
7286 @BeanReference(type = ImagePersistence.class)
7287 protected ImagePersistence imagePersistence;
7288 @BeanReference(type = LayoutPersistence.class)
7289 protected LayoutPersistence layoutPersistence;
7290 @BeanReference(type = LayoutPrototypePersistence.class)
7291 protected LayoutPrototypePersistence layoutPrototypePersistence;
7292 @BeanReference(type = LayoutSetPersistence.class)
7293 protected LayoutSetPersistence layoutSetPersistence;
7294 @BeanReference(type = LayoutSetPrototypePersistence.class)
7295 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
7296 @BeanReference(type = ListTypePersistence.class)
7297 protected ListTypePersistence listTypePersistence;
7298 @BeanReference(type = LockPersistence.class)
7299 protected LockPersistence lockPersistence;
7300 @BeanReference(type = MembershipRequestPersistence.class)
7301 protected MembershipRequestPersistence membershipRequestPersistence;
7302 @BeanReference(type = OrganizationPersistence.class)
7303 protected OrganizationPersistence organizationPersistence;
7304 @BeanReference(type = OrgGroupPermissionPersistence.class)
7305 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
7306 @BeanReference(type = OrgGroupRolePersistence.class)
7307 protected OrgGroupRolePersistence orgGroupRolePersistence;
7308 @BeanReference(type = OrgLaborPersistence.class)
7309 protected OrgLaborPersistence orgLaborPersistence;
7310 @BeanReference(type = PasswordPolicyPersistence.class)
7311 protected PasswordPolicyPersistence passwordPolicyPersistence;
7312 @BeanReference(type = PasswordPolicyRelPersistence.class)
7313 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
7314 @BeanReference(type = PasswordTrackerPersistence.class)
7315 protected PasswordTrackerPersistence passwordTrackerPersistence;
7316 @BeanReference(type = PermissionPersistence.class)
7317 protected PermissionPersistence permissionPersistence;
7318 @BeanReference(type = PhonePersistence.class)
7319 protected PhonePersistence phonePersistence;
7320 @BeanReference(type = PluginSettingPersistence.class)
7321 protected PluginSettingPersistence pluginSettingPersistence;
7322 @BeanReference(type = PortletPersistence.class)
7323 protected PortletPersistence portletPersistence;
7324 @BeanReference(type = PortletItemPersistence.class)
7325 protected PortletItemPersistence portletItemPersistence;
7326 @BeanReference(type = PortletPreferencesPersistence.class)
7327 protected PortletPreferencesPersistence portletPreferencesPersistence;
7328 @BeanReference(type = RegionPersistence.class)
7329 protected RegionPersistence regionPersistence;
7330 @BeanReference(type = ReleasePersistence.class)
7331 protected ReleasePersistence releasePersistence;
7332 @BeanReference(type = ResourcePersistence.class)
7333 protected ResourcePersistence resourcePersistence;
7334 @BeanReference(type = ResourceActionPersistence.class)
7335 protected ResourceActionPersistence resourceActionPersistence;
7336 @BeanReference(type = ResourceCodePersistence.class)
7337 protected ResourceCodePersistence resourceCodePersistence;
7338 @BeanReference(type = ResourcePermissionPersistence.class)
7339 protected ResourcePermissionPersistence resourcePermissionPersistence;
7340 @BeanReference(type = RolePersistence.class)
7341 protected RolePersistence rolePersistence;
7342 @BeanReference(type = ServiceComponentPersistence.class)
7343 protected ServiceComponentPersistence serviceComponentPersistence;
7344 @BeanReference(type = ShardPersistence.class)
7345 protected ShardPersistence shardPersistence;
7346 @BeanReference(type = SubscriptionPersistence.class)
7347 protected SubscriptionPersistence subscriptionPersistence;
7348 @BeanReference(type = TicketPersistence.class)
7349 protected TicketPersistence ticketPersistence;
7350 @BeanReference(type = TeamPersistence.class)
7351 protected TeamPersistence teamPersistence;
7352 @BeanReference(type = UserPersistence.class)
7353 protected UserPersistence userPersistence;
7354 @BeanReference(type = UserGroupPersistence.class)
7355 protected UserGroupPersistence userGroupPersistence;
7356 @BeanReference(type = UserGroupGroupRolePersistence.class)
7357 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
7358 @BeanReference(type = UserGroupRolePersistence.class)
7359 protected UserGroupRolePersistence userGroupRolePersistence;
7360 @BeanReference(type = UserIdMapperPersistence.class)
7361 protected UserIdMapperPersistence userIdMapperPersistence;
7362 @BeanReference(type = UserTrackerPersistence.class)
7363 protected UserTrackerPersistence userTrackerPersistence;
7364 @BeanReference(type = UserTrackerPathPersistence.class)
7365 protected UserTrackerPathPersistence userTrackerPathPersistence;
7366 @BeanReference(type = WebDAVPropsPersistence.class)
7367 protected WebDAVPropsPersistence webDAVPropsPersistence;
7368 @BeanReference(type = WebsitePersistence.class)
7369 protected WebsitePersistence websitePersistence;
7370 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
7371 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
7372 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
7373 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
7374 @BeanReference(type = AnnouncementsDeliveryPersistence.class)
7375 protected AnnouncementsDeliveryPersistence announcementsDeliveryPersistence;
7376 @BeanReference(type = AssetEntryPersistence.class)
7377 protected AssetEntryPersistence assetEntryPersistence;
7378 @BeanReference(type = BlogsStatsUserPersistence.class)
7379 protected BlogsStatsUserPersistence blogsStatsUserPersistence;
7380 @BeanReference(type = DLFileRankPersistence.class)
7381 protected DLFileRankPersistence dlFileRankPersistence;
7382 @BeanReference(type = ExpandoValuePersistence.class)
7383 protected ExpandoValuePersistence expandoValuePersistence;
7384 @BeanReference(type = MBBanPersistence.class)
7385 protected MBBanPersistence mbBanPersistence;
7386 @BeanReference(type = MBMessagePersistence.class)
7387 protected MBMessagePersistence mbMessagePersistence;
7388 @BeanReference(type = MBMessageFlagPersistence.class)
7389 protected MBMessageFlagPersistence mbMessageFlagPersistence;
7390 @BeanReference(type = MBStatsUserPersistence.class)
7391 protected MBStatsUserPersistence mbStatsUserPersistence;
7392 @BeanReference(type = ShoppingCartPersistence.class)
7393 protected ShoppingCartPersistence shoppingCartPersistence;
7394 @BeanReference(type = SocialActivityPersistence.class)
7395 protected SocialActivityPersistence socialActivityPersistence;
7396 @BeanReference(type = SocialRequestPersistence.class)
7397 protected SocialRequestPersistence socialRequestPersistence;
7398 protected ContainsGroup containsGroup;
7399 protected AddGroup addGroup;
7400 protected ClearGroups clearGroups;
7401 protected RemoveGroup removeGroup;
7402 protected ContainsOrganization containsOrganization;
7403 protected AddOrganization addOrganization;
7404 protected ClearOrganizations clearOrganizations;
7405 protected RemoveOrganization removeOrganization;
7406 protected ContainsPermission containsPermission;
7407 protected AddPermission addPermission;
7408 protected ClearPermissions clearPermissions;
7409 protected RemovePermission removePermission;
7410 protected ContainsRole containsRole;
7411 protected AddRole addRole;
7412 protected ClearRoles clearRoles;
7413 protected RemoveRole removeRole;
7414 protected ContainsTeam containsTeam;
7415 protected AddTeam addTeam;
7416 protected ClearTeams clearTeams;
7417 protected RemoveTeam removeTeam;
7418 protected ContainsUserGroup containsUserGroup;
7419 protected AddUserGroup addUserGroup;
7420 protected ClearUserGroups clearUserGroups;
7421 protected RemoveUserGroup removeUserGroup;
7422
7423 protected class ContainsGroup {
7424 protected ContainsGroup(UserPersistenceImpl persistenceImpl) {
7425 super();
7426
7427 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
7428 _SQL_CONTAINSGROUP,
7429 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
7430 RowMapper.COUNT);
7431 }
7432
7433 protected boolean contains(long userId, long groupId) {
7434 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
7435 new Long(userId), new Long(groupId)
7436 });
7437
7438 if (results.size() > 0) {
7439 Integer count = results.get(0);
7440
7441 if (count.intValue() > 0) {
7442 return true;
7443 }
7444 }
7445
7446 return false;
7447 }
7448
7449 private MappingSqlQuery<Integer> _mappingSqlQuery;
7450 }
7451
7452 protected class AddGroup {
7453 protected AddGroup(UserPersistenceImpl persistenceImpl) {
7454 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
7455 "INSERT INTO Users_Groups (userId, groupId) VALUES (?, ?)",
7456 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
7457 _persistenceImpl = persistenceImpl;
7458 }
7459
7460 protected void add(long userId, long groupId) throws SystemException {
7461 if (!_persistenceImpl.containsGroup.contains(userId, groupId)) {
7462 ModelListener<com.liferay.portal.model.Group>[] groupListeners = groupPersistence.getListeners();
7463
7464 for (ModelListener<User> listener : listeners) {
7465 listener.onBeforeAddAssociation(userId,
7466 com.liferay.portal.model.Group.class.getName(), groupId);
7467 }
7468
7469 for (ModelListener<com.liferay.portal.model.Group> listener : groupListeners) {
7470 listener.onBeforeAddAssociation(groupId,
7471 User.class.getName(), userId);
7472 }
7473
7474 _sqlUpdate.update(new Object[] {
7475 new Long(userId), new Long(groupId)
7476 });
7477
7478 for (ModelListener<User> listener : listeners) {
7479 listener.onAfterAddAssociation(userId,
7480 com.liferay.portal.model.Group.class.getName(), groupId);
7481 }
7482
7483 for (ModelListener<com.liferay.portal.model.Group> listener : groupListeners) {
7484 listener.onAfterAddAssociation(groupId,
7485 User.class.getName(), userId);
7486 }
7487 }
7488 }
7489
7490 private SqlUpdate _sqlUpdate;
7491 private UserPersistenceImpl _persistenceImpl;
7492 }
7493
7494 protected class ClearGroups {
7495 protected ClearGroups(UserPersistenceImpl persistenceImpl) {
7496 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
7497 "DELETE FROM Users_Groups WHERE userId = ?",
7498 new int[] { java.sql.Types.BIGINT });
7499 }
7500
7501 protected void clear(long userId) throws SystemException {
7502 ModelListener<com.liferay.portal.model.Group>[] groupListeners = groupPersistence.getListeners();
7503
7504 List<com.liferay.portal.model.Group> groups = null;
7505
7506 if ((listeners.length > 0) || (groupListeners.length > 0)) {
7507 groups = getGroups(userId);
7508
7509 for (com.liferay.portal.model.Group group : groups) {
7510 for (ModelListener<User> listener : listeners) {
7511 listener.onBeforeRemoveAssociation(userId,
7512 com.liferay.portal.model.Group.class.getName(),
7513 group.getPrimaryKey());
7514 }
7515
7516 for (ModelListener<com.liferay.portal.model.Group> listener : groupListeners) {
7517 listener.onBeforeRemoveAssociation(group.getPrimaryKey(),
7518 User.class.getName(), userId);
7519 }
7520 }
7521 }
7522
7523 _sqlUpdate.update(new Object[] { new Long(userId) });
7524
7525 if ((listeners.length > 0) || (groupListeners.length > 0)) {
7526 for (com.liferay.portal.model.Group group : groups) {
7527 for (ModelListener<User> listener : listeners) {
7528 listener.onAfterRemoveAssociation(userId,
7529 com.liferay.portal.model.Group.class.getName(),
7530 group.getPrimaryKey());
7531 }
7532
7533 for (ModelListener<com.liferay.portal.model.Group> listener : groupListeners) {
7534 listener.onAfterRemoveAssociation(group.getPrimaryKey(),
7535 User.class.getName(), userId);
7536 }
7537 }
7538 }
7539 }
7540
7541 private SqlUpdate _sqlUpdate;
7542 }
7543
7544 protected class RemoveGroup {
7545 protected RemoveGroup(UserPersistenceImpl persistenceImpl) {
7546 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
7547 "DELETE FROM Users_Groups WHERE userId = ? AND groupId = ?",
7548 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
7549 _persistenceImpl = persistenceImpl;
7550 }
7551
7552 protected void remove(long userId, long groupId)
7553 throws SystemException {
7554 if (_persistenceImpl.containsGroup.contains(userId, groupId)) {
7555 ModelListener<com.liferay.portal.model.Group>[] groupListeners = groupPersistence.getListeners();
7556
7557 for (ModelListener<User> listener : listeners) {
7558 listener.onBeforeRemoveAssociation(userId,
7559 com.liferay.portal.model.Group.class.getName(), groupId);
7560 }
7561
7562 for (ModelListener<com.liferay.portal.model.Group> listener : groupListeners) {
7563 listener.onBeforeRemoveAssociation(groupId,
7564 User.class.getName(), userId);
7565 }
7566
7567 _sqlUpdate.update(new Object[] {
7568 new Long(userId), new Long(groupId)
7569 });
7570
7571 for (ModelListener<User> listener : listeners) {
7572 listener.onAfterRemoveAssociation(userId,
7573 com.liferay.portal.model.Group.class.getName(), groupId);
7574 }
7575
7576 for (ModelListener<com.liferay.portal.model.Group> listener : groupListeners) {
7577 listener.onAfterRemoveAssociation(groupId,
7578 User.class.getName(), userId);
7579 }
7580 }
7581 }
7582
7583 private SqlUpdate _sqlUpdate;
7584 private UserPersistenceImpl _persistenceImpl;
7585 }
7586
7587 protected class ContainsOrganization {
7588 protected ContainsOrganization(UserPersistenceImpl persistenceImpl) {
7589 super();
7590
7591 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
7592 _SQL_CONTAINSORGANIZATION,
7593 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
7594 RowMapper.COUNT);
7595 }
7596
7597 protected boolean contains(long userId, long organizationId) {
7598 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
7599 new Long(userId), new Long(organizationId)
7600 });
7601
7602 if (results.size() > 0) {
7603 Integer count = results.get(0);
7604
7605 if (count.intValue() > 0) {
7606 return true;
7607 }
7608 }
7609
7610 return false;
7611 }
7612
7613 private MappingSqlQuery<Integer> _mappingSqlQuery;
7614 }
7615
7616 protected class AddOrganization {
7617 protected AddOrganization(UserPersistenceImpl persistenceImpl) {
7618 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
7619 "INSERT INTO Users_Orgs (userId, organizationId) VALUES (?, ?)",
7620 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
7621 _persistenceImpl = persistenceImpl;
7622 }
7623
7624 protected void add(long userId, long organizationId)
7625 throws SystemException {
7626 if (!_persistenceImpl.containsOrganization.contains(userId,
7627 organizationId)) {
7628 ModelListener<com.liferay.portal.model.Organization>[] organizationListeners =
7629 organizationPersistence.getListeners();
7630
7631 for (ModelListener<User> listener : listeners) {
7632 listener.onBeforeAddAssociation(userId,
7633 com.liferay.portal.model.Organization.class.getName(),
7634 organizationId);
7635 }
7636
7637 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
7638 listener.onBeforeAddAssociation(organizationId,
7639 User.class.getName(), userId);
7640 }
7641
7642 _sqlUpdate.update(new Object[] {
7643 new Long(userId), new Long(organizationId)
7644 });
7645
7646 for (ModelListener<User> listener : listeners) {
7647 listener.onAfterAddAssociation(userId,
7648 com.liferay.portal.model.Organization.class.getName(),
7649 organizationId);
7650 }
7651
7652 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
7653 listener.onAfterAddAssociation(organizationId,
7654 User.class.getName(), userId);
7655 }
7656 }
7657 }
7658
7659 private SqlUpdate _sqlUpdate;
7660 private UserPersistenceImpl _persistenceImpl;
7661 }
7662
7663 protected class ClearOrganizations {
7664 protected ClearOrganizations(UserPersistenceImpl persistenceImpl) {
7665 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
7666 "DELETE FROM Users_Orgs WHERE userId = ?",
7667 new int[] { java.sql.Types.BIGINT });
7668 }
7669
7670 protected void clear(long userId) throws SystemException {
7671 ModelListener<com.liferay.portal.model.Organization>[] organizationListeners =
7672 organizationPersistence.getListeners();
7673
7674 List<com.liferay.portal.model.Organization> organizations = null;
7675
7676 if ((listeners.length > 0) || (organizationListeners.length > 0)) {
7677 organizations = getOrganizations(userId);
7678
7679 for (com.liferay.portal.model.Organization organization : organizations) {
7680 for (ModelListener<User> listener : listeners) {
7681 listener.onBeforeRemoveAssociation(userId,
7682 com.liferay.portal.model.Organization.class.getName(),
7683 organization.getPrimaryKey());
7684 }
7685
7686 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
7687 listener.onBeforeRemoveAssociation(organization.getPrimaryKey(),
7688 User.class.getName(), userId);
7689 }
7690 }
7691 }
7692
7693 _sqlUpdate.update(new Object[] { new Long(userId) });
7694
7695 if ((listeners.length > 0) || (organizationListeners.length > 0)) {
7696 for (com.liferay.portal.model.Organization organization : organizations) {
7697 for (ModelListener<User> listener : listeners) {
7698 listener.onAfterRemoveAssociation(userId,
7699 com.liferay.portal.model.Organization.class.getName(),
7700 organization.getPrimaryKey());
7701 }
7702
7703 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
7704 listener.onAfterRemoveAssociation(organization.getPrimaryKey(),
7705 User.class.getName(), userId);
7706 }
7707 }
7708 }
7709 }
7710
7711 private SqlUpdate _sqlUpdate;
7712 }
7713
7714 protected class RemoveOrganization {
7715 protected RemoveOrganization(UserPersistenceImpl persistenceImpl) {
7716 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
7717 "DELETE FROM Users_Orgs WHERE userId = ? AND organizationId = ?",
7718 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
7719 _persistenceImpl = persistenceImpl;
7720 }
7721
7722 protected void remove(long userId, long organizationId)
7723 throws SystemException {
7724 if (_persistenceImpl.containsOrganization.contains(userId,
7725 organizationId)) {
7726 ModelListener<com.liferay.portal.model.Organization>[] organizationListeners =
7727 organizationPersistence.getListeners();
7728
7729 for (ModelListener<User> listener : listeners) {
7730 listener.onBeforeRemoveAssociation(userId,
7731 com.liferay.portal.model.Organization.class.getName(),
7732 organizationId);
7733 }
7734
7735 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
7736 listener.onBeforeRemoveAssociation(organizationId,
7737 User.class.getName(), userId);
7738 }
7739
7740 _sqlUpdate.update(new Object[] {
7741 new Long(userId), new Long(organizationId)
7742 });
7743
7744 for (ModelListener<User> listener : listeners) {
7745 listener.onAfterRemoveAssociation(userId,
7746 com.liferay.portal.model.Organization.class.getName(),
7747 organizationId);
7748 }
7749
7750 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
7751 listener.onAfterRemoveAssociation(organizationId,
7752 User.class.getName(), userId);
7753 }
7754 }
7755 }
7756
7757 private SqlUpdate _sqlUpdate;
7758 private UserPersistenceImpl _persistenceImpl;
7759 }
7760
7761 protected class ContainsPermission {
7762 protected ContainsPermission(UserPersistenceImpl persistenceImpl) {
7763 super();
7764
7765 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
7766 _SQL_CONTAINSPERMISSION,
7767 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
7768 RowMapper.COUNT);
7769 }
7770
7771 protected boolean contains(long userId, long permissionId) {
7772 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
7773 new Long(userId), new Long(permissionId)
7774 });
7775
7776 if (results.size() > 0) {
7777 Integer count = results.get(0);
7778
7779 if (count.intValue() > 0) {
7780 return true;
7781 }
7782 }
7783
7784 return false;
7785 }
7786
7787 private MappingSqlQuery<Integer> _mappingSqlQuery;
7788 }
7789
7790 protected class AddPermission {
7791 protected AddPermission(UserPersistenceImpl persistenceImpl) {
7792 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
7793 "INSERT INTO Users_Permissions (userId, permissionId) VALUES (?, ?)",
7794 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
7795 _persistenceImpl = persistenceImpl;
7796 }
7797
7798 protected void add(long userId, long permissionId)
7799 throws SystemException {
7800 if (!_persistenceImpl.containsPermission.contains(userId,
7801 permissionId)) {
7802 ModelListener<com.liferay.portal.model.Permission>[] permissionListeners =
7803 permissionPersistence.getListeners();
7804
7805 for (ModelListener<User> listener : listeners) {
7806 listener.onBeforeAddAssociation(userId,
7807 com.liferay.portal.model.Permission.class.getName(),
7808 permissionId);
7809 }
7810
7811 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
7812 listener.onBeforeAddAssociation(permissionId,
7813 User.class.getName(), userId);
7814 }
7815
7816 _sqlUpdate.update(new Object[] {
7817 new Long(userId), new Long(permissionId)
7818 });
7819
7820 for (ModelListener<User> listener : listeners) {
7821 listener.onAfterAddAssociation(userId,
7822 com.liferay.portal.model.Permission.class.getName(),
7823 permissionId);
7824 }
7825
7826 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
7827 listener.onAfterAddAssociation(permissionId,
7828 User.class.getName(), userId);
7829 }
7830 }
7831 }
7832
7833 private SqlUpdate _sqlUpdate;
7834 private UserPersistenceImpl _persistenceImpl;
7835 }
7836
7837 protected class ClearPermissions {
7838 protected ClearPermissions(UserPersistenceImpl persistenceImpl) {
7839 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
7840 "DELETE FROM Users_Permissions WHERE userId = ?",
7841 new int[] { java.sql.Types.BIGINT });
7842 }
7843
7844 protected void clear(long userId) throws SystemException {
7845 ModelListener<com.liferay.portal.model.Permission>[] permissionListeners =
7846 permissionPersistence.getListeners();
7847
7848 List<com.liferay.portal.model.Permission> permissions = null;
7849
7850 if ((listeners.length > 0) || (permissionListeners.length > 0)) {
7851 permissions = getPermissions(userId);
7852
7853 for (com.liferay.portal.model.Permission permission : permissions) {
7854 for (ModelListener<User> listener : listeners) {
7855 listener.onBeforeRemoveAssociation(userId,
7856 com.liferay.portal.model.Permission.class.getName(),
7857 permission.getPrimaryKey());
7858 }
7859
7860 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
7861 listener.onBeforeRemoveAssociation(permission.getPrimaryKey(),
7862 User.class.getName(), userId);
7863 }
7864 }
7865 }
7866
7867 _sqlUpdate.update(new Object[] { new Long(userId) });
7868
7869 if ((listeners.length > 0) || (permissionListeners.length > 0)) {
7870 for (com.liferay.portal.model.Permission permission : permissions) {
7871 for (ModelListener<User> listener : listeners) {
7872 listener.onAfterRemoveAssociation(userId,
7873 com.liferay.portal.model.Permission.class.getName(),
7874 permission.getPrimaryKey());
7875 }
7876
7877 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
7878 listener.onAfterRemoveAssociation(permission.getPrimaryKey(),
7879 User.class.getName(), userId);
7880 }
7881 }
7882 }
7883 }
7884
7885 private SqlUpdate _sqlUpdate;
7886 }
7887
7888 protected class RemovePermission {
7889 protected RemovePermission(UserPersistenceImpl persistenceImpl) {
7890 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
7891 "DELETE FROM Users_Permissions WHERE userId = ? AND permissionId = ?",
7892 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
7893 _persistenceImpl = persistenceImpl;
7894 }
7895
7896 protected void remove(long userId, long permissionId)
7897 throws SystemException {
7898 if (_persistenceImpl.containsPermission.contains(userId,
7899 permissionId)) {
7900 ModelListener<com.liferay.portal.model.Permission>[] permissionListeners =
7901 permissionPersistence.getListeners();
7902
7903 for (ModelListener<User> listener : listeners) {
7904 listener.onBeforeRemoveAssociation(userId,
7905 com.liferay.portal.model.Permission.class.getName(),
7906 permissionId);
7907 }
7908
7909 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
7910 listener.onBeforeRemoveAssociation(permissionId,
7911 User.class.getName(), userId);
7912 }
7913
7914 _sqlUpdate.update(new Object[] {
7915 new Long(userId), new Long(permissionId)
7916 });
7917
7918 for (ModelListener<User> listener : listeners) {
7919 listener.onAfterRemoveAssociation(userId,
7920 com.liferay.portal.model.Permission.class.getName(),
7921 permissionId);
7922 }
7923
7924 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
7925 listener.onAfterRemoveAssociation(permissionId,
7926 User.class.getName(), userId);
7927 }
7928 }
7929 }
7930
7931 private SqlUpdate _sqlUpdate;
7932 private UserPersistenceImpl _persistenceImpl;
7933 }
7934
7935 protected class ContainsRole {
7936 protected ContainsRole(UserPersistenceImpl persistenceImpl) {
7937 super();
7938
7939 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
7940 _SQL_CONTAINSROLE,
7941 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
7942 RowMapper.COUNT);
7943 }
7944
7945 protected boolean contains(long userId, long roleId) {
7946 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
7947 new Long(userId), new Long(roleId)
7948 });
7949
7950 if (results.size() > 0) {
7951 Integer count = results.get(0);
7952
7953 if (count.intValue() > 0) {
7954 return true;
7955 }
7956 }
7957
7958 return false;
7959 }
7960
7961 private MappingSqlQuery<Integer> _mappingSqlQuery;
7962 }
7963
7964 protected class AddRole {
7965 protected AddRole(UserPersistenceImpl persistenceImpl) {
7966 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
7967 "INSERT INTO Users_Roles (userId, roleId) VALUES (?, ?)",
7968 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
7969 _persistenceImpl = persistenceImpl;
7970 }
7971
7972 protected void add(long userId, long roleId) throws SystemException {
7973 if (!_persistenceImpl.containsRole.contains(userId, roleId)) {
7974 ModelListener<com.liferay.portal.model.Role>[] roleListeners = rolePersistence.getListeners();
7975
7976 for (ModelListener<User> listener : listeners) {
7977 listener.onBeforeAddAssociation(userId,
7978 com.liferay.portal.model.Role.class.getName(), roleId);
7979 }
7980
7981 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
7982 listener.onBeforeAddAssociation(roleId,
7983 User.class.getName(), userId);
7984 }
7985
7986 _sqlUpdate.update(new Object[] {
7987 new Long(userId), new Long(roleId)
7988 });
7989
7990 for (ModelListener<User> listener : listeners) {
7991 listener.onAfterAddAssociation(userId,
7992 com.liferay.portal.model.Role.class.getName(), roleId);
7993 }
7994
7995 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
7996 listener.onAfterAddAssociation(roleId,
7997 User.class.getName(), userId);
7998 }
7999 }
8000 }
8001
8002 private SqlUpdate _sqlUpdate;
8003 private UserPersistenceImpl _persistenceImpl;
8004 }
8005
8006 protected class ClearRoles {
8007 protected ClearRoles(UserPersistenceImpl persistenceImpl) {
8008 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
8009 "DELETE FROM Users_Roles WHERE userId = ?",
8010 new int[] { java.sql.Types.BIGINT });
8011 }
8012
8013 protected void clear(long userId) throws SystemException {
8014 ModelListener<com.liferay.portal.model.Role>[] roleListeners = rolePersistence.getListeners();
8015
8016 List<com.liferay.portal.model.Role> roles = null;
8017
8018 if ((listeners.length > 0) || (roleListeners.length > 0)) {
8019 roles = getRoles(userId);
8020
8021 for (com.liferay.portal.model.Role role : roles) {
8022 for (ModelListener<User> listener : listeners) {
8023 listener.onBeforeRemoveAssociation(userId,
8024 com.liferay.portal.model.Role.class.getName(),
8025 role.getPrimaryKey());
8026 }
8027
8028 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
8029 listener.onBeforeRemoveAssociation(role.getPrimaryKey(),
8030 User.class.getName(), userId);
8031 }
8032 }
8033 }
8034
8035 _sqlUpdate.update(new Object[] { new Long(userId) });
8036
8037 if ((listeners.length > 0) || (roleListeners.length > 0)) {
8038 for (com.liferay.portal.model.Role role : roles) {
8039 for (ModelListener<User> listener : listeners) {
8040 listener.onAfterRemoveAssociation(userId,
8041 com.liferay.portal.model.Role.class.getName(),
8042 role.getPrimaryKey());
8043 }
8044
8045 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
8046 listener.onAfterRemoveAssociation(role.getPrimaryKey(),
8047 User.class.getName(), userId);
8048 }
8049 }
8050 }
8051 }
8052
8053 private SqlUpdate _sqlUpdate;
8054 }
8055
8056 protected class RemoveRole {
8057 protected RemoveRole(UserPersistenceImpl persistenceImpl) {
8058 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
8059 "DELETE FROM Users_Roles WHERE userId = ? AND roleId = ?",
8060 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
8061 _persistenceImpl = persistenceImpl;
8062 }
8063
8064 protected void remove(long userId, long roleId)
8065 throws SystemException {
8066 if (_persistenceImpl.containsRole.contains(userId, roleId)) {
8067 ModelListener<com.liferay.portal.model.Role>[] roleListeners = rolePersistence.getListeners();
8068
8069 for (ModelListener<User> listener : listeners) {
8070 listener.onBeforeRemoveAssociation(userId,
8071 com.liferay.portal.model.Role.class.getName(), roleId);
8072 }
8073
8074 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
8075 listener.onBeforeRemoveAssociation(roleId,
8076 User.class.getName(), userId);
8077 }
8078
8079 _sqlUpdate.update(new Object[] {
8080 new Long(userId), new Long(roleId)
8081 });
8082
8083 for (ModelListener<User> listener : listeners) {
8084 listener.onAfterRemoveAssociation(userId,
8085 com.liferay.portal.model.Role.class.getName(), roleId);
8086 }
8087
8088 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
8089 listener.onAfterRemoveAssociation(roleId,
8090 User.class.getName(), userId);
8091 }
8092 }
8093 }
8094
8095 private SqlUpdate _sqlUpdate;
8096 private UserPersistenceImpl _persistenceImpl;
8097 }
8098
8099 protected class ContainsTeam {
8100 protected ContainsTeam(UserPersistenceImpl persistenceImpl) {
8101 super();
8102
8103 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
8104 _SQL_CONTAINSTEAM,
8105 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
8106 RowMapper.COUNT);
8107 }
8108
8109 protected boolean contains(long userId, long teamId) {
8110 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
8111 new Long(userId), new Long(teamId)
8112 });
8113
8114 if (results.size() > 0) {
8115 Integer count = results.get(0);
8116
8117 if (count.intValue() > 0) {
8118 return true;
8119 }
8120 }
8121
8122 return false;
8123 }
8124
8125 private MappingSqlQuery<Integer> _mappingSqlQuery;
8126 }
8127
8128 protected class AddTeam {
8129 protected AddTeam(UserPersistenceImpl persistenceImpl) {
8130 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
8131 "INSERT INTO Users_Teams (userId, teamId) VALUES (?, ?)",
8132 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
8133 _persistenceImpl = persistenceImpl;
8134 }
8135
8136 protected void add(long userId, long teamId) throws SystemException {
8137 if (!_persistenceImpl.containsTeam.contains(userId, teamId)) {
8138 ModelListener<com.liferay.portal.model.Team>[] teamListeners = teamPersistence.getListeners();
8139
8140 for (ModelListener<User> listener : listeners) {
8141 listener.onBeforeAddAssociation(userId,
8142 com.liferay.portal.model.Team.class.getName(), teamId);
8143 }
8144
8145 for (ModelListener<com.liferay.portal.model.Team> listener : teamListeners) {
8146 listener.onBeforeAddAssociation(teamId,
8147 User.class.getName(), userId);
8148 }
8149
8150 _sqlUpdate.update(new Object[] {
8151 new Long(userId), new Long(teamId)
8152 });
8153
8154 for (ModelListener<User> listener : listeners) {
8155 listener.onAfterAddAssociation(userId,
8156 com.liferay.portal.model.Team.class.getName(), teamId);
8157 }
8158
8159 for (ModelListener<com.liferay.portal.model.Team> listener : teamListeners) {
8160 listener.onAfterAddAssociation(teamId,
8161 User.class.getName(), userId);
8162 }
8163 }
8164 }
8165
8166 private SqlUpdate _sqlUpdate;
8167 private UserPersistenceImpl _persistenceImpl;
8168 }
8169
8170 protected class ClearTeams {
8171 protected ClearTeams(UserPersistenceImpl persistenceImpl) {
8172 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
8173 "DELETE FROM Users_Teams WHERE userId = ?",
8174 new int[] { java.sql.Types.BIGINT });
8175 }
8176
8177 protected void clear(long userId) throws SystemException {
8178 ModelListener<com.liferay.portal.model.Team>[] teamListeners = teamPersistence.getListeners();
8179
8180 List<com.liferay.portal.model.Team> teams = null;
8181
8182 if ((listeners.length > 0) || (teamListeners.length > 0)) {
8183 teams = getTeams(userId);
8184
8185 for (com.liferay.portal.model.Team team : teams) {
8186 for (ModelListener<User> listener : listeners) {
8187 listener.onBeforeRemoveAssociation(userId,
8188 com.liferay.portal.model.Team.class.getName(),
8189 team.getPrimaryKey());
8190 }
8191
8192 for (ModelListener<com.liferay.portal.model.Team> listener : teamListeners) {
8193 listener.onBeforeRemoveAssociation(team.getPrimaryKey(),
8194 User.class.getName(), userId);
8195 }
8196 }
8197 }
8198
8199 _sqlUpdate.update(new Object[] { new Long(userId) });
8200
8201 if ((listeners.length > 0) || (teamListeners.length > 0)) {
8202 for (com.liferay.portal.model.Team team : teams) {
8203 for (ModelListener<User> listener : listeners) {
8204 listener.onAfterRemoveAssociation(userId,
8205 com.liferay.portal.model.Team.class.getName(),
8206 team.getPrimaryKey());
8207 }
8208
8209 for (ModelListener<com.liferay.portal.model.Team> listener : teamListeners) {
8210 listener.onAfterRemoveAssociation(team.getPrimaryKey(),
8211 User.class.getName(), userId);
8212 }
8213 }
8214 }
8215 }
8216
8217 private SqlUpdate _sqlUpdate;
8218 }
8219
8220 protected class RemoveTeam {
8221 protected RemoveTeam(UserPersistenceImpl persistenceImpl) {
8222 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
8223 "DELETE FROM Users_Teams WHERE userId = ? AND teamId = ?",
8224 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
8225 _persistenceImpl = persistenceImpl;
8226 }
8227
8228 protected void remove(long userId, long teamId)
8229 throws SystemException {
8230 if (_persistenceImpl.containsTeam.contains(userId, teamId)) {
8231 ModelListener<com.liferay.portal.model.Team>[] teamListeners = teamPersistence.getListeners();
8232
8233 for (ModelListener<User> listener : listeners) {
8234 listener.onBeforeRemoveAssociation(userId,
8235 com.liferay.portal.model.Team.class.getName(), teamId);
8236 }
8237
8238 for (ModelListener<com.liferay.portal.model.Team> listener : teamListeners) {
8239 listener.onBeforeRemoveAssociation(teamId,
8240 User.class.getName(), userId);
8241 }
8242
8243 _sqlUpdate.update(new Object[] {
8244 new Long(userId), new Long(teamId)
8245 });
8246
8247 for (ModelListener<User> listener : listeners) {
8248 listener.onAfterRemoveAssociation(userId,
8249 com.liferay.portal.model.Team.class.getName(), teamId);
8250 }
8251
8252 for (ModelListener<com.liferay.portal.model.Team> listener : teamListeners) {
8253 listener.onAfterRemoveAssociation(teamId,
8254 User.class.getName(), userId);
8255 }
8256 }
8257 }
8258
8259 private SqlUpdate _sqlUpdate;
8260 private UserPersistenceImpl _persistenceImpl;
8261 }
8262
8263 protected class ContainsUserGroup {
8264 protected ContainsUserGroup(UserPersistenceImpl persistenceImpl) {
8265 super();
8266
8267 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
8268 _SQL_CONTAINSUSERGROUP,
8269 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
8270 RowMapper.COUNT);
8271 }
8272
8273 protected boolean contains(long userId, long userGroupId) {
8274 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
8275 new Long(userId), new Long(userGroupId)
8276 });
8277
8278 if (results.size() > 0) {
8279 Integer count = results.get(0);
8280
8281 if (count.intValue() > 0) {
8282 return true;
8283 }
8284 }
8285
8286 return false;
8287 }
8288
8289 private MappingSqlQuery<Integer> _mappingSqlQuery;
8290 }
8291
8292 protected class AddUserGroup {
8293 protected AddUserGroup(UserPersistenceImpl persistenceImpl) {
8294 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
8295 "INSERT INTO Users_UserGroups (userId, userGroupId) VALUES (?, ?)",
8296 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
8297 _persistenceImpl = persistenceImpl;
8298 }
8299
8300 protected void add(long userId, long userGroupId)
8301 throws SystemException {
8302 if (!_persistenceImpl.containsUserGroup.contains(userId, userGroupId)) {
8303 ModelListener<com.liferay.portal.model.UserGroup>[] userGroupListeners =
8304 userGroupPersistence.getListeners();
8305
8306 for (ModelListener<User> listener : listeners) {
8307 listener.onBeforeAddAssociation(userId,
8308 com.liferay.portal.model.UserGroup.class.getName(),
8309 userGroupId);
8310 }
8311
8312 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
8313 listener.onBeforeAddAssociation(userGroupId,
8314 User.class.getName(), userId);
8315 }
8316
8317 _sqlUpdate.update(new Object[] {
8318 new Long(userId), new Long(userGroupId)
8319 });
8320
8321 for (ModelListener<User> listener : listeners) {
8322 listener.onAfterAddAssociation(userId,
8323 com.liferay.portal.model.UserGroup.class.getName(),
8324 userGroupId);
8325 }
8326
8327 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
8328 listener.onAfterAddAssociation(userGroupId,
8329 User.class.getName(), userId);
8330 }
8331 }
8332 }
8333
8334 private SqlUpdate _sqlUpdate;
8335 private UserPersistenceImpl _persistenceImpl;
8336 }
8337
8338 protected class ClearUserGroups {
8339 protected ClearUserGroups(UserPersistenceImpl persistenceImpl) {
8340 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
8341 "DELETE FROM Users_UserGroups WHERE userId = ?",
8342 new int[] { java.sql.Types.BIGINT });
8343 }
8344
8345 protected void clear(long userId) throws SystemException {
8346 ModelListener<com.liferay.portal.model.UserGroup>[] userGroupListeners =
8347 userGroupPersistence.getListeners();
8348
8349 List<com.liferay.portal.model.UserGroup> userGroups = null;
8350
8351 if ((listeners.length > 0) || (userGroupListeners.length > 0)) {
8352 userGroups = getUserGroups(userId);
8353
8354 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
8355 for (ModelListener<User> listener : listeners) {
8356 listener.onBeforeRemoveAssociation(userId,
8357 com.liferay.portal.model.UserGroup.class.getName(),
8358 userGroup.getPrimaryKey());
8359 }
8360
8361 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
8362 listener.onBeforeRemoveAssociation(userGroup.getPrimaryKey(),
8363 User.class.getName(), userId);
8364 }
8365 }
8366 }
8367
8368 _sqlUpdate.update(new Object[] { new Long(userId) });
8369
8370 if ((listeners.length > 0) || (userGroupListeners.length > 0)) {
8371 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
8372 for (ModelListener<User> listener : listeners) {
8373 listener.onAfterRemoveAssociation(userId,
8374 com.liferay.portal.model.UserGroup.class.getName(),
8375 userGroup.getPrimaryKey());
8376 }
8377
8378 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
8379 listener.onAfterRemoveAssociation(userGroup.getPrimaryKey(),
8380 User.class.getName(), userId);
8381 }
8382 }
8383 }
8384 }
8385
8386 private SqlUpdate _sqlUpdate;
8387 }
8388
8389 protected class RemoveUserGroup {
8390 protected RemoveUserGroup(UserPersistenceImpl persistenceImpl) {
8391 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
8392 "DELETE FROM Users_UserGroups WHERE userId = ? AND userGroupId = ?",
8393 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
8394 _persistenceImpl = persistenceImpl;
8395 }
8396
8397 protected void remove(long userId, long userGroupId)
8398 throws SystemException {
8399 if (_persistenceImpl.containsUserGroup.contains(userId, userGroupId)) {
8400 ModelListener<com.liferay.portal.model.UserGroup>[] userGroupListeners =
8401 userGroupPersistence.getListeners();
8402
8403 for (ModelListener<User> listener : listeners) {
8404 listener.onBeforeRemoveAssociation(userId,
8405 com.liferay.portal.model.UserGroup.class.getName(),
8406 userGroupId);
8407 }
8408
8409 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
8410 listener.onBeforeRemoveAssociation(userGroupId,
8411 User.class.getName(), userId);
8412 }
8413
8414 _sqlUpdate.update(new Object[] {
8415 new Long(userId), new Long(userGroupId)
8416 });
8417
8418 for (ModelListener<User> listener : listeners) {
8419 listener.onAfterRemoveAssociation(userId,
8420 com.liferay.portal.model.UserGroup.class.getName(),
8421 userGroupId);
8422 }
8423
8424 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
8425 listener.onAfterRemoveAssociation(userGroupId,
8426 User.class.getName(), userId);
8427 }
8428 }
8429 }
8430
8431 private SqlUpdate _sqlUpdate;
8432 private UserPersistenceImpl _persistenceImpl;
8433 }
8434
8435 private static final String _SQL_SELECT_USER = "SELECT user FROM User user";
8436 private static final String _SQL_SELECT_USER_WHERE = "SELECT user FROM User user WHERE ";
8437 private static final String _SQL_COUNT_USER = "SELECT COUNT(user) FROM User user";
8438 private static final String _SQL_COUNT_USER_WHERE = "SELECT COUNT(user) FROM User user WHERE ";
8439 private static final String _SQL_GETGROUPS = "SELECT {Group_.*} FROM Group_ INNER JOIN Users_Groups ON (Users_Groups.groupId = Group_.groupId) WHERE (Users_Groups.userId = ?)";
8440 private static final String _SQL_GETGROUPSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Groups WHERE userId = ?";
8441 private static final String _SQL_CONTAINSGROUP = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Groups WHERE userId = ? AND groupId = ?";
8442 private static final String _SQL_GETORGANIZATIONS = "SELECT {Organization_.*} FROM Organization_ INNER JOIN Users_Orgs ON (Users_Orgs.organizationId = Organization_.organizationId) WHERE (Users_Orgs.userId = ?)";
8443 private static final String _SQL_GETORGANIZATIONSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Orgs WHERE userId = ?";
8444 private static final String _SQL_CONTAINSORGANIZATION = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Orgs WHERE userId = ? AND organizationId = ?";
8445 private static final String _SQL_GETPERMISSIONS = "SELECT {Permission_.*} FROM Permission_ INNER JOIN Users_Permissions ON (Users_Permissions.permissionId = Permission_.permissionId) WHERE (Users_Permissions.userId = ?)";
8446 private static final String _SQL_GETPERMISSIONSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Permissions WHERE userId = ?";
8447 private static final String _SQL_CONTAINSPERMISSION = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Permissions WHERE userId = ? AND permissionId = ?";
8448 private static final String _SQL_GETROLES = "SELECT {Role_.*} FROM Role_ INNER JOIN Users_Roles ON (Users_Roles.roleId = Role_.roleId) WHERE (Users_Roles.userId = ?)";
8449 private static final String _SQL_GETROLESSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Roles WHERE userId = ?";
8450 private static final String _SQL_CONTAINSROLE = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Roles WHERE userId = ? AND roleId = ?";
8451 private static final String _SQL_GETTEAMS = "SELECT {Team.*} FROM Team INNER JOIN Users_Teams ON (Users_Teams.teamId = Team.teamId) WHERE (Users_Teams.userId = ?)";
8452 private static final String _SQL_GETTEAMSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Teams WHERE userId = ?";
8453 private static final String _SQL_CONTAINSTEAM = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Teams WHERE userId = ? AND teamId = ?";
8454 private static final String _SQL_GETUSERGROUPS = "SELECT {UserGroup.*} FROM UserGroup INNER JOIN Users_UserGroups ON (Users_UserGroups.userGroupId = UserGroup.userGroupId) WHERE (Users_UserGroups.userId = ?)";
8455 private static final String _SQL_GETUSERGROUPSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_UserGroups WHERE userId = ?";
8456 private static final String _SQL_CONTAINSUSERGROUP = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_UserGroups WHERE userId = ? AND userGroupId = ?";
8457 private static final String _FINDER_COLUMN_UUID_UUID_1 = "user.uuid IS NULL";
8458 private static final String _FINDER_COLUMN_UUID_UUID_2 = "user.uuid = ?";
8459 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(user.uuid IS NULL OR user.uuid = ?)";
8460 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "user.companyId = ?";
8461 private static final String _FINDER_COLUMN_CONTACTID_CONTACTID_2 = "user.contactId = ?";
8462 private static final String _FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_1 = "user.emailAddress IS NULL";
8463 private static final String _FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_2 = "user.emailAddress = ?";
8464 private static final String _FINDER_COLUMN_EMAILADDRESS_EMAILADDRESS_3 = "(user.emailAddress IS NULL OR user.emailAddress = ?)";
8465 private static final String _FINDER_COLUMN_PORTRAITID_PORTRAITID_2 = "user.portraitId = ?";
8466 private static final String _FINDER_COLUMN_C_U_COMPANYID_2 = "user.companyId = ? AND ";
8467 private static final String _FINDER_COLUMN_C_U_USERID_2 = "user.userId = ?";
8468 private static final String _FINDER_COLUMN_C_DU_COMPANYID_2 = "user.companyId = ? AND ";
8469 private static final String _FINDER_COLUMN_C_DU_DEFAULTUSER_2 = "user.defaultUser = ?";
8470 private static final String _FINDER_COLUMN_C_SN_COMPANYID_2 = "user.companyId = ? AND ";
8471 private static final String _FINDER_COLUMN_C_SN_SCREENNAME_1 = "user.screenName IS NULL";
8472 private static final String _FINDER_COLUMN_C_SN_SCREENNAME_2 = "user.screenName = ?";
8473 private static final String _FINDER_COLUMN_C_SN_SCREENNAME_3 = "(user.screenName IS NULL OR user.screenName = ?)";
8474 private static final String _FINDER_COLUMN_C_EA_COMPANYID_2 = "user.companyId = ? AND ";
8475 private static final String _FINDER_COLUMN_C_EA_EMAILADDRESS_1 = "user.emailAddress IS NULL";
8476 private static final String _FINDER_COLUMN_C_EA_EMAILADDRESS_2 = "user.emailAddress = ?";
8477 private static final String _FINDER_COLUMN_C_EA_EMAILADDRESS_3 = "(user.emailAddress IS NULL OR user.emailAddress = ?)";
8478 private static final String _FINDER_COLUMN_C_FID_COMPANYID_2 = "user.companyId = ? AND ";
8479 private static final String _FINDER_COLUMN_C_FID_FACEBOOKID_2 = "user.facebookId = ?";
8480 private static final String _FINDER_COLUMN_C_O_COMPANYID_2 = "user.companyId = ? AND ";
8481 private static final String _FINDER_COLUMN_C_O_OPENID_1 = "user.openId IS NULL";
8482 private static final String _FINDER_COLUMN_C_O_OPENID_2 = "user.openId = ?";
8483 private static final String _FINDER_COLUMN_C_O_OPENID_3 = "(user.openId IS NULL OR user.openId = ?)";
8484 private static final String _FINDER_COLUMN_C_A_COMPANYID_2 = "user.companyId = ? AND ";
8485 private static final String _FINDER_COLUMN_C_A_ACTIVE_2 = "user.active = ?";
8486 private static final String _ORDER_BY_ENTITY_ALIAS = "user.";
8487 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No User exists with the primary key ";
8488 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No User exists with the key {";
8489 private static Log _log = LogFactoryUtil.getLog(UserPersistenceImpl.class);
8490 }