001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.NoSuchTeamException;
019 import com.liferay.portal.kernel.bean.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.model.CacheModel;
046 import com.liferay.portal.model.ModelListener;
047 import com.liferay.portal.model.Team;
048 import com.liferay.portal.model.impl.TeamImpl;
049 import com.liferay.portal.model.impl.TeamModelImpl;
050 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
051 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
052
053 import java.io.Serializable;
054
055 import java.util.ArrayList;
056 import java.util.Collections;
057 import java.util.List;
058 import java.util.Set;
059
060
072 public class TeamPersistenceImpl extends BasePersistenceImpl<Team>
073 implements TeamPersistence {
074
079 public static final String FINDER_CLASS_NAME_ENTITY = TeamImpl.class.getName();
080 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
081 ".List1";
082 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
083 ".List2";
084 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(TeamModelImpl.ENTITY_CACHE_ENABLED,
085 TeamModelImpl.FINDER_CACHE_ENABLED, TeamImpl.class,
086 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByGroupId",
087 new String[] {
088 Long.class.getName(),
089
090 "java.lang.Integer", "java.lang.Integer",
091 "com.liferay.portal.kernel.util.OrderByComparator"
092 });
093 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
094 new FinderPath(TeamModelImpl.ENTITY_CACHE_ENABLED,
095 TeamModelImpl.FINDER_CACHE_ENABLED, TeamImpl.class,
096 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
097 new String[] { Long.class.getName() },
098 TeamModelImpl.GROUPID_COLUMN_BITMASK);
099 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(TeamModelImpl.ENTITY_CACHE_ENABLED,
100 TeamModelImpl.FINDER_CACHE_ENABLED, Long.class,
101 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId",
102 new String[] { Long.class.getName() });
103 public static final FinderPath FINDER_PATH_FETCH_BY_G_N = new FinderPath(TeamModelImpl.ENTITY_CACHE_ENABLED,
104 TeamModelImpl.FINDER_CACHE_ENABLED, TeamImpl.class,
105 FINDER_CLASS_NAME_ENTITY, "fetchByG_N",
106 new String[] { Long.class.getName(), String.class.getName() },
107 TeamModelImpl.GROUPID_COLUMN_BITMASK |
108 TeamModelImpl.NAME_COLUMN_BITMASK);
109 public static final FinderPath FINDER_PATH_COUNT_BY_G_N = new FinderPath(TeamModelImpl.ENTITY_CACHE_ENABLED,
110 TeamModelImpl.FINDER_CACHE_ENABLED, Long.class,
111 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_N",
112 new String[] { Long.class.getName(), String.class.getName() });
113 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(TeamModelImpl.ENTITY_CACHE_ENABLED,
114 TeamModelImpl.FINDER_CACHE_ENABLED, TeamImpl.class,
115 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
116 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(TeamModelImpl.ENTITY_CACHE_ENABLED,
117 TeamModelImpl.FINDER_CACHE_ENABLED, TeamImpl.class,
118 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
119 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(TeamModelImpl.ENTITY_CACHE_ENABLED,
120 TeamModelImpl.FINDER_CACHE_ENABLED, Long.class,
121 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
122
123
128 public void cacheResult(Team team) {
129 EntityCacheUtil.putResult(TeamModelImpl.ENTITY_CACHE_ENABLED,
130 TeamImpl.class, team.getPrimaryKey(), team);
131
132 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
133 new Object[] { Long.valueOf(team.getGroupId()), team.getName() },
134 team);
135
136 team.resetOriginalValues();
137 }
138
139
144 public void cacheResult(List<Team> teams) {
145 for (Team team : teams) {
146 if (EntityCacheUtil.getResult(TeamModelImpl.ENTITY_CACHE_ENABLED,
147 TeamImpl.class, team.getPrimaryKey()) == null) {
148 cacheResult(team);
149 }
150 else {
151 team.resetOriginalValues();
152 }
153 }
154 }
155
156
163 @Override
164 public void clearCache() {
165 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
166 CacheRegistryUtil.clear(TeamImpl.class.getName());
167 }
168
169 EntityCacheUtil.clearCache(TeamImpl.class.getName());
170
171 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
172 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
173 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
174 }
175
176
183 @Override
184 public void clearCache(Team team) {
185 EntityCacheUtil.removeResult(TeamModelImpl.ENTITY_CACHE_ENABLED,
186 TeamImpl.class, team.getPrimaryKey());
187
188 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
189 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
190
191 clearUniqueFindersCache(team);
192 }
193
194 @Override
195 public void clearCache(List<Team> teams) {
196 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
197 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
198
199 for (Team team : teams) {
200 EntityCacheUtil.removeResult(TeamModelImpl.ENTITY_CACHE_ENABLED,
201 TeamImpl.class, team.getPrimaryKey());
202
203 clearUniqueFindersCache(team);
204 }
205 }
206
207 protected void cacheUniqueFindersCache(Team team) {
208 if (team.isNew()) {
209 Object[] args = new Object[] {
210 Long.valueOf(team.getGroupId()),
211
212 team.getName()
213 };
214
215 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_N, args,
216 Long.valueOf(1));
217 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N, args, team);
218 }
219 else {
220 TeamModelImpl teamModelImpl = (TeamModelImpl)team;
221
222 if ((teamModelImpl.getColumnBitmask() &
223 FINDER_PATH_FETCH_BY_G_N.getColumnBitmask()) != 0) {
224 Object[] args = new Object[] {
225 Long.valueOf(team.getGroupId()),
226
227 team.getName()
228 };
229
230 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_N, args,
231 Long.valueOf(1));
232 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N, args, team);
233 }
234 }
235 }
236
237 protected void clearUniqueFindersCache(Team team) {
238 TeamModelImpl teamModelImpl = (TeamModelImpl)team;
239
240 Object[] args = new Object[] {
241 Long.valueOf(team.getGroupId()),
242
243 team.getName()
244 };
245
246 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_N, args);
247 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N, args);
248
249 if ((teamModelImpl.getColumnBitmask() &
250 FINDER_PATH_FETCH_BY_G_N.getColumnBitmask()) != 0) {
251 args = new Object[] {
252 Long.valueOf(teamModelImpl.getOriginalGroupId()),
253
254 teamModelImpl.getOriginalName()
255 };
256
257 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_N, args);
258 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N, args);
259 }
260 }
261
262
268 public Team create(long teamId) {
269 Team team = new TeamImpl();
270
271 team.setNew(true);
272 team.setPrimaryKey(teamId);
273
274 return team;
275 }
276
277
285 public Team remove(long teamId) throws NoSuchTeamException, SystemException {
286 return remove(Long.valueOf(teamId));
287 }
288
289
297 @Override
298 public Team remove(Serializable primaryKey)
299 throws NoSuchTeamException, SystemException {
300 Session session = null;
301
302 try {
303 session = openSession();
304
305 Team team = (Team)session.get(TeamImpl.class, primaryKey);
306
307 if (team == null) {
308 if (_log.isWarnEnabled()) {
309 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
310 }
311
312 throw new NoSuchTeamException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
313 primaryKey);
314 }
315
316 return remove(team);
317 }
318 catch (NoSuchTeamException nsee) {
319 throw nsee;
320 }
321 catch (Exception e) {
322 throw processException(e);
323 }
324 finally {
325 closeSession(session);
326 }
327 }
328
329 @Override
330 protected Team removeImpl(Team team) throws SystemException {
331 team = toUnwrappedModel(team);
332
333 try {
334 clearUsers.clear(team.getPrimaryKey());
335 }
336 catch (Exception e) {
337 throw processException(e);
338 }
339 finally {
340 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
341 }
342
343 try {
344 clearUserGroups.clear(team.getPrimaryKey());
345 }
346 catch (Exception e) {
347 throw processException(e);
348 }
349 finally {
350 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERGROUPS_TEAMS_NAME);
351 }
352
353 Session session = null;
354
355 try {
356 session = openSession();
357
358 BatchSessionUtil.delete(session, team);
359 }
360 catch (Exception e) {
361 throw processException(e);
362 }
363 finally {
364 closeSession(session);
365 }
366
367 clearCache(team);
368
369 return team;
370 }
371
372 @Override
373 public Team updateImpl(com.liferay.portal.model.Team team, boolean merge)
374 throws SystemException {
375 team = toUnwrappedModel(team);
376
377 boolean isNew = team.isNew();
378
379 TeamModelImpl teamModelImpl = (TeamModelImpl)team;
380
381 Session session = null;
382
383 try {
384 session = openSession();
385
386 BatchSessionUtil.update(session, team, merge);
387
388 team.setNew(false);
389 }
390 catch (Exception e) {
391 throw processException(e);
392 }
393 finally {
394 closeSession(session);
395 }
396
397 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
398
399 if (isNew || !TeamModelImpl.COLUMN_BITMASK_ENABLED) {
400 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
401 }
402
403 else {
404 if ((teamModelImpl.getColumnBitmask() &
405 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
406 Object[] args = new Object[] {
407 Long.valueOf(teamModelImpl.getOriginalGroupId())
408 };
409
410 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
411 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
412 args);
413
414 args = new Object[] { Long.valueOf(teamModelImpl.getGroupId()) };
415
416 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
417 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
418 args);
419 }
420 }
421
422 EntityCacheUtil.putResult(TeamModelImpl.ENTITY_CACHE_ENABLED,
423 TeamImpl.class, team.getPrimaryKey(), team);
424
425 clearUniqueFindersCache(team);
426 cacheUniqueFindersCache(team);
427
428 return team;
429 }
430
431 protected Team toUnwrappedModel(Team team) {
432 if (team instanceof TeamImpl) {
433 return team;
434 }
435
436 TeamImpl teamImpl = new TeamImpl();
437
438 teamImpl.setNew(team.isNew());
439 teamImpl.setPrimaryKey(team.getPrimaryKey());
440
441 teamImpl.setTeamId(team.getTeamId());
442 teamImpl.setCompanyId(team.getCompanyId());
443 teamImpl.setUserId(team.getUserId());
444 teamImpl.setUserName(team.getUserName());
445 teamImpl.setCreateDate(team.getCreateDate());
446 teamImpl.setModifiedDate(team.getModifiedDate());
447 teamImpl.setGroupId(team.getGroupId());
448 teamImpl.setName(team.getName());
449 teamImpl.setDescription(team.getDescription());
450
451 return teamImpl;
452 }
453
454
462 @Override
463 public Team findByPrimaryKey(Serializable primaryKey)
464 throws NoSuchModelException, SystemException {
465 return findByPrimaryKey(((Long)primaryKey).longValue());
466 }
467
468
476 public Team findByPrimaryKey(long teamId)
477 throws NoSuchTeamException, SystemException {
478 Team team = fetchByPrimaryKey(teamId);
479
480 if (team == null) {
481 if (_log.isWarnEnabled()) {
482 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + teamId);
483 }
484
485 throw new NoSuchTeamException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
486 teamId);
487 }
488
489 return team;
490 }
491
492
499 @Override
500 public Team fetchByPrimaryKey(Serializable primaryKey)
501 throws SystemException {
502 return fetchByPrimaryKey(((Long)primaryKey).longValue());
503 }
504
505
512 public Team fetchByPrimaryKey(long teamId) throws SystemException {
513 Team team = (Team)EntityCacheUtil.getResult(TeamModelImpl.ENTITY_CACHE_ENABLED,
514 TeamImpl.class, teamId);
515
516 if (team == _nullTeam) {
517 return null;
518 }
519
520 if (team == null) {
521 Session session = null;
522
523 boolean hasException = false;
524
525 try {
526 session = openSession();
527
528 team = (Team)session.get(TeamImpl.class, Long.valueOf(teamId));
529 }
530 catch (Exception e) {
531 hasException = true;
532
533 throw processException(e);
534 }
535 finally {
536 if (team != null) {
537 cacheResult(team);
538 }
539 else if (!hasException) {
540 EntityCacheUtil.putResult(TeamModelImpl.ENTITY_CACHE_ENABLED,
541 TeamImpl.class, teamId, _nullTeam);
542 }
543
544 closeSession(session);
545 }
546 }
547
548 return team;
549 }
550
551
558 public List<Team> findByGroupId(long groupId) throws SystemException {
559 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
560 }
561
562
575 public List<Team> findByGroupId(long groupId, int start, int end)
576 throws SystemException {
577 return findByGroupId(groupId, start, end, null);
578 }
579
580
594 public List<Team> findByGroupId(long groupId, int start, int end,
595 OrderByComparator orderByComparator) throws SystemException {
596 FinderPath finderPath = null;
597 Object[] finderArgs = null;
598
599 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
600 (orderByComparator == null)) {
601 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
602 finderArgs = new Object[] { groupId };
603 }
604 else {
605 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
606 finderArgs = new Object[] { groupId, start, end, orderByComparator };
607 }
608
609 List<Team> list = (List<Team>)FinderCacheUtil.getResult(finderPath,
610 finderArgs, this);
611
612 if ((list != null) && !list.isEmpty()) {
613 for (Team team : list) {
614 if ((groupId != team.getGroupId())) {
615 list = null;
616
617 break;
618 }
619 }
620 }
621
622 if (list == null) {
623 StringBundler query = null;
624
625 if (orderByComparator != null) {
626 query = new StringBundler(3 +
627 (orderByComparator.getOrderByFields().length * 3));
628 }
629 else {
630 query = new StringBundler(3);
631 }
632
633 query.append(_SQL_SELECT_TEAM_WHERE);
634
635 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
636
637 if (orderByComparator != null) {
638 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
639 orderByComparator);
640 }
641
642 else {
643 query.append(TeamModelImpl.ORDER_BY_JPQL);
644 }
645
646 String sql = query.toString();
647
648 Session session = null;
649
650 try {
651 session = openSession();
652
653 Query q = session.createQuery(sql);
654
655 QueryPos qPos = QueryPos.getInstance(q);
656
657 qPos.add(groupId);
658
659 list = (List<Team>)QueryUtil.list(q, getDialect(), start, end);
660 }
661 catch (Exception e) {
662 throw processException(e);
663 }
664 finally {
665 if (list == null) {
666 FinderCacheUtil.removeResult(finderPath, finderArgs);
667 }
668 else {
669 cacheResult(list);
670
671 FinderCacheUtil.putResult(finderPath, finderArgs, list);
672 }
673
674 closeSession(session);
675 }
676 }
677
678 return list;
679 }
680
681
690 public Team findByGroupId_First(long groupId,
691 OrderByComparator orderByComparator)
692 throws NoSuchTeamException, SystemException {
693 Team team = fetchByGroupId_First(groupId, orderByComparator);
694
695 if (team != null) {
696 return team;
697 }
698
699 StringBundler msg = new StringBundler(4);
700
701 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
702
703 msg.append("groupId=");
704 msg.append(groupId);
705
706 msg.append(StringPool.CLOSE_CURLY_BRACE);
707
708 throw new NoSuchTeamException(msg.toString());
709 }
710
711
719 public Team fetchByGroupId_First(long groupId,
720 OrderByComparator orderByComparator) throws SystemException {
721 List<Team> list = findByGroupId(groupId, 0, 1, orderByComparator);
722
723 if (!list.isEmpty()) {
724 return list.get(0);
725 }
726
727 return null;
728 }
729
730
739 public Team findByGroupId_Last(long groupId,
740 OrderByComparator orderByComparator)
741 throws NoSuchTeamException, SystemException {
742 Team team = fetchByGroupId_Last(groupId, orderByComparator);
743
744 if (team != null) {
745 return team;
746 }
747
748 StringBundler msg = new StringBundler(4);
749
750 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
751
752 msg.append("groupId=");
753 msg.append(groupId);
754
755 msg.append(StringPool.CLOSE_CURLY_BRACE);
756
757 throw new NoSuchTeamException(msg.toString());
758 }
759
760
768 public Team fetchByGroupId_Last(long groupId,
769 OrderByComparator orderByComparator) throws SystemException {
770 int count = countByGroupId(groupId);
771
772 List<Team> list = findByGroupId(groupId, count - 1, count,
773 orderByComparator);
774
775 if (!list.isEmpty()) {
776 return list.get(0);
777 }
778
779 return null;
780 }
781
782
792 public Team[] findByGroupId_PrevAndNext(long teamId, long groupId,
793 OrderByComparator orderByComparator)
794 throws NoSuchTeamException, SystemException {
795 Team team = findByPrimaryKey(teamId);
796
797 Session session = null;
798
799 try {
800 session = openSession();
801
802 Team[] array = new TeamImpl[3];
803
804 array[0] = getByGroupId_PrevAndNext(session, team, groupId,
805 orderByComparator, true);
806
807 array[1] = team;
808
809 array[2] = getByGroupId_PrevAndNext(session, team, groupId,
810 orderByComparator, false);
811
812 return array;
813 }
814 catch (Exception e) {
815 throw processException(e);
816 }
817 finally {
818 closeSession(session);
819 }
820 }
821
822 protected Team getByGroupId_PrevAndNext(Session session, Team team,
823 long groupId, OrderByComparator orderByComparator, boolean previous) {
824 StringBundler query = null;
825
826 if (orderByComparator != null) {
827 query = new StringBundler(6 +
828 (orderByComparator.getOrderByFields().length * 6));
829 }
830 else {
831 query = new StringBundler(3);
832 }
833
834 query.append(_SQL_SELECT_TEAM_WHERE);
835
836 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
837
838 if (orderByComparator != null) {
839 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
840
841 if (orderByConditionFields.length > 0) {
842 query.append(WHERE_AND);
843 }
844
845 for (int i = 0; i < orderByConditionFields.length; i++) {
846 query.append(_ORDER_BY_ENTITY_ALIAS);
847 query.append(orderByConditionFields[i]);
848
849 if ((i + 1) < orderByConditionFields.length) {
850 if (orderByComparator.isAscending() ^ previous) {
851 query.append(WHERE_GREATER_THAN_HAS_NEXT);
852 }
853 else {
854 query.append(WHERE_LESSER_THAN_HAS_NEXT);
855 }
856 }
857 else {
858 if (orderByComparator.isAscending() ^ previous) {
859 query.append(WHERE_GREATER_THAN);
860 }
861 else {
862 query.append(WHERE_LESSER_THAN);
863 }
864 }
865 }
866
867 query.append(ORDER_BY_CLAUSE);
868
869 String[] orderByFields = orderByComparator.getOrderByFields();
870
871 for (int i = 0; i < orderByFields.length; i++) {
872 query.append(_ORDER_BY_ENTITY_ALIAS);
873 query.append(orderByFields[i]);
874
875 if ((i + 1) < orderByFields.length) {
876 if (orderByComparator.isAscending() ^ previous) {
877 query.append(ORDER_BY_ASC_HAS_NEXT);
878 }
879 else {
880 query.append(ORDER_BY_DESC_HAS_NEXT);
881 }
882 }
883 else {
884 if (orderByComparator.isAscending() ^ previous) {
885 query.append(ORDER_BY_ASC);
886 }
887 else {
888 query.append(ORDER_BY_DESC);
889 }
890 }
891 }
892 }
893
894 else {
895 query.append(TeamModelImpl.ORDER_BY_JPQL);
896 }
897
898 String sql = query.toString();
899
900 Query q = session.createQuery(sql);
901
902 q.setFirstResult(0);
903 q.setMaxResults(2);
904
905 QueryPos qPos = QueryPos.getInstance(q);
906
907 qPos.add(groupId);
908
909 if (orderByComparator != null) {
910 Object[] values = orderByComparator.getOrderByConditionValues(team);
911
912 for (Object value : values) {
913 qPos.add(value);
914 }
915 }
916
917 List<Team> list = q.list();
918
919 if (list.size() == 2) {
920 return list.get(1);
921 }
922 else {
923 return null;
924 }
925 }
926
927
934 public List<Team> filterFindByGroupId(long groupId)
935 throws SystemException {
936 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
937 QueryUtil.ALL_POS, null);
938 }
939
940
953 public List<Team> filterFindByGroupId(long groupId, int start, int end)
954 throws SystemException {
955 return filterFindByGroupId(groupId, start, end, null);
956 }
957
958
972 public List<Team> filterFindByGroupId(long groupId, int start, int end,
973 OrderByComparator orderByComparator) throws SystemException {
974 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
975 return findByGroupId(groupId, start, end, orderByComparator);
976 }
977
978 StringBundler query = null;
979
980 if (orderByComparator != null) {
981 query = new StringBundler(3 +
982 (orderByComparator.getOrderByFields().length * 3));
983 }
984 else {
985 query = new StringBundler(3);
986 }
987
988 if (getDB().isSupportsInlineDistinct()) {
989 query.append(_FILTER_SQL_SELECT_TEAM_WHERE);
990 }
991 else {
992 query.append(_FILTER_SQL_SELECT_TEAM_NO_INLINE_DISTINCT_WHERE_1);
993 }
994
995 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
996
997 if (!getDB().isSupportsInlineDistinct()) {
998 query.append(_FILTER_SQL_SELECT_TEAM_NO_INLINE_DISTINCT_WHERE_2);
999 }
1000
1001 if (orderByComparator != null) {
1002 if (getDB().isSupportsInlineDistinct()) {
1003 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1004 orderByComparator);
1005 }
1006 else {
1007 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1008 orderByComparator);
1009 }
1010 }
1011
1012 else {
1013 if (getDB().isSupportsInlineDistinct()) {
1014 query.append(TeamModelImpl.ORDER_BY_JPQL);
1015 }
1016 else {
1017 query.append(TeamModelImpl.ORDER_BY_SQL);
1018 }
1019 }
1020
1021 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1022 Team.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN,
1023 groupId);
1024
1025 Session session = null;
1026
1027 try {
1028 session = openSession();
1029
1030 SQLQuery q = session.createSQLQuery(sql);
1031
1032 if (getDB().isSupportsInlineDistinct()) {
1033 q.addEntity(_FILTER_ENTITY_ALIAS, TeamImpl.class);
1034 }
1035 else {
1036 q.addEntity(_FILTER_ENTITY_TABLE, TeamImpl.class);
1037 }
1038
1039 QueryPos qPos = QueryPos.getInstance(q);
1040
1041 qPos.add(groupId);
1042
1043 return (List<Team>)QueryUtil.list(q, getDialect(), start, end);
1044 }
1045 catch (Exception e) {
1046 throw processException(e);
1047 }
1048 finally {
1049 closeSession(session);
1050 }
1051 }
1052
1053
1063 public Team[] filterFindByGroupId_PrevAndNext(long teamId, long groupId,
1064 OrderByComparator orderByComparator)
1065 throws NoSuchTeamException, SystemException {
1066 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1067 return findByGroupId_PrevAndNext(teamId, groupId, orderByComparator);
1068 }
1069
1070 Team team = findByPrimaryKey(teamId);
1071
1072 Session session = null;
1073
1074 try {
1075 session = openSession();
1076
1077 Team[] array = new TeamImpl[3];
1078
1079 array[0] = filterGetByGroupId_PrevAndNext(session, team, groupId,
1080 orderByComparator, true);
1081
1082 array[1] = team;
1083
1084 array[2] = filterGetByGroupId_PrevAndNext(session, team, groupId,
1085 orderByComparator, false);
1086
1087 return array;
1088 }
1089 catch (Exception e) {
1090 throw processException(e);
1091 }
1092 finally {
1093 closeSession(session);
1094 }
1095 }
1096
1097 protected Team filterGetByGroupId_PrevAndNext(Session session, Team team,
1098 long groupId, OrderByComparator orderByComparator, boolean previous) {
1099 StringBundler query = null;
1100
1101 if (orderByComparator != null) {
1102 query = new StringBundler(6 +
1103 (orderByComparator.getOrderByFields().length * 6));
1104 }
1105 else {
1106 query = new StringBundler(3);
1107 }
1108
1109 if (getDB().isSupportsInlineDistinct()) {
1110 query.append(_FILTER_SQL_SELECT_TEAM_WHERE);
1111 }
1112 else {
1113 query.append(_FILTER_SQL_SELECT_TEAM_NO_INLINE_DISTINCT_WHERE_1);
1114 }
1115
1116 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1117
1118 if (!getDB().isSupportsInlineDistinct()) {
1119 query.append(_FILTER_SQL_SELECT_TEAM_NO_INLINE_DISTINCT_WHERE_2);
1120 }
1121
1122 if (orderByComparator != null) {
1123 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1124
1125 if (orderByConditionFields.length > 0) {
1126 query.append(WHERE_AND);
1127 }
1128
1129 for (int i = 0; i < orderByConditionFields.length; i++) {
1130 if (getDB().isSupportsInlineDistinct()) {
1131 query.append(_ORDER_BY_ENTITY_ALIAS);
1132 }
1133 else {
1134 query.append(_ORDER_BY_ENTITY_TABLE);
1135 }
1136
1137 query.append(orderByConditionFields[i]);
1138
1139 if ((i + 1) < orderByConditionFields.length) {
1140 if (orderByComparator.isAscending() ^ previous) {
1141 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1142 }
1143 else {
1144 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1145 }
1146 }
1147 else {
1148 if (orderByComparator.isAscending() ^ previous) {
1149 query.append(WHERE_GREATER_THAN);
1150 }
1151 else {
1152 query.append(WHERE_LESSER_THAN);
1153 }
1154 }
1155 }
1156
1157 query.append(ORDER_BY_CLAUSE);
1158
1159 String[] orderByFields = orderByComparator.getOrderByFields();
1160
1161 for (int i = 0; i < orderByFields.length; i++) {
1162 if (getDB().isSupportsInlineDistinct()) {
1163 query.append(_ORDER_BY_ENTITY_ALIAS);
1164 }
1165 else {
1166 query.append(_ORDER_BY_ENTITY_TABLE);
1167 }
1168
1169 query.append(orderByFields[i]);
1170
1171 if ((i + 1) < orderByFields.length) {
1172 if (orderByComparator.isAscending() ^ previous) {
1173 query.append(ORDER_BY_ASC_HAS_NEXT);
1174 }
1175 else {
1176 query.append(ORDER_BY_DESC_HAS_NEXT);
1177 }
1178 }
1179 else {
1180 if (orderByComparator.isAscending() ^ previous) {
1181 query.append(ORDER_BY_ASC);
1182 }
1183 else {
1184 query.append(ORDER_BY_DESC);
1185 }
1186 }
1187 }
1188 }
1189
1190 else {
1191 if (getDB().isSupportsInlineDistinct()) {
1192 query.append(TeamModelImpl.ORDER_BY_JPQL);
1193 }
1194 else {
1195 query.append(TeamModelImpl.ORDER_BY_SQL);
1196 }
1197 }
1198
1199 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1200 Team.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN,
1201 groupId);
1202
1203 SQLQuery q = session.createSQLQuery(sql);
1204
1205 q.setFirstResult(0);
1206 q.setMaxResults(2);
1207
1208 if (getDB().isSupportsInlineDistinct()) {
1209 q.addEntity(_FILTER_ENTITY_ALIAS, TeamImpl.class);
1210 }
1211 else {
1212 q.addEntity(_FILTER_ENTITY_TABLE, TeamImpl.class);
1213 }
1214
1215 QueryPos qPos = QueryPos.getInstance(q);
1216
1217 qPos.add(groupId);
1218
1219 if (orderByComparator != null) {
1220 Object[] values = orderByComparator.getOrderByConditionValues(team);
1221
1222 for (Object value : values) {
1223 qPos.add(value);
1224 }
1225 }
1226
1227 List<Team> list = q.list();
1228
1229 if (list.size() == 2) {
1230 return list.get(1);
1231 }
1232 else {
1233 return null;
1234 }
1235 }
1236
1237
1246 public Team findByG_N(long groupId, String name)
1247 throws NoSuchTeamException, SystemException {
1248 Team team = fetchByG_N(groupId, name);
1249
1250 if (team == null) {
1251 StringBundler msg = new StringBundler(6);
1252
1253 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1254
1255 msg.append("groupId=");
1256 msg.append(groupId);
1257
1258 msg.append(", name=");
1259 msg.append(name);
1260
1261 msg.append(StringPool.CLOSE_CURLY_BRACE);
1262
1263 if (_log.isWarnEnabled()) {
1264 _log.warn(msg.toString());
1265 }
1266
1267 throw new NoSuchTeamException(msg.toString());
1268 }
1269
1270 return team;
1271 }
1272
1273
1281 public Team fetchByG_N(long groupId, String name) throws SystemException {
1282 return fetchByG_N(groupId, name, true);
1283 }
1284
1285
1294 public Team fetchByG_N(long groupId, String name, boolean retrieveFromCache)
1295 throws SystemException {
1296 Object[] finderArgs = new Object[] { groupId, name };
1297
1298 Object result = null;
1299
1300 if (retrieveFromCache) {
1301 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_N,
1302 finderArgs, this);
1303 }
1304
1305 if (result instanceof Team) {
1306 Team team = (Team)result;
1307
1308 if ((groupId != team.getGroupId()) ||
1309 !Validator.equals(name, team.getName())) {
1310 result = null;
1311 }
1312 }
1313
1314 if (result == null) {
1315 StringBundler query = new StringBundler(4);
1316
1317 query.append(_SQL_SELECT_TEAM_WHERE);
1318
1319 query.append(_FINDER_COLUMN_G_N_GROUPID_2);
1320
1321 if (name == null) {
1322 query.append(_FINDER_COLUMN_G_N_NAME_1);
1323 }
1324 else {
1325 if (name.equals(StringPool.BLANK)) {
1326 query.append(_FINDER_COLUMN_G_N_NAME_3);
1327 }
1328 else {
1329 query.append(_FINDER_COLUMN_G_N_NAME_2);
1330 }
1331 }
1332
1333 query.append(TeamModelImpl.ORDER_BY_JPQL);
1334
1335 String sql = query.toString();
1336
1337 Session session = null;
1338
1339 try {
1340 session = openSession();
1341
1342 Query q = session.createQuery(sql);
1343
1344 QueryPos qPos = QueryPos.getInstance(q);
1345
1346 qPos.add(groupId);
1347
1348 if (name != null) {
1349 qPos.add(name);
1350 }
1351
1352 List<Team> list = q.list();
1353
1354 result = list;
1355
1356 Team team = null;
1357
1358 if (list.isEmpty()) {
1359 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
1360 finderArgs, list);
1361 }
1362 else {
1363 team = list.get(0);
1364
1365 cacheResult(team);
1366
1367 if ((team.getGroupId() != groupId) ||
1368 (team.getName() == null) ||
1369 !team.getName().equals(name)) {
1370 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
1371 finderArgs, team);
1372 }
1373 }
1374
1375 return team;
1376 }
1377 catch (Exception e) {
1378 throw processException(e);
1379 }
1380 finally {
1381 if (result == null) {
1382 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N,
1383 finderArgs);
1384 }
1385
1386 closeSession(session);
1387 }
1388 }
1389 else {
1390 if (result instanceof List<?>) {
1391 return null;
1392 }
1393 else {
1394 return (Team)result;
1395 }
1396 }
1397 }
1398
1399
1405 public List<Team> findAll() throws SystemException {
1406 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1407 }
1408
1409
1421 public List<Team> findAll(int start, int end) throws SystemException {
1422 return findAll(start, end, null);
1423 }
1424
1425
1438 public List<Team> findAll(int start, int end,
1439 OrderByComparator orderByComparator) throws SystemException {
1440 FinderPath finderPath = null;
1441 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1442
1443 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1444 (orderByComparator == null)) {
1445 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1446 finderArgs = FINDER_ARGS_EMPTY;
1447 }
1448 else {
1449 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1450 finderArgs = new Object[] { start, end, orderByComparator };
1451 }
1452
1453 List<Team> list = (List<Team>)FinderCacheUtil.getResult(finderPath,
1454 finderArgs, this);
1455
1456 if (list == null) {
1457 StringBundler query = null;
1458 String sql = null;
1459
1460 if (orderByComparator != null) {
1461 query = new StringBundler(2 +
1462 (orderByComparator.getOrderByFields().length * 3));
1463
1464 query.append(_SQL_SELECT_TEAM);
1465
1466 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1467 orderByComparator);
1468
1469 sql = query.toString();
1470 }
1471 else {
1472 sql = _SQL_SELECT_TEAM.concat(TeamModelImpl.ORDER_BY_JPQL);
1473 }
1474
1475 Session session = null;
1476
1477 try {
1478 session = openSession();
1479
1480 Query q = session.createQuery(sql);
1481
1482 if (orderByComparator == null) {
1483 list = (List<Team>)QueryUtil.list(q, getDialect(), start,
1484 end, false);
1485
1486 Collections.sort(list);
1487 }
1488 else {
1489 list = (List<Team>)QueryUtil.list(q, getDialect(), start,
1490 end);
1491 }
1492 }
1493 catch (Exception e) {
1494 throw processException(e);
1495 }
1496 finally {
1497 if (list == null) {
1498 FinderCacheUtil.removeResult(finderPath, finderArgs);
1499 }
1500 else {
1501 cacheResult(list);
1502
1503 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1504 }
1505
1506 closeSession(session);
1507 }
1508 }
1509
1510 return list;
1511 }
1512
1513
1519 public void removeByGroupId(long groupId) throws SystemException {
1520 for (Team team : findByGroupId(groupId)) {
1521 remove(team);
1522 }
1523 }
1524
1525
1533 public Team removeByG_N(long groupId, String name)
1534 throws NoSuchTeamException, SystemException {
1535 Team team = findByG_N(groupId, name);
1536
1537 return remove(team);
1538 }
1539
1540
1545 public void removeAll() throws SystemException {
1546 for (Team team : findAll()) {
1547 remove(team);
1548 }
1549 }
1550
1551
1558 public int countByGroupId(long groupId) throws SystemException {
1559 Object[] finderArgs = new Object[] { groupId };
1560
1561 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
1562 finderArgs, this);
1563
1564 if (count == null) {
1565 StringBundler query = new StringBundler(2);
1566
1567 query.append(_SQL_COUNT_TEAM_WHERE);
1568
1569 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1570
1571 String sql = query.toString();
1572
1573 Session session = null;
1574
1575 try {
1576 session = openSession();
1577
1578 Query q = session.createQuery(sql);
1579
1580 QueryPos qPos = QueryPos.getInstance(q);
1581
1582 qPos.add(groupId);
1583
1584 count = (Long)q.uniqueResult();
1585 }
1586 catch (Exception e) {
1587 throw processException(e);
1588 }
1589 finally {
1590 if (count == null) {
1591 count = Long.valueOf(0);
1592 }
1593
1594 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
1595 finderArgs, count);
1596
1597 closeSession(session);
1598 }
1599 }
1600
1601 return count.intValue();
1602 }
1603
1604
1611 public int filterCountByGroupId(long groupId) throws SystemException {
1612 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1613 return countByGroupId(groupId);
1614 }
1615
1616 StringBundler query = new StringBundler(2);
1617
1618 query.append(_FILTER_SQL_COUNT_TEAM_WHERE);
1619
1620 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1621
1622 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1623 Team.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN,
1624 groupId);
1625
1626 Session session = null;
1627
1628 try {
1629 session = openSession();
1630
1631 SQLQuery q = session.createSQLQuery(sql);
1632
1633 q.addScalar(COUNT_COLUMN_NAME,
1634 com.liferay.portal.kernel.dao.orm.Type.LONG);
1635
1636 QueryPos qPos = QueryPos.getInstance(q);
1637
1638 qPos.add(groupId);
1639
1640 Long count = (Long)q.uniqueResult();
1641
1642 return count.intValue();
1643 }
1644 catch (Exception e) {
1645 throw processException(e);
1646 }
1647 finally {
1648 closeSession(session);
1649 }
1650 }
1651
1652
1660 public int countByG_N(long groupId, String name) throws SystemException {
1661 Object[] finderArgs = new Object[] { groupId, name };
1662
1663 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_N,
1664 finderArgs, this);
1665
1666 if (count == null) {
1667 StringBundler query = new StringBundler(3);
1668
1669 query.append(_SQL_COUNT_TEAM_WHERE);
1670
1671 query.append(_FINDER_COLUMN_G_N_GROUPID_2);
1672
1673 if (name == null) {
1674 query.append(_FINDER_COLUMN_G_N_NAME_1);
1675 }
1676 else {
1677 if (name.equals(StringPool.BLANK)) {
1678 query.append(_FINDER_COLUMN_G_N_NAME_3);
1679 }
1680 else {
1681 query.append(_FINDER_COLUMN_G_N_NAME_2);
1682 }
1683 }
1684
1685 String sql = query.toString();
1686
1687 Session session = null;
1688
1689 try {
1690 session = openSession();
1691
1692 Query q = session.createQuery(sql);
1693
1694 QueryPos qPos = QueryPos.getInstance(q);
1695
1696 qPos.add(groupId);
1697
1698 if (name != null) {
1699 qPos.add(name);
1700 }
1701
1702 count = (Long)q.uniqueResult();
1703 }
1704 catch (Exception e) {
1705 throw processException(e);
1706 }
1707 finally {
1708 if (count == null) {
1709 count = Long.valueOf(0);
1710 }
1711
1712 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_N, finderArgs,
1713 count);
1714
1715 closeSession(session);
1716 }
1717 }
1718
1719 return count.intValue();
1720 }
1721
1722
1728 public int countAll() throws SystemException {
1729 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1730 FINDER_ARGS_EMPTY, this);
1731
1732 if (count == null) {
1733 Session session = null;
1734
1735 try {
1736 session = openSession();
1737
1738 Query q = session.createQuery(_SQL_COUNT_TEAM);
1739
1740 count = (Long)q.uniqueResult();
1741 }
1742 catch (Exception e) {
1743 throw processException(e);
1744 }
1745 finally {
1746 if (count == null) {
1747 count = Long.valueOf(0);
1748 }
1749
1750 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1751 FINDER_ARGS_EMPTY, count);
1752
1753 closeSession(session);
1754 }
1755 }
1756
1757 return count.intValue();
1758 }
1759
1760
1767 public List<com.liferay.portal.model.User> getUsers(long pk)
1768 throws SystemException {
1769 return getUsers(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
1770 }
1771
1772
1785 public List<com.liferay.portal.model.User> getUsers(long pk, int start,
1786 int end) throws SystemException {
1787 return getUsers(pk, start, end, null);
1788 }
1789
1790 public static final FinderPath FINDER_PATH_GET_USERS = new FinderPath(com.liferay.portal.model.impl.UserModelImpl.ENTITY_CACHE_ENABLED,
1791 TeamModelImpl.FINDER_CACHE_ENABLED_USERS_TEAMS,
1792 com.liferay.portal.model.impl.UserImpl.class,
1793 TeamModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME, "getUsers",
1794 new String[] {
1795 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
1796 "com.liferay.portal.kernel.util.OrderByComparator"
1797 });
1798
1799 static {
1800 FINDER_PATH_GET_USERS.setCacheKeyGeneratorCacheName(null);
1801 }
1802
1803
1817 public List<com.liferay.portal.model.User> getUsers(long pk, int start,
1818 int end, OrderByComparator orderByComparator) throws SystemException {
1819 Object[] finderArgs = new Object[] { pk, start, end, orderByComparator };
1820
1821 List<com.liferay.portal.model.User> list = (List<com.liferay.portal.model.User>)FinderCacheUtil.getResult(FINDER_PATH_GET_USERS,
1822 finderArgs, this);
1823
1824 if (list == null) {
1825 Session session = null;
1826
1827 try {
1828 session = openSession();
1829
1830 String sql = null;
1831
1832 if (orderByComparator != null) {
1833 sql = _SQL_GETUSERS.concat(ORDER_BY_CLAUSE)
1834 .concat(orderByComparator.getOrderBy());
1835 }
1836 else {
1837 sql = _SQL_GETUSERS;
1838 }
1839
1840 SQLQuery q = session.createSQLQuery(sql);
1841
1842 q.addEntity("User_",
1843 com.liferay.portal.model.impl.UserImpl.class);
1844
1845 QueryPos qPos = QueryPos.getInstance(q);
1846
1847 qPos.add(pk);
1848
1849 list = (List<com.liferay.portal.model.User>)QueryUtil.list(q,
1850 getDialect(), start, end);
1851 }
1852 catch (Exception e) {
1853 throw processException(e);
1854 }
1855 finally {
1856 if (list == null) {
1857 FinderCacheUtil.removeResult(FINDER_PATH_GET_USERS,
1858 finderArgs);
1859 }
1860 else {
1861 userPersistence.cacheResult(list);
1862
1863 FinderCacheUtil.putResult(FINDER_PATH_GET_USERS,
1864 finderArgs, list);
1865 }
1866
1867 closeSession(session);
1868 }
1869 }
1870
1871 return list;
1872 }
1873
1874 public static final FinderPath FINDER_PATH_GET_USERS_SIZE = new FinderPath(com.liferay.portal.model.impl.UserModelImpl.ENTITY_CACHE_ENABLED,
1875 TeamModelImpl.FINDER_CACHE_ENABLED_USERS_TEAMS, Long.class,
1876 TeamModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME, "getUsersSize",
1877 new String[] { Long.class.getName() });
1878
1879 static {
1880 FINDER_PATH_GET_USERS_SIZE.setCacheKeyGeneratorCacheName(null);
1881 }
1882
1883
1890 public int getUsersSize(long pk) throws SystemException {
1891 Object[] finderArgs = new Object[] { pk };
1892
1893 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_USERS_SIZE,
1894 finderArgs, this);
1895
1896 if (count == null) {
1897 Session session = null;
1898
1899 try {
1900 session = openSession();
1901
1902 SQLQuery q = session.createSQLQuery(_SQL_GETUSERSSIZE);
1903
1904 q.addScalar(COUNT_COLUMN_NAME,
1905 com.liferay.portal.kernel.dao.orm.Type.LONG);
1906
1907 QueryPos qPos = QueryPos.getInstance(q);
1908
1909 qPos.add(pk);
1910
1911 count = (Long)q.uniqueResult();
1912 }
1913 catch (Exception e) {
1914 throw processException(e);
1915 }
1916 finally {
1917 if (count == null) {
1918 count = Long.valueOf(0);
1919 }
1920
1921 FinderCacheUtil.putResult(FINDER_PATH_GET_USERS_SIZE,
1922 finderArgs, count);
1923
1924 closeSession(session);
1925 }
1926 }
1927
1928 return count.intValue();
1929 }
1930
1931 public static final FinderPath FINDER_PATH_CONTAINS_USER = new FinderPath(com.liferay.portal.model.impl.UserModelImpl.ENTITY_CACHE_ENABLED,
1932 TeamModelImpl.FINDER_CACHE_ENABLED_USERS_TEAMS, Boolean.class,
1933 TeamModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME, "containsUser",
1934 new String[] { Long.class.getName(), Long.class.getName() });
1935
1936
1944 public boolean containsUser(long pk, long userPK) throws SystemException {
1945 Object[] finderArgs = new Object[] { pk, userPK };
1946
1947 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_USER,
1948 finderArgs, this);
1949
1950 if (value == null) {
1951 try {
1952 value = Boolean.valueOf(containsUser.contains(pk, userPK));
1953 }
1954 catch (Exception e) {
1955 throw processException(e);
1956 }
1957 finally {
1958 if (value == null) {
1959 value = Boolean.FALSE;
1960 }
1961
1962 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_USER,
1963 finderArgs, value);
1964 }
1965 }
1966
1967 return value.booleanValue();
1968 }
1969
1970
1977 public boolean containsUsers(long pk) throws SystemException {
1978 if (getUsersSize(pk) > 0) {
1979 return true;
1980 }
1981 else {
1982 return false;
1983 }
1984 }
1985
1986
1993 public void addUser(long pk, long userPK) throws SystemException {
1994 try {
1995 addUser.add(pk, userPK);
1996 }
1997 catch (Exception e) {
1998 throw processException(e);
1999 }
2000 finally {
2001 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
2002 }
2003 }
2004
2005
2012 public void addUser(long pk, com.liferay.portal.model.User user)
2013 throws SystemException {
2014 try {
2015 addUser.add(pk, user.getPrimaryKey());
2016 }
2017 catch (Exception e) {
2018 throw processException(e);
2019 }
2020 finally {
2021 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
2022 }
2023 }
2024
2025
2032 public void addUsers(long pk, long[] userPKs) throws SystemException {
2033 try {
2034 for (long userPK : userPKs) {
2035 addUser.add(pk, userPK);
2036 }
2037 }
2038 catch (Exception e) {
2039 throw processException(e);
2040 }
2041 finally {
2042 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
2043 }
2044 }
2045
2046
2053 public void addUsers(long pk, List<com.liferay.portal.model.User> users)
2054 throws SystemException {
2055 try {
2056 for (com.liferay.portal.model.User user : users) {
2057 addUser.add(pk, user.getPrimaryKey());
2058 }
2059 }
2060 catch (Exception e) {
2061 throw processException(e);
2062 }
2063 finally {
2064 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
2065 }
2066 }
2067
2068
2074 public void clearUsers(long pk) throws SystemException {
2075 try {
2076 clearUsers.clear(pk);
2077 }
2078 catch (Exception e) {
2079 throw processException(e);
2080 }
2081 finally {
2082 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
2083 }
2084 }
2085
2086
2093 public void removeUser(long pk, long userPK) throws SystemException {
2094 try {
2095 removeUser.remove(pk, userPK);
2096 }
2097 catch (Exception e) {
2098 throw processException(e);
2099 }
2100 finally {
2101 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
2102 }
2103 }
2104
2105
2112 public void removeUser(long pk, com.liferay.portal.model.User user)
2113 throws SystemException {
2114 try {
2115 removeUser.remove(pk, user.getPrimaryKey());
2116 }
2117 catch (Exception e) {
2118 throw processException(e);
2119 }
2120 finally {
2121 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
2122 }
2123 }
2124
2125
2132 public void removeUsers(long pk, long[] userPKs) throws SystemException {
2133 try {
2134 for (long userPK : userPKs) {
2135 removeUser.remove(pk, userPK);
2136 }
2137 }
2138 catch (Exception e) {
2139 throw processException(e);
2140 }
2141 finally {
2142 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
2143 }
2144 }
2145
2146
2153 public void removeUsers(long pk, List<com.liferay.portal.model.User> users)
2154 throws SystemException {
2155 try {
2156 for (com.liferay.portal.model.User user : users) {
2157 removeUser.remove(pk, user.getPrimaryKey());
2158 }
2159 }
2160 catch (Exception e) {
2161 throw processException(e);
2162 }
2163 finally {
2164 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
2165 }
2166 }
2167
2168
2175 public void setUsers(long pk, long[] userPKs) throws SystemException {
2176 try {
2177 Set<Long> userPKSet = SetUtil.fromArray(userPKs);
2178
2179 List<com.liferay.portal.model.User> users = getUsers(pk);
2180
2181 for (com.liferay.portal.model.User user : users) {
2182 if (!userPKSet.remove(user.getPrimaryKey())) {
2183 removeUser.remove(pk, user.getPrimaryKey());
2184 }
2185 }
2186
2187 for (Long userPK : userPKSet) {
2188 addUser.add(pk, userPK);
2189 }
2190 }
2191 catch (Exception e) {
2192 throw processException(e);
2193 }
2194 finally {
2195 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
2196 }
2197 }
2198
2199
2206 public void setUsers(long pk, List<com.liferay.portal.model.User> users)
2207 throws SystemException {
2208 try {
2209 long[] userPKs = new long[users.size()];
2210
2211 for (int i = 0; i < users.size(); i++) {
2212 com.liferay.portal.model.User user = users.get(i);
2213
2214 userPKs[i] = user.getPrimaryKey();
2215 }
2216
2217 setUsers(pk, userPKs);
2218 }
2219 catch (Exception e) {
2220 throw processException(e);
2221 }
2222 finally {
2223 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERS_TEAMS_NAME);
2224 }
2225 }
2226
2227
2234 public List<com.liferay.portal.model.UserGroup> getUserGroups(long pk)
2235 throws SystemException {
2236 return getUserGroups(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
2237 }
2238
2239
2252 public List<com.liferay.portal.model.UserGroup> getUserGroups(long pk,
2253 int start, int end) throws SystemException {
2254 return getUserGroups(pk, start, end, null);
2255 }
2256
2257 public static final FinderPath FINDER_PATH_GET_USERGROUPS = new FinderPath(com.liferay.portal.model.impl.UserGroupModelImpl.ENTITY_CACHE_ENABLED,
2258 TeamModelImpl.FINDER_CACHE_ENABLED_USERGROUPS_TEAMS,
2259 com.liferay.portal.model.impl.UserGroupImpl.class,
2260 TeamModelImpl.MAPPING_TABLE_USERGROUPS_TEAMS_NAME, "getUserGroups",
2261 new String[] {
2262 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
2263 "com.liferay.portal.kernel.util.OrderByComparator"
2264 });
2265
2266 static {
2267 FINDER_PATH_GET_USERGROUPS.setCacheKeyGeneratorCacheName(null);
2268 }
2269
2270
2284 public List<com.liferay.portal.model.UserGroup> getUserGroups(long pk,
2285 int start, int end, OrderByComparator orderByComparator)
2286 throws SystemException {
2287 Object[] finderArgs = new Object[] { pk, start, end, orderByComparator };
2288
2289 List<com.liferay.portal.model.UserGroup> list = (List<com.liferay.portal.model.UserGroup>)FinderCacheUtil.getResult(FINDER_PATH_GET_USERGROUPS,
2290 finderArgs, this);
2291
2292 if (list == null) {
2293 Session session = null;
2294
2295 try {
2296 session = openSession();
2297
2298 String sql = null;
2299
2300 if (orderByComparator != null) {
2301 sql = _SQL_GETUSERGROUPS.concat(ORDER_BY_CLAUSE)
2302 .concat(orderByComparator.getOrderBy());
2303 }
2304 else {
2305 sql = _SQL_GETUSERGROUPS.concat(com.liferay.portal.model.impl.UserGroupModelImpl.ORDER_BY_SQL);
2306 }
2307
2308 SQLQuery q = session.createSQLQuery(sql);
2309
2310 q.addEntity("UserGroup",
2311 com.liferay.portal.model.impl.UserGroupImpl.class);
2312
2313 QueryPos qPos = QueryPos.getInstance(q);
2314
2315 qPos.add(pk);
2316
2317 list = (List<com.liferay.portal.model.UserGroup>)QueryUtil.list(q,
2318 getDialect(), start, end);
2319 }
2320 catch (Exception e) {
2321 throw processException(e);
2322 }
2323 finally {
2324 if (list == null) {
2325 FinderCacheUtil.removeResult(FINDER_PATH_GET_USERGROUPS,
2326 finderArgs);
2327 }
2328 else {
2329 userGroupPersistence.cacheResult(list);
2330
2331 FinderCacheUtil.putResult(FINDER_PATH_GET_USERGROUPS,
2332 finderArgs, list);
2333 }
2334
2335 closeSession(session);
2336 }
2337 }
2338
2339 return list;
2340 }
2341
2342 public static final FinderPath FINDER_PATH_GET_USERGROUPS_SIZE = new FinderPath(com.liferay.portal.model.impl.UserGroupModelImpl.ENTITY_CACHE_ENABLED,
2343 TeamModelImpl.FINDER_CACHE_ENABLED_USERGROUPS_TEAMS, Long.class,
2344 TeamModelImpl.MAPPING_TABLE_USERGROUPS_TEAMS_NAME,
2345 "getUserGroupsSize", new String[] { Long.class.getName() });
2346
2347 static {
2348 FINDER_PATH_GET_USERGROUPS_SIZE.setCacheKeyGeneratorCacheName(null);
2349 }
2350
2351
2358 public int getUserGroupsSize(long pk) throws SystemException {
2359 Object[] finderArgs = new Object[] { pk };
2360
2361 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_USERGROUPS_SIZE,
2362 finderArgs, this);
2363
2364 if (count == null) {
2365 Session session = null;
2366
2367 try {
2368 session = openSession();
2369
2370 SQLQuery q = session.createSQLQuery(_SQL_GETUSERGROUPSSIZE);
2371
2372 q.addScalar(COUNT_COLUMN_NAME,
2373 com.liferay.portal.kernel.dao.orm.Type.LONG);
2374
2375 QueryPos qPos = QueryPos.getInstance(q);
2376
2377 qPos.add(pk);
2378
2379 count = (Long)q.uniqueResult();
2380 }
2381 catch (Exception e) {
2382 throw processException(e);
2383 }
2384 finally {
2385 if (count == null) {
2386 count = Long.valueOf(0);
2387 }
2388
2389 FinderCacheUtil.putResult(FINDER_PATH_GET_USERGROUPS_SIZE,
2390 finderArgs, count);
2391
2392 closeSession(session);
2393 }
2394 }
2395
2396 return count.intValue();
2397 }
2398
2399 public static final FinderPath FINDER_PATH_CONTAINS_USERGROUP = new FinderPath(com.liferay.portal.model.impl.UserGroupModelImpl.ENTITY_CACHE_ENABLED,
2400 TeamModelImpl.FINDER_CACHE_ENABLED_USERGROUPS_TEAMS, Boolean.class,
2401 TeamModelImpl.MAPPING_TABLE_USERGROUPS_TEAMS_NAME,
2402 "containsUserGroup",
2403 new String[] { Long.class.getName(), Long.class.getName() });
2404
2405
2413 public boolean containsUserGroup(long pk, long userGroupPK)
2414 throws SystemException {
2415 Object[] finderArgs = new Object[] { pk, userGroupPK };
2416
2417 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_USERGROUP,
2418 finderArgs, this);
2419
2420 if (value == null) {
2421 try {
2422 value = Boolean.valueOf(containsUserGroup.contains(pk,
2423 userGroupPK));
2424 }
2425 catch (Exception e) {
2426 throw processException(e);
2427 }
2428 finally {
2429 if (value == null) {
2430 value = Boolean.FALSE;
2431 }
2432
2433 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_USERGROUP,
2434 finderArgs, value);
2435 }
2436 }
2437
2438 return value.booleanValue();
2439 }
2440
2441
2448 public boolean containsUserGroups(long pk) throws SystemException {
2449 if (getUserGroupsSize(pk) > 0) {
2450 return true;
2451 }
2452 else {
2453 return false;
2454 }
2455 }
2456
2457
2464 public void addUserGroup(long pk, long userGroupPK)
2465 throws SystemException {
2466 try {
2467 addUserGroup.add(pk, userGroupPK);
2468 }
2469 catch (Exception e) {
2470 throw processException(e);
2471 }
2472 finally {
2473 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERGROUPS_TEAMS_NAME);
2474 }
2475 }
2476
2477
2484 public void addUserGroup(long pk,
2485 com.liferay.portal.model.UserGroup userGroup) throws SystemException {
2486 try {
2487 addUserGroup.add(pk, userGroup.getPrimaryKey());
2488 }
2489 catch (Exception e) {
2490 throw processException(e);
2491 }
2492 finally {
2493 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERGROUPS_TEAMS_NAME);
2494 }
2495 }
2496
2497
2504 public void addUserGroups(long pk, long[] userGroupPKs)
2505 throws SystemException {
2506 try {
2507 for (long userGroupPK : userGroupPKs) {
2508 addUserGroup.add(pk, userGroupPK);
2509 }
2510 }
2511 catch (Exception e) {
2512 throw processException(e);
2513 }
2514 finally {
2515 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERGROUPS_TEAMS_NAME);
2516 }
2517 }
2518
2519
2526 public void addUserGroups(long pk,
2527 List<com.liferay.portal.model.UserGroup> userGroups)
2528 throws SystemException {
2529 try {
2530 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
2531 addUserGroup.add(pk, userGroup.getPrimaryKey());
2532 }
2533 }
2534 catch (Exception e) {
2535 throw processException(e);
2536 }
2537 finally {
2538 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERGROUPS_TEAMS_NAME);
2539 }
2540 }
2541
2542
2548 public void clearUserGroups(long pk) throws SystemException {
2549 try {
2550 clearUserGroups.clear(pk);
2551 }
2552 catch (Exception e) {
2553 throw processException(e);
2554 }
2555 finally {
2556 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERGROUPS_TEAMS_NAME);
2557 }
2558 }
2559
2560
2567 public void removeUserGroup(long pk, long userGroupPK)
2568 throws SystemException {
2569 try {
2570 removeUserGroup.remove(pk, userGroupPK);
2571 }
2572 catch (Exception e) {
2573 throw processException(e);
2574 }
2575 finally {
2576 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERGROUPS_TEAMS_NAME);
2577 }
2578 }
2579
2580
2587 public void removeUserGroup(long pk,
2588 com.liferay.portal.model.UserGroup userGroup) throws SystemException {
2589 try {
2590 removeUserGroup.remove(pk, userGroup.getPrimaryKey());
2591 }
2592 catch (Exception e) {
2593 throw processException(e);
2594 }
2595 finally {
2596 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERGROUPS_TEAMS_NAME);
2597 }
2598 }
2599
2600
2607 public void removeUserGroups(long pk, long[] userGroupPKs)
2608 throws SystemException {
2609 try {
2610 for (long userGroupPK : userGroupPKs) {
2611 removeUserGroup.remove(pk, userGroupPK);
2612 }
2613 }
2614 catch (Exception e) {
2615 throw processException(e);
2616 }
2617 finally {
2618 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERGROUPS_TEAMS_NAME);
2619 }
2620 }
2621
2622
2629 public void removeUserGroups(long pk,
2630 List<com.liferay.portal.model.UserGroup> userGroups)
2631 throws SystemException {
2632 try {
2633 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
2634 removeUserGroup.remove(pk, userGroup.getPrimaryKey());
2635 }
2636 }
2637 catch (Exception e) {
2638 throw processException(e);
2639 }
2640 finally {
2641 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERGROUPS_TEAMS_NAME);
2642 }
2643 }
2644
2645
2652 public void setUserGroups(long pk, long[] userGroupPKs)
2653 throws SystemException {
2654 try {
2655 Set<Long> userGroupPKSet = SetUtil.fromArray(userGroupPKs);
2656
2657 List<com.liferay.portal.model.UserGroup> userGroups = getUserGroups(pk);
2658
2659 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
2660 if (!userGroupPKSet.remove(userGroup.getPrimaryKey())) {
2661 removeUserGroup.remove(pk, userGroup.getPrimaryKey());
2662 }
2663 }
2664
2665 for (Long userGroupPK : userGroupPKSet) {
2666 addUserGroup.add(pk, userGroupPK);
2667 }
2668 }
2669 catch (Exception e) {
2670 throw processException(e);
2671 }
2672 finally {
2673 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERGROUPS_TEAMS_NAME);
2674 }
2675 }
2676
2677
2684 public void setUserGroups(long pk,
2685 List<com.liferay.portal.model.UserGroup> userGroups)
2686 throws SystemException {
2687 try {
2688 long[] userGroupPKs = new long[userGroups.size()];
2689
2690 for (int i = 0; i < userGroups.size(); i++) {
2691 com.liferay.portal.model.UserGroup userGroup = userGroups.get(i);
2692
2693 userGroupPKs[i] = userGroup.getPrimaryKey();
2694 }
2695
2696 setUserGroups(pk, userGroupPKs);
2697 }
2698 catch (Exception e) {
2699 throw processException(e);
2700 }
2701 finally {
2702 FinderCacheUtil.clearCache(TeamModelImpl.MAPPING_TABLE_USERGROUPS_TEAMS_NAME);
2703 }
2704 }
2705
2706
2709 public void afterPropertiesSet() {
2710 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2711 com.liferay.portal.util.PropsUtil.get(
2712 "value.object.listener.com.liferay.portal.model.Team")));
2713
2714 if (listenerClassNames.length > 0) {
2715 try {
2716 List<ModelListener<Team>> listenersList = new ArrayList<ModelListener<Team>>();
2717
2718 for (String listenerClassName : listenerClassNames) {
2719 Class<?> clazz = getClass();
2720
2721 listenersList.add((ModelListener<Team>)InstanceFactory.newInstance(
2722 clazz.getClassLoader(), listenerClassName));
2723 }
2724
2725 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2726 }
2727 catch (Exception e) {
2728 _log.error(e);
2729 }
2730 }
2731
2732 containsUser = new ContainsUser();
2733
2734 addUser = new AddUser();
2735 clearUsers = new ClearUsers();
2736 removeUser = new RemoveUser();
2737
2738 containsUserGroup = new ContainsUserGroup();
2739
2740 addUserGroup = new AddUserGroup();
2741 clearUserGroups = new ClearUserGroups();
2742 removeUserGroup = new RemoveUserGroup();
2743 }
2744
2745 public void destroy() {
2746 EntityCacheUtil.removeCache(TeamImpl.class.getName());
2747 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2748 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2749 }
2750
2751 @BeanReference(type = AccountPersistence.class)
2752 protected AccountPersistence accountPersistence;
2753 @BeanReference(type = AddressPersistence.class)
2754 protected AddressPersistence addressPersistence;
2755 @BeanReference(type = BrowserTrackerPersistence.class)
2756 protected BrowserTrackerPersistence browserTrackerPersistence;
2757 @BeanReference(type = ClassNamePersistence.class)
2758 protected ClassNamePersistence classNamePersistence;
2759 @BeanReference(type = ClusterGroupPersistence.class)
2760 protected ClusterGroupPersistence clusterGroupPersistence;
2761 @BeanReference(type = CompanyPersistence.class)
2762 protected CompanyPersistence companyPersistence;
2763 @BeanReference(type = ContactPersistence.class)
2764 protected ContactPersistence contactPersistence;
2765 @BeanReference(type = CountryPersistence.class)
2766 protected CountryPersistence countryPersistence;
2767 @BeanReference(type = EmailAddressPersistence.class)
2768 protected EmailAddressPersistence emailAddressPersistence;
2769 @BeanReference(type = GroupPersistence.class)
2770 protected GroupPersistence groupPersistence;
2771 @BeanReference(type = ImagePersistence.class)
2772 protected ImagePersistence imagePersistence;
2773 @BeanReference(type = LayoutPersistence.class)
2774 protected LayoutPersistence layoutPersistence;
2775 @BeanReference(type = LayoutBranchPersistence.class)
2776 protected LayoutBranchPersistence layoutBranchPersistence;
2777 @BeanReference(type = LayoutPrototypePersistence.class)
2778 protected LayoutPrototypePersistence layoutPrototypePersistence;
2779 @BeanReference(type = LayoutRevisionPersistence.class)
2780 protected LayoutRevisionPersistence layoutRevisionPersistence;
2781 @BeanReference(type = LayoutSetPersistence.class)
2782 protected LayoutSetPersistence layoutSetPersistence;
2783 @BeanReference(type = LayoutSetBranchPersistence.class)
2784 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
2785 @BeanReference(type = LayoutSetPrototypePersistence.class)
2786 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
2787 @BeanReference(type = ListTypePersistence.class)
2788 protected ListTypePersistence listTypePersistence;
2789 @BeanReference(type = LockPersistence.class)
2790 protected LockPersistence lockPersistence;
2791 @BeanReference(type = MembershipRequestPersistence.class)
2792 protected MembershipRequestPersistence membershipRequestPersistence;
2793 @BeanReference(type = OrganizationPersistence.class)
2794 protected OrganizationPersistence organizationPersistence;
2795 @BeanReference(type = OrgGroupPermissionPersistence.class)
2796 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
2797 @BeanReference(type = OrgGroupRolePersistence.class)
2798 protected OrgGroupRolePersistence orgGroupRolePersistence;
2799 @BeanReference(type = OrgLaborPersistence.class)
2800 protected OrgLaborPersistence orgLaborPersistence;
2801 @BeanReference(type = PasswordPolicyPersistence.class)
2802 protected PasswordPolicyPersistence passwordPolicyPersistence;
2803 @BeanReference(type = PasswordPolicyRelPersistence.class)
2804 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
2805 @BeanReference(type = PasswordTrackerPersistence.class)
2806 protected PasswordTrackerPersistence passwordTrackerPersistence;
2807 @BeanReference(type = PermissionPersistence.class)
2808 protected PermissionPersistence permissionPersistence;
2809 @BeanReference(type = PhonePersistence.class)
2810 protected PhonePersistence phonePersistence;
2811 @BeanReference(type = PluginSettingPersistence.class)
2812 protected PluginSettingPersistence pluginSettingPersistence;
2813 @BeanReference(type = PortalPreferencesPersistence.class)
2814 protected PortalPreferencesPersistence portalPreferencesPersistence;
2815 @BeanReference(type = PortletPersistence.class)
2816 protected PortletPersistence portletPersistence;
2817 @BeanReference(type = PortletItemPersistence.class)
2818 protected PortletItemPersistence portletItemPersistence;
2819 @BeanReference(type = PortletPreferencesPersistence.class)
2820 protected PortletPreferencesPersistence portletPreferencesPersistence;
2821 @BeanReference(type = RegionPersistence.class)
2822 protected RegionPersistence regionPersistence;
2823 @BeanReference(type = ReleasePersistence.class)
2824 protected ReleasePersistence releasePersistence;
2825 @BeanReference(type = RepositoryPersistence.class)
2826 protected RepositoryPersistence repositoryPersistence;
2827 @BeanReference(type = RepositoryEntryPersistence.class)
2828 protected RepositoryEntryPersistence repositoryEntryPersistence;
2829 @BeanReference(type = ResourcePersistence.class)
2830 protected ResourcePersistence resourcePersistence;
2831 @BeanReference(type = ResourceActionPersistence.class)
2832 protected ResourceActionPersistence resourceActionPersistence;
2833 @BeanReference(type = ResourceBlockPersistence.class)
2834 protected ResourceBlockPersistence resourceBlockPersistence;
2835 @BeanReference(type = ResourceBlockPermissionPersistence.class)
2836 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
2837 @BeanReference(type = ResourceCodePersistence.class)
2838 protected ResourceCodePersistence resourceCodePersistence;
2839 @BeanReference(type = ResourcePermissionPersistence.class)
2840 protected ResourcePermissionPersistence resourcePermissionPersistence;
2841 @BeanReference(type = ResourceTypePermissionPersistence.class)
2842 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
2843 @BeanReference(type = RolePersistence.class)
2844 protected RolePersistence rolePersistence;
2845 @BeanReference(type = ServiceComponentPersistence.class)
2846 protected ServiceComponentPersistence serviceComponentPersistence;
2847 @BeanReference(type = ShardPersistence.class)
2848 protected ShardPersistence shardPersistence;
2849 @BeanReference(type = SubscriptionPersistence.class)
2850 protected SubscriptionPersistence subscriptionPersistence;
2851 @BeanReference(type = TeamPersistence.class)
2852 protected TeamPersistence teamPersistence;
2853 @BeanReference(type = TicketPersistence.class)
2854 protected TicketPersistence ticketPersistence;
2855 @BeanReference(type = UserPersistence.class)
2856 protected UserPersistence userPersistence;
2857 @BeanReference(type = UserGroupPersistence.class)
2858 protected UserGroupPersistence userGroupPersistence;
2859 @BeanReference(type = UserGroupGroupRolePersistence.class)
2860 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
2861 @BeanReference(type = UserGroupRolePersistence.class)
2862 protected UserGroupRolePersistence userGroupRolePersistence;
2863 @BeanReference(type = UserIdMapperPersistence.class)
2864 protected UserIdMapperPersistence userIdMapperPersistence;
2865 @BeanReference(type = UserNotificationEventPersistence.class)
2866 protected UserNotificationEventPersistence userNotificationEventPersistence;
2867 @BeanReference(type = UserTrackerPersistence.class)
2868 protected UserTrackerPersistence userTrackerPersistence;
2869 @BeanReference(type = UserTrackerPathPersistence.class)
2870 protected UserTrackerPathPersistence userTrackerPathPersistence;
2871 @BeanReference(type = VirtualHostPersistence.class)
2872 protected VirtualHostPersistence virtualHostPersistence;
2873 @BeanReference(type = WebDAVPropsPersistence.class)
2874 protected WebDAVPropsPersistence webDAVPropsPersistence;
2875 @BeanReference(type = WebsitePersistence.class)
2876 protected WebsitePersistence websitePersistence;
2877 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
2878 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
2879 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
2880 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
2881 protected ContainsUser containsUser;
2882 protected AddUser addUser;
2883 protected ClearUsers clearUsers;
2884 protected RemoveUser removeUser;
2885 protected ContainsUserGroup containsUserGroup;
2886 protected AddUserGroup addUserGroup;
2887 protected ClearUserGroups clearUserGroups;
2888 protected RemoveUserGroup removeUserGroup;
2889
2890 protected class ContainsUser {
2891 protected ContainsUser() {
2892 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
2893 _SQL_CONTAINSUSER,
2894 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
2895 RowMapper.COUNT);
2896 }
2897
2898 protected boolean contains(long teamId, long userId) {
2899 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
2900 new Long(teamId), new Long(userId)
2901 });
2902
2903 if (results.size() > 0) {
2904 Integer count = results.get(0);
2905
2906 if (count.intValue() > 0) {
2907 return true;
2908 }
2909 }
2910
2911 return false;
2912 }
2913
2914 private MappingSqlQuery<Integer> _mappingSqlQuery;
2915 }
2916
2917 protected class AddUser {
2918 protected AddUser() {
2919 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2920 "INSERT INTO Users_Teams (teamId, userId) VALUES (?, ?)",
2921 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
2922 }
2923
2924 protected void add(long teamId, long userId) throws SystemException {
2925 if (!containsUser.contains(teamId, userId)) {
2926 ModelListener<com.liferay.portal.model.User>[] userListeners = userPersistence.getListeners();
2927
2928 for (ModelListener<Team> listener : listeners) {
2929 listener.onBeforeAddAssociation(teamId,
2930 com.liferay.portal.model.User.class.getName(), userId);
2931 }
2932
2933 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
2934 listener.onBeforeAddAssociation(userId,
2935 Team.class.getName(), teamId);
2936 }
2937
2938 _sqlUpdate.update(new Object[] {
2939 new Long(teamId), new Long(userId)
2940 });
2941
2942 for (ModelListener<Team> listener : listeners) {
2943 listener.onAfterAddAssociation(teamId,
2944 com.liferay.portal.model.User.class.getName(), userId);
2945 }
2946
2947 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
2948 listener.onAfterAddAssociation(userId,
2949 Team.class.getName(), teamId);
2950 }
2951 }
2952 }
2953
2954 private SqlUpdate _sqlUpdate;
2955 }
2956
2957 protected class ClearUsers {
2958 protected ClearUsers() {
2959 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2960 "DELETE FROM Users_Teams WHERE teamId = ?",
2961 new int[] { java.sql.Types.BIGINT });
2962 }
2963
2964 protected void clear(long teamId) throws SystemException {
2965 ModelListener<com.liferay.portal.model.User>[] userListeners = userPersistence.getListeners();
2966
2967 List<com.liferay.portal.model.User> users = null;
2968
2969 if ((listeners.length > 0) || (userListeners.length > 0)) {
2970 users = getUsers(teamId);
2971
2972 for (com.liferay.portal.model.User user : users) {
2973 for (ModelListener<Team> listener : listeners) {
2974 listener.onBeforeRemoveAssociation(teamId,
2975 com.liferay.portal.model.User.class.getName(),
2976 user.getPrimaryKey());
2977 }
2978
2979 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
2980 listener.onBeforeRemoveAssociation(user.getPrimaryKey(),
2981 Team.class.getName(), teamId);
2982 }
2983 }
2984 }
2985
2986 _sqlUpdate.update(new Object[] { new Long(teamId) });
2987
2988 if ((listeners.length > 0) || (userListeners.length > 0)) {
2989 for (com.liferay.portal.model.User user : users) {
2990 for (ModelListener<Team> listener : listeners) {
2991 listener.onAfterRemoveAssociation(teamId,
2992 com.liferay.portal.model.User.class.getName(),
2993 user.getPrimaryKey());
2994 }
2995
2996 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
2997 listener.onAfterRemoveAssociation(user.getPrimaryKey(),
2998 Team.class.getName(), teamId);
2999 }
3000 }
3001 }
3002 }
3003
3004 private SqlUpdate _sqlUpdate;
3005 }
3006
3007 protected class RemoveUser {
3008 protected RemoveUser() {
3009 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
3010 "DELETE FROM Users_Teams WHERE teamId = ? AND userId = ?",
3011 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
3012 }
3013
3014 protected void remove(long teamId, long userId)
3015 throws SystemException {
3016 if (containsUser.contains(teamId, userId)) {
3017 ModelListener<com.liferay.portal.model.User>[] userListeners = userPersistence.getListeners();
3018
3019 for (ModelListener<Team> listener : listeners) {
3020 listener.onBeforeRemoveAssociation(teamId,
3021 com.liferay.portal.model.User.class.getName(), userId);
3022 }
3023
3024 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
3025 listener.onBeforeRemoveAssociation(userId,
3026 Team.class.getName(), teamId);
3027 }
3028
3029 _sqlUpdate.update(new Object[] {
3030 new Long(teamId), new Long(userId)
3031 });
3032
3033 for (ModelListener<Team> listener : listeners) {
3034 listener.onAfterRemoveAssociation(teamId,
3035 com.liferay.portal.model.User.class.getName(), userId);
3036 }
3037
3038 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
3039 listener.onAfterRemoveAssociation(userId,
3040 Team.class.getName(), teamId);
3041 }
3042 }
3043 }
3044
3045 private SqlUpdate _sqlUpdate;
3046 }
3047
3048 protected class ContainsUserGroup {
3049 protected ContainsUserGroup() {
3050 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
3051 _SQL_CONTAINSUSERGROUP,
3052 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
3053 RowMapper.COUNT);
3054 }
3055
3056 protected boolean contains(long teamId, long userGroupId) {
3057 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
3058 new Long(teamId), new Long(userGroupId)
3059 });
3060
3061 if (results.size() > 0) {
3062 Integer count = results.get(0);
3063
3064 if (count.intValue() > 0) {
3065 return true;
3066 }
3067 }
3068
3069 return false;
3070 }
3071
3072 private MappingSqlQuery<Integer> _mappingSqlQuery;
3073 }
3074
3075 protected class AddUserGroup {
3076 protected AddUserGroup() {
3077 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
3078 "INSERT INTO UserGroups_Teams (teamId, userGroupId) VALUES (?, ?)",
3079 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
3080 }
3081
3082 protected void add(long teamId, long userGroupId)
3083 throws SystemException {
3084 if (!containsUserGroup.contains(teamId, userGroupId)) {
3085 ModelListener<com.liferay.portal.model.UserGroup>[] userGroupListeners =
3086 userGroupPersistence.getListeners();
3087
3088 for (ModelListener<Team> listener : listeners) {
3089 listener.onBeforeAddAssociation(teamId,
3090 com.liferay.portal.model.UserGroup.class.getName(),
3091 userGroupId);
3092 }
3093
3094 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
3095 listener.onBeforeAddAssociation(userGroupId,
3096 Team.class.getName(), teamId);
3097 }
3098
3099 _sqlUpdate.update(new Object[] {
3100 new Long(teamId), new Long(userGroupId)
3101 });
3102
3103 for (ModelListener<Team> listener : listeners) {
3104 listener.onAfterAddAssociation(teamId,
3105 com.liferay.portal.model.UserGroup.class.getName(),
3106 userGroupId);
3107 }
3108
3109 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
3110 listener.onAfterAddAssociation(userGroupId,
3111 Team.class.getName(), teamId);
3112 }
3113 }
3114 }
3115
3116 private SqlUpdate _sqlUpdate;
3117 }
3118
3119 protected class ClearUserGroups {
3120 protected ClearUserGroups() {
3121 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
3122 "DELETE FROM UserGroups_Teams WHERE teamId = ?",
3123 new int[] { java.sql.Types.BIGINT });
3124 }
3125
3126 protected void clear(long teamId) throws SystemException {
3127 ModelListener<com.liferay.portal.model.UserGroup>[] userGroupListeners =
3128 userGroupPersistence.getListeners();
3129
3130 List<com.liferay.portal.model.UserGroup> userGroups = null;
3131
3132 if ((listeners.length > 0) || (userGroupListeners.length > 0)) {
3133 userGroups = getUserGroups(teamId);
3134
3135 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
3136 for (ModelListener<Team> listener : listeners) {
3137 listener.onBeforeRemoveAssociation(teamId,
3138 com.liferay.portal.model.UserGroup.class.getName(),
3139 userGroup.getPrimaryKey());
3140 }
3141
3142 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
3143 listener.onBeforeRemoveAssociation(userGroup.getPrimaryKey(),
3144 Team.class.getName(), teamId);
3145 }
3146 }
3147 }
3148
3149 _sqlUpdate.update(new Object[] { new Long(teamId) });
3150
3151 if ((listeners.length > 0) || (userGroupListeners.length > 0)) {
3152 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
3153 for (ModelListener<Team> listener : listeners) {
3154 listener.onAfterRemoveAssociation(teamId,
3155 com.liferay.portal.model.UserGroup.class.getName(),
3156 userGroup.getPrimaryKey());
3157 }
3158
3159 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
3160 listener.onAfterRemoveAssociation(userGroup.getPrimaryKey(),
3161 Team.class.getName(), teamId);
3162 }
3163 }
3164 }
3165 }
3166
3167 private SqlUpdate _sqlUpdate;
3168 }
3169
3170 protected class RemoveUserGroup {
3171 protected RemoveUserGroup() {
3172 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
3173 "DELETE FROM UserGroups_Teams WHERE teamId = ? AND userGroupId = ?",
3174 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
3175 }
3176
3177 protected void remove(long teamId, long userGroupId)
3178 throws SystemException {
3179 if (containsUserGroup.contains(teamId, userGroupId)) {
3180 ModelListener<com.liferay.portal.model.UserGroup>[] userGroupListeners =
3181 userGroupPersistence.getListeners();
3182
3183 for (ModelListener<Team> listener : listeners) {
3184 listener.onBeforeRemoveAssociation(teamId,
3185 com.liferay.portal.model.UserGroup.class.getName(),
3186 userGroupId);
3187 }
3188
3189 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
3190 listener.onBeforeRemoveAssociation(userGroupId,
3191 Team.class.getName(), teamId);
3192 }
3193
3194 _sqlUpdate.update(new Object[] {
3195 new Long(teamId), new Long(userGroupId)
3196 });
3197
3198 for (ModelListener<Team> listener : listeners) {
3199 listener.onAfterRemoveAssociation(teamId,
3200 com.liferay.portal.model.UserGroup.class.getName(),
3201 userGroupId);
3202 }
3203
3204 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
3205 listener.onAfterRemoveAssociation(userGroupId,
3206 Team.class.getName(), teamId);
3207 }
3208 }
3209 }
3210
3211 private SqlUpdate _sqlUpdate;
3212 }
3213
3214 private static final String _SQL_SELECT_TEAM = "SELECT team FROM Team team";
3215 private static final String _SQL_SELECT_TEAM_WHERE = "SELECT team FROM Team team WHERE ";
3216 private static final String _SQL_COUNT_TEAM = "SELECT COUNT(team) FROM Team team";
3217 private static final String _SQL_COUNT_TEAM_WHERE = "SELECT COUNT(team) FROM Team team WHERE ";
3218 private static final String _SQL_GETUSERS = "SELECT {User_.*} FROM User_ INNER JOIN Users_Teams ON (Users_Teams.userId = User_.userId) WHERE (Users_Teams.teamId = ?)";
3219 private static final String _SQL_GETUSERSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Teams WHERE teamId = ?";
3220 private static final String _SQL_CONTAINSUSER = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Teams WHERE teamId = ? AND userId = ?";
3221 private static final String _SQL_GETUSERGROUPS = "SELECT {UserGroup.*} FROM UserGroup INNER JOIN UserGroups_Teams ON (UserGroups_Teams.userGroupId = UserGroup.userGroupId) WHERE (UserGroups_Teams.teamId = ?)";
3222 private static final String _SQL_GETUSERGROUPSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM UserGroups_Teams WHERE teamId = ?";
3223 private static final String _SQL_CONTAINSUSERGROUP = "SELECT COUNT(*) AS COUNT_VALUE FROM UserGroups_Teams WHERE teamId = ? AND userGroupId = ?";
3224 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "team.groupId = ?";
3225 private static final String _FINDER_COLUMN_G_N_GROUPID_2 = "team.groupId = ? AND ";
3226 private static final String _FINDER_COLUMN_G_N_NAME_1 = "team.name IS NULL";
3227 private static final String _FINDER_COLUMN_G_N_NAME_2 = "team.name = ?";
3228 private static final String _FINDER_COLUMN_G_N_NAME_3 = "(team.name IS NULL OR team.name = ?)";
3229 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "team.teamId";
3230 private static final String _FILTER_SQL_SELECT_TEAM_WHERE = "SELECT DISTINCT {team.*} FROM Team team WHERE ";
3231 private static final String _FILTER_SQL_SELECT_TEAM_NO_INLINE_DISTINCT_WHERE_1 =
3232 "SELECT {Team.*} FROM (SELECT DISTINCT team.teamId FROM Team team WHERE ";
3233 private static final String _FILTER_SQL_SELECT_TEAM_NO_INLINE_DISTINCT_WHERE_2 =
3234 ") TEMP_TABLE INNER JOIN Team ON TEMP_TABLE.teamId = Team.teamId";
3235 private static final String _FILTER_SQL_COUNT_TEAM_WHERE = "SELECT COUNT(DISTINCT team.teamId) AS COUNT_VALUE FROM Team team WHERE ";
3236 private static final String _FILTER_ENTITY_ALIAS = "team";
3237 private static final String _FILTER_ENTITY_TABLE = "Team";
3238 private static final String _ORDER_BY_ENTITY_ALIAS = "team.";
3239 private static final String _ORDER_BY_ENTITY_TABLE = "Team.";
3240 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Team exists with the primary key ";
3241 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Team exists with the key {";
3242 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
3243 private static Log _log = LogFactoryUtil.getLog(TeamPersistenceImpl.class);
3244 private static Team _nullTeam = new TeamImpl() {
3245 @Override
3246 public Object clone() {
3247 return this;
3248 }
3249
3250 @Override
3251 public CacheModel<Team> toCacheModel() {
3252 return _nullTeamCacheModel;
3253 }
3254 };
3255
3256 private static CacheModel<Team> _nullTeamCacheModel = new CacheModel<Team>() {
3257 public Team toEntityModel() {
3258 return _nullTeam;
3259 }
3260 };
3261 }