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