001
014
015 package com.liferay.portlet.social.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.kernel.annotation.BeanReference;
019 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderPath;
023 import com.liferay.portal.kernel.dao.orm.Query;
024 import com.liferay.portal.kernel.dao.orm.QueryPos;
025 import com.liferay.portal.kernel.dao.orm.QueryUtil;
026 import com.liferay.portal.kernel.dao.orm.Session;
027 import com.liferay.portal.kernel.exception.SystemException;
028 import com.liferay.portal.kernel.log.Log;
029 import com.liferay.portal.kernel.log.LogFactoryUtil;
030 import com.liferay.portal.kernel.util.GetterUtil;
031 import com.liferay.portal.kernel.util.InstanceFactory;
032 import com.liferay.portal.kernel.util.OrderByComparator;
033 import com.liferay.portal.kernel.util.StringBundler;
034 import com.liferay.portal.kernel.util.StringPool;
035 import com.liferay.portal.kernel.util.StringUtil;
036 import com.liferay.portal.kernel.util.Validator;
037 import com.liferay.portal.model.ModelListener;
038 import com.liferay.portal.service.persistence.BatchSessionUtil;
039 import com.liferay.portal.service.persistence.ResourcePersistence;
040 import com.liferay.portal.service.persistence.UserPersistence;
041 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
042
043 import com.liferay.portlet.asset.service.persistence.AssetEntryPersistence;
044 import com.liferay.portlet.social.NoSuchEquityLogException;
045 import com.liferay.portlet.social.model.SocialEquityLog;
046 import com.liferay.portlet.social.model.impl.SocialEquityLogImpl;
047 import com.liferay.portlet.social.model.impl.SocialEquityLogModelImpl;
048
049 import java.io.Serializable;
050
051 import java.util.ArrayList;
052 import java.util.Collections;
053 import java.util.List;
054
055
071 public class SocialEquityLogPersistenceImpl extends BasePersistenceImpl<SocialEquityLog>
072 implements SocialEquityLogPersistence {
073 public static final String FINDER_CLASS_NAME_ENTITY = SocialEquityLogImpl.class.getName();
074 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
075 ".List";
076 public static final FinderPath FINDER_PATH_FIND_BY_AEI_T_A = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
077 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
078 FINDER_CLASS_NAME_LIST, "findByAEI_T_A",
079 new String[] {
080 Long.class.getName(), Integer.class.getName(),
081 Boolean.class.getName(),
082
083 "java.lang.Integer", "java.lang.Integer",
084 "com.liferay.portal.kernel.util.OrderByComparator"
085 });
086 public static final FinderPath FINDER_PATH_COUNT_BY_AEI_T_A = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
087 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
088 FINDER_CLASS_NAME_LIST, "countByAEI_T_A",
089 new String[] {
090 Long.class.getName(), Integer.class.getName(),
091 Boolean.class.getName()
092 });
093 public static final FinderPath FINDER_PATH_FIND_BY_U_AID_A_T = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
094 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
095 FINDER_CLASS_NAME_LIST, "findByU_AID_A_T",
096 new String[] {
097 Long.class.getName(), String.class.getName(),
098 Boolean.class.getName(), Integer.class.getName(),
099
100 "java.lang.Integer", "java.lang.Integer",
101 "com.liferay.portal.kernel.util.OrderByComparator"
102 });
103 public static final FinderPath FINDER_PATH_COUNT_BY_U_AID_A_T = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
104 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
105 FINDER_CLASS_NAME_LIST, "countByU_AID_A_T",
106 new String[] {
107 Long.class.getName(), String.class.getName(),
108 Boolean.class.getName(), Integer.class.getName()
109 });
110 public static final FinderPath FINDER_PATH_FIND_BY_AEI_AID_A_T = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
111 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
112 FINDER_CLASS_NAME_LIST, "findByAEI_AID_A_T",
113 new String[] {
114 Long.class.getName(), String.class.getName(),
115 Boolean.class.getName(), Integer.class.getName(),
116
117 "java.lang.Integer", "java.lang.Integer",
118 "com.liferay.portal.kernel.util.OrderByComparator"
119 });
120 public static final FinderPath FINDER_PATH_COUNT_BY_AEI_AID_A_T = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
121 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
122 FINDER_CLASS_NAME_LIST, "countByAEI_AID_A_T",
123 new String[] {
124 Long.class.getName(), String.class.getName(),
125 Boolean.class.getName(), Integer.class.getName()
126 });
127 public static final FinderPath FINDER_PATH_FIND_BY_U_AID_AD_A_T = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
128 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
129 FINDER_CLASS_NAME_LIST, "findByU_AID_AD_A_T",
130 new String[] {
131 Long.class.getName(), String.class.getName(),
132 Integer.class.getName(), Boolean.class.getName(),
133 Integer.class.getName(),
134
135 "java.lang.Integer", "java.lang.Integer",
136 "com.liferay.portal.kernel.util.OrderByComparator"
137 });
138 public static final FinderPath FINDER_PATH_COUNT_BY_U_AID_AD_A_T = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
139 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
140 FINDER_CLASS_NAME_LIST, "countByU_AID_AD_A_T",
141 new String[] {
142 Long.class.getName(), String.class.getName(),
143 Integer.class.getName(), Boolean.class.getName(),
144 Integer.class.getName()
145 });
146 public static final FinderPath FINDER_PATH_FIND_BY_AEI_AID_AD_A_T = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
147 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
148 FINDER_CLASS_NAME_LIST, "findByAEI_AID_AD_A_T",
149 new String[] {
150 Long.class.getName(), String.class.getName(),
151 Integer.class.getName(), Boolean.class.getName(),
152 Integer.class.getName(),
153
154 "java.lang.Integer", "java.lang.Integer",
155 "com.liferay.portal.kernel.util.OrderByComparator"
156 });
157 public static final FinderPath FINDER_PATH_COUNT_BY_AEI_AID_AD_A_T = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
158 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
159 FINDER_CLASS_NAME_LIST, "countByAEI_AID_AD_A_T",
160 new String[] {
161 Long.class.getName(), String.class.getName(),
162 Integer.class.getName(), Boolean.class.getName(),
163 Integer.class.getName()
164 });
165 public static final FinderPath FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
166 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
167 FINDER_CLASS_NAME_ENTITY, "fetchByU_AEI_AID_AD_A_T",
168 new String[] {
169 Long.class.getName(), Long.class.getName(),
170 String.class.getName(), Integer.class.getName(),
171 Boolean.class.getName(), Integer.class.getName()
172 });
173 public static final FinderPath FINDER_PATH_COUNT_BY_U_AEI_AID_AD_A_T = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
174 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
175 FINDER_CLASS_NAME_LIST, "countByU_AEI_AID_AD_A_T",
176 new String[] {
177 Long.class.getName(), Long.class.getName(),
178 String.class.getName(), Integer.class.getName(),
179 Boolean.class.getName(), Integer.class.getName()
180 });
181 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
182 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
183 FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
184 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
185 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
186 FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
187
188
193 public void cacheResult(SocialEquityLog socialEquityLog) {
194 EntityCacheUtil.putResult(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
195 SocialEquityLogImpl.class, socialEquityLog.getPrimaryKey(),
196 socialEquityLog);
197
198 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
199 new Object[] {
200 new Long(socialEquityLog.getUserId()),
201 new Long(socialEquityLog.getAssetEntryId()),
202
203 socialEquityLog.getActionId(),
204 new Integer(socialEquityLog.getActionDate()),
205 Boolean.valueOf(socialEquityLog.getActive()),
206 new Integer(socialEquityLog.getType())
207 }, socialEquityLog);
208 }
209
210
215 public void cacheResult(List<SocialEquityLog> socialEquityLogs) {
216 for (SocialEquityLog socialEquityLog : socialEquityLogs) {
217 if (EntityCacheUtil.getResult(
218 SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
219 SocialEquityLogImpl.class,
220 socialEquityLog.getPrimaryKey(), this) == null) {
221 cacheResult(socialEquityLog);
222 }
223 }
224 }
225
226
233 public void clearCache() {
234 CacheRegistryUtil.clear(SocialEquityLogImpl.class.getName());
235 EntityCacheUtil.clearCache(SocialEquityLogImpl.class.getName());
236 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
237 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
238 }
239
240
247 public void clearCache(SocialEquityLog socialEquityLog) {
248 EntityCacheUtil.removeResult(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
249 SocialEquityLogImpl.class, socialEquityLog.getPrimaryKey());
250
251 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
252 new Object[] {
253 new Long(socialEquityLog.getUserId()),
254 new Long(socialEquityLog.getAssetEntryId()),
255
256 socialEquityLog.getActionId(),
257 new Integer(socialEquityLog.getActionDate()),
258 Boolean.valueOf(socialEquityLog.getActive()),
259 new Integer(socialEquityLog.getType())
260 });
261 }
262
263
269 public SocialEquityLog create(long equityLogId) {
270 SocialEquityLog socialEquityLog = new SocialEquityLogImpl();
271
272 socialEquityLog.setNew(true);
273 socialEquityLog.setPrimaryKey(equityLogId);
274
275 return socialEquityLog;
276 }
277
278
286 public SocialEquityLog remove(Serializable primaryKey)
287 throws NoSuchModelException, SystemException {
288 return remove(((Long)primaryKey).longValue());
289 }
290
291
299 public SocialEquityLog remove(long equityLogId)
300 throws NoSuchEquityLogException, SystemException {
301 Session session = null;
302
303 try {
304 session = openSession();
305
306 SocialEquityLog socialEquityLog = (SocialEquityLog)session.get(SocialEquityLogImpl.class,
307 new Long(equityLogId));
308
309 if (socialEquityLog == null) {
310 if (_log.isWarnEnabled()) {
311 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + equityLogId);
312 }
313
314 throw new NoSuchEquityLogException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
315 equityLogId);
316 }
317
318 return remove(socialEquityLog);
319 }
320 catch (NoSuchEquityLogException nsee) {
321 throw nsee;
322 }
323 catch (Exception e) {
324 throw processException(e);
325 }
326 finally {
327 closeSession(session);
328 }
329 }
330
331 protected SocialEquityLog removeImpl(SocialEquityLog socialEquityLog)
332 throws SystemException {
333 socialEquityLog = toUnwrappedModel(socialEquityLog);
334
335 Session session = null;
336
337 try {
338 session = openSession();
339
340 if (socialEquityLog.isCachedModel() ||
341 BatchSessionUtil.isEnabled()) {
342 Object staleObject = session.get(SocialEquityLogImpl.class,
343 socialEquityLog.getPrimaryKeyObj());
344
345 if (staleObject != null) {
346 session.evict(staleObject);
347 }
348 }
349
350 session.delete(socialEquityLog);
351
352 session.flush();
353 }
354 catch (Exception e) {
355 throw processException(e);
356 }
357 finally {
358 closeSession(session);
359 }
360
361 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
362
363 SocialEquityLogModelImpl socialEquityLogModelImpl = (SocialEquityLogModelImpl)socialEquityLog;
364
365 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
366 new Object[] {
367 new Long(socialEquityLogModelImpl.getOriginalUserId()),
368 new Long(socialEquityLogModelImpl.getOriginalAssetEntryId()),
369
370 socialEquityLogModelImpl.getOriginalActionId(),
371 new Integer(socialEquityLogModelImpl.getOriginalActionDate()),
372 Boolean.valueOf(socialEquityLogModelImpl.getOriginalActive()),
373 new Integer(socialEquityLogModelImpl.getOriginalType())
374 });
375
376 EntityCacheUtil.removeResult(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
377 SocialEquityLogImpl.class, socialEquityLog.getPrimaryKey());
378
379 return socialEquityLog;
380 }
381
382 public SocialEquityLog updateImpl(
383 com.liferay.portlet.social.model.SocialEquityLog socialEquityLog,
384 boolean merge) throws SystemException {
385 socialEquityLog = toUnwrappedModel(socialEquityLog);
386
387 boolean isNew = socialEquityLog.isNew();
388
389 SocialEquityLogModelImpl socialEquityLogModelImpl = (SocialEquityLogModelImpl)socialEquityLog;
390
391 Session session = null;
392
393 try {
394 session = openSession();
395
396 BatchSessionUtil.update(session, socialEquityLog, merge);
397
398 socialEquityLog.setNew(false);
399 }
400 catch (Exception e) {
401 throw processException(e);
402 }
403 finally {
404 closeSession(session);
405 }
406
407 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
408
409 EntityCacheUtil.putResult(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
410 SocialEquityLogImpl.class, socialEquityLog.getPrimaryKey(),
411 socialEquityLog);
412
413 if (!isNew &&
414 ((socialEquityLog.getUserId() != socialEquityLogModelImpl.getOriginalUserId()) ||
415 (socialEquityLog.getAssetEntryId() != socialEquityLogModelImpl.getOriginalAssetEntryId()) ||
416 !Validator.equals(socialEquityLog.getActionId(),
417 socialEquityLogModelImpl.getOriginalActionId()) ||
418 (socialEquityLog.getActionDate() != socialEquityLogModelImpl.getOriginalActionDate()) ||
419 (socialEquityLog.getActive() != socialEquityLogModelImpl.getOriginalActive()) ||
420 (socialEquityLog.getType() != socialEquityLogModelImpl.getOriginalType()))) {
421 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
422 new Object[] {
423 new Long(socialEquityLogModelImpl.getOriginalUserId()),
424 new Long(socialEquityLogModelImpl.getOriginalAssetEntryId()),
425
426 socialEquityLogModelImpl.getOriginalActionId(),
427 new Integer(socialEquityLogModelImpl.getOriginalActionDate()),
428 Boolean.valueOf(
429 socialEquityLogModelImpl.getOriginalActive()),
430 new Integer(socialEquityLogModelImpl.getOriginalType())
431 });
432 }
433
434 if (isNew ||
435 ((socialEquityLog.getUserId() != socialEquityLogModelImpl.getOriginalUserId()) ||
436 (socialEquityLog.getAssetEntryId() != socialEquityLogModelImpl.getOriginalAssetEntryId()) ||
437 !Validator.equals(socialEquityLog.getActionId(),
438 socialEquityLogModelImpl.getOriginalActionId()) ||
439 (socialEquityLog.getActionDate() != socialEquityLogModelImpl.getOriginalActionDate()) ||
440 (socialEquityLog.getActive() != socialEquityLogModelImpl.getOriginalActive()) ||
441 (socialEquityLog.getType() != socialEquityLogModelImpl.getOriginalType()))) {
442 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
443 new Object[] {
444 new Long(socialEquityLog.getUserId()),
445 new Long(socialEquityLog.getAssetEntryId()),
446
447 socialEquityLog.getActionId(),
448 new Integer(socialEquityLog.getActionDate()),
449 Boolean.valueOf(socialEquityLog.getActive()),
450 new Integer(socialEquityLog.getType())
451 }, socialEquityLog);
452 }
453
454 return socialEquityLog;
455 }
456
457 protected SocialEquityLog toUnwrappedModel(SocialEquityLog socialEquityLog) {
458 if (socialEquityLog instanceof SocialEquityLogImpl) {
459 return socialEquityLog;
460 }
461
462 SocialEquityLogImpl socialEquityLogImpl = new SocialEquityLogImpl();
463
464 socialEquityLogImpl.setNew(socialEquityLog.isNew());
465 socialEquityLogImpl.setPrimaryKey(socialEquityLog.getPrimaryKey());
466
467 socialEquityLogImpl.setEquityLogId(socialEquityLog.getEquityLogId());
468 socialEquityLogImpl.setGroupId(socialEquityLog.getGroupId());
469 socialEquityLogImpl.setCompanyId(socialEquityLog.getCompanyId());
470 socialEquityLogImpl.setUserId(socialEquityLog.getUserId());
471 socialEquityLogImpl.setAssetEntryId(socialEquityLog.getAssetEntryId());
472 socialEquityLogImpl.setActionId(socialEquityLog.getActionId());
473 socialEquityLogImpl.setActionDate(socialEquityLog.getActionDate());
474 socialEquityLogImpl.setActive(socialEquityLog.isActive());
475 socialEquityLogImpl.setExpiration(socialEquityLog.getExpiration());
476 socialEquityLogImpl.setType(socialEquityLog.getType());
477 socialEquityLogImpl.setValue(socialEquityLog.getValue());
478
479 return socialEquityLogImpl;
480 }
481
482
490 public SocialEquityLog findByPrimaryKey(Serializable primaryKey)
491 throws NoSuchModelException, SystemException {
492 return findByPrimaryKey(((Long)primaryKey).longValue());
493 }
494
495
503 public SocialEquityLog findByPrimaryKey(long equityLogId)
504 throws NoSuchEquityLogException, SystemException {
505 SocialEquityLog socialEquityLog = fetchByPrimaryKey(equityLogId);
506
507 if (socialEquityLog == null) {
508 if (_log.isWarnEnabled()) {
509 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + equityLogId);
510 }
511
512 throw new NoSuchEquityLogException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
513 equityLogId);
514 }
515
516 return socialEquityLog;
517 }
518
519
526 public SocialEquityLog fetchByPrimaryKey(Serializable primaryKey)
527 throws SystemException {
528 return fetchByPrimaryKey(((Long)primaryKey).longValue());
529 }
530
531
538 public SocialEquityLog fetchByPrimaryKey(long equityLogId)
539 throws SystemException {
540 SocialEquityLog socialEquityLog = (SocialEquityLog)EntityCacheUtil.getResult(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
541 SocialEquityLogImpl.class, equityLogId, this);
542
543 if (socialEquityLog == null) {
544 Session session = null;
545
546 try {
547 session = openSession();
548
549 socialEquityLog = (SocialEquityLog)session.get(SocialEquityLogImpl.class,
550 new Long(equityLogId));
551 }
552 catch (Exception e) {
553 throw processException(e);
554 }
555 finally {
556 if (socialEquityLog != null) {
557 cacheResult(socialEquityLog);
558 }
559
560 closeSession(session);
561 }
562 }
563
564 return socialEquityLog;
565 }
566
567
576 public List<SocialEquityLog> findByAEI_T_A(long assetEntryId, int type,
577 boolean active) throws SystemException {
578 return findByAEI_T_A(assetEntryId, type, active, QueryUtil.ALL_POS,
579 QueryUtil.ALL_POS, null);
580 }
581
582
597 public List<SocialEquityLog> findByAEI_T_A(long assetEntryId, int type,
598 boolean active, int start, int end) throws SystemException {
599 return findByAEI_T_A(assetEntryId, type, active, start, end, null);
600 }
601
602
618 public List<SocialEquityLog> findByAEI_T_A(long assetEntryId, int type,
619 boolean active, int start, int end, OrderByComparator orderByComparator)
620 throws SystemException {
621 Object[] finderArgs = new Object[] {
622 assetEntryId, type, active,
623
624 String.valueOf(start), String.valueOf(end),
625 String.valueOf(orderByComparator)
626 };
627
628 List<SocialEquityLog> list = (List<SocialEquityLog>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_AEI_T_A,
629 finderArgs, this);
630
631 if (list == null) {
632 Session session = null;
633
634 try {
635 session = openSession();
636
637 StringBundler query = null;
638
639 if (orderByComparator != null) {
640 query = new StringBundler(5 +
641 (orderByComparator.getOrderByFields().length * 3));
642 }
643 else {
644 query = new StringBundler(4);
645 }
646
647 query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
648
649 query.append(_FINDER_COLUMN_AEI_T_A_ASSETENTRYID_2);
650
651 query.append(_FINDER_COLUMN_AEI_T_A_TYPE_2);
652
653 query.append(_FINDER_COLUMN_AEI_T_A_ACTIVE_2);
654
655 if (orderByComparator != null) {
656 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
657 orderByComparator);
658 }
659
660 String sql = query.toString();
661
662 Query q = session.createQuery(sql);
663
664 QueryPos qPos = QueryPos.getInstance(q);
665
666 qPos.add(assetEntryId);
667
668 qPos.add(type);
669
670 qPos.add(active);
671
672 list = (List<SocialEquityLog>)QueryUtil.list(q, getDialect(),
673 start, end);
674 }
675 catch (Exception e) {
676 throw processException(e);
677 }
678 finally {
679 if (list == null) {
680 list = new ArrayList<SocialEquityLog>();
681 }
682
683 cacheResult(list);
684
685 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_AEI_T_A,
686 finderArgs, list);
687
688 closeSession(session);
689 }
690 }
691
692 return list;
693 }
694
695
710 public SocialEquityLog findByAEI_T_A_First(long assetEntryId, int type,
711 boolean active, OrderByComparator orderByComparator)
712 throws NoSuchEquityLogException, SystemException {
713 List<SocialEquityLog> list = findByAEI_T_A(assetEntryId, type, active,
714 0, 1, orderByComparator);
715
716 if (list.isEmpty()) {
717 StringBundler msg = new StringBundler(8);
718
719 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
720
721 msg.append("assetEntryId=");
722 msg.append(assetEntryId);
723
724 msg.append(", type=");
725 msg.append(type);
726
727 msg.append(", active=");
728 msg.append(active);
729
730 msg.append(StringPool.CLOSE_CURLY_BRACE);
731
732 throw new NoSuchEquityLogException(msg.toString());
733 }
734 else {
735 return list.get(0);
736 }
737 }
738
739
754 public SocialEquityLog findByAEI_T_A_Last(long assetEntryId, int type,
755 boolean active, OrderByComparator orderByComparator)
756 throws NoSuchEquityLogException, SystemException {
757 int count = countByAEI_T_A(assetEntryId, type, active);
758
759 List<SocialEquityLog> list = findByAEI_T_A(assetEntryId, type, active,
760 count - 1, count, orderByComparator);
761
762 if (list.isEmpty()) {
763 StringBundler msg = new StringBundler(8);
764
765 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
766
767 msg.append("assetEntryId=");
768 msg.append(assetEntryId);
769
770 msg.append(", type=");
771 msg.append(type);
772
773 msg.append(", active=");
774 msg.append(active);
775
776 msg.append(StringPool.CLOSE_CURLY_BRACE);
777
778 throw new NoSuchEquityLogException(msg.toString());
779 }
780 else {
781 return list.get(0);
782 }
783 }
784
785
801 public SocialEquityLog[] findByAEI_T_A_PrevAndNext(long equityLogId,
802 long assetEntryId, int type, boolean active,
803 OrderByComparator orderByComparator)
804 throws NoSuchEquityLogException, SystemException {
805 SocialEquityLog socialEquityLog = findByPrimaryKey(equityLogId);
806
807 Session session = null;
808
809 try {
810 session = openSession();
811
812 SocialEquityLog[] array = new SocialEquityLogImpl[3];
813
814 array[0] = getByAEI_T_A_PrevAndNext(session, socialEquityLog,
815 assetEntryId, type, active, orderByComparator, true);
816
817 array[1] = socialEquityLog;
818
819 array[2] = getByAEI_T_A_PrevAndNext(session, socialEquityLog,
820 assetEntryId, type, active, orderByComparator, false);
821
822 return array;
823 }
824 catch (Exception e) {
825 throw processException(e);
826 }
827 finally {
828 closeSession(session);
829 }
830 }
831
832 protected SocialEquityLog getByAEI_T_A_PrevAndNext(Session session,
833 SocialEquityLog socialEquityLog, long assetEntryId, int type,
834 boolean active, OrderByComparator orderByComparator, boolean previous) {
835 StringBundler query = null;
836
837 if (orderByComparator != null) {
838 query = new StringBundler(6 +
839 (orderByComparator.getOrderByFields().length * 6));
840 }
841 else {
842 query = new StringBundler(3);
843 }
844
845 query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
846
847 query.append(_FINDER_COLUMN_AEI_T_A_ASSETENTRYID_2);
848
849 query.append(_FINDER_COLUMN_AEI_T_A_TYPE_2);
850
851 query.append(_FINDER_COLUMN_AEI_T_A_ACTIVE_2);
852
853 if (orderByComparator != null) {
854 String[] orderByFields = orderByComparator.getOrderByFields();
855
856 if (orderByFields.length > 0) {
857 query.append(WHERE_AND);
858 }
859
860 for (int i = 0; i < orderByFields.length; i++) {
861 query.append(_ORDER_BY_ENTITY_ALIAS);
862 query.append(orderByFields[i]);
863
864 if ((i + 1) < orderByFields.length) {
865 if (orderByComparator.isAscending() ^ previous) {
866 query.append(WHERE_GREATER_THAN_HAS_NEXT);
867 }
868 else {
869 query.append(WHERE_LESSER_THAN_HAS_NEXT);
870 }
871 }
872 else {
873 if (orderByComparator.isAscending() ^ previous) {
874 query.append(WHERE_GREATER_THAN);
875 }
876 else {
877 query.append(WHERE_LESSER_THAN);
878 }
879 }
880 }
881
882 query.append(ORDER_BY_CLAUSE);
883
884 for (int i = 0; i < orderByFields.length; i++) {
885 query.append(_ORDER_BY_ENTITY_ALIAS);
886 query.append(orderByFields[i]);
887
888 if ((i + 1) < orderByFields.length) {
889 if (orderByComparator.isAscending() ^ previous) {
890 query.append(ORDER_BY_ASC_HAS_NEXT);
891 }
892 else {
893 query.append(ORDER_BY_DESC_HAS_NEXT);
894 }
895 }
896 else {
897 if (orderByComparator.isAscending() ^ previous) {
898 query.append(ORDER_BY_ASC);
899 }
900 else {
901 query.append(ORDER_BY_DESC);
902 }
903 }
904 }
905 }
906
907 String sql = query.toString();
908
909 Query q = session.createQuery(sql);
910
911 q.setFirstResult(0);
912 q.setMaxResults(2);
913
914 QueryPos qPos = QueryPos.getInstance(q);
915
916 qPos.add(assetEntryId);
917
918 qPos.add(type);
919
920 qPos.add(active);
921
922 if (orderByComparator != null) {
923 Object[] values = orderByComparator.getOrderByValues(socialEquityLog);
924
925 for (Object value : values) {
926 qPos.add(value);
927 }
928 }
929
930 List<SocialEquityLog> list = q.list();
931
932 if (list.size() == 2) {
933 return list.get(1);
934 }
935 else {
936 return null;
937 }
938 }
939
940
950 public List<SocialEquityLog> findByU_AID_A_T(long userId, String actionId,
951 boolean active, int type) throws SystemException {
952 return findByU_AID_A_T(userId, actionId, active, type,
953 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
954 }
955
956
972 public List<SocialEquityLog> findByU_AID_A_T(long userId, String actionId,
973 boolean active, int type, int start, int end) throws SystemException {
974 return findByU_AID_A_T(userId, actionId, active, type, start, end, null);
975 }
976
977
994 public List<SocialEquityLog> findByU_AID_A_T(long userId, String actionId,
995 boolean active, int type, int start, int end,
996 OrderByComparator orderByComparator) throws SystemException {
997 Object[] finderArgs = new Object[] {
998 userId, actionId, active, type,
999
1000 String.valueOf(start), String.valueOf(end),
1001 String.valueOf(orderByComparator)
1002 };
1003
1004 List<SocialEquityLog> list = (List<SocialEquityLog>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_U_AID_A_T,
1005 finderArgs, this);
1006
1007 if (list == null) {
1008 Session session = null;
1009
1010 try {
1011 session = openSession();
1012
1013 StringBundler query = null;
1014
1015 if (orderByComparator != null) {
1016 query = new StringBundler(6 +
1017 (orderByComparator.getOrderByFields().length * 3));
1018 }
1019 else {
1020 query = new StringBundler(5);
1021 }
1022
1023 query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
1024
1025 query.append(_FINDER_COLUMN_U_AID_A_T_USERID_2);
1026
1027 if (actionId == null) {
1028 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_1);
1029 }
1030 else {
1031 if (actionId.equals(StringPool.BLANK)) {
1032 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_3);
1033 }
1034 else {
1035 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_2);
1036 }
1037 }
1038
1039 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIVE_2);
1040
1041 query.append(_FINDER_COLUMN_U_AID_A_T_TYPE_2);
1042
1043 if (orderByComparator != null) {
1044 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1045 orderByComparator);
1046 }
1047
1048 String sql = query.toString();
1049
1050 Query q = session.createQuery(sql);
1051
1052 QueryPos qPos = QueryPos.getInstance(q);
1053
1054 qPos.add(userId);
1055
1056 if (actionId != null) {
1057 qPos.add(actionId);
1058 }
1059
1060 qPos.add(active);
1061
1062 qPos.add(type);
1063
1064 list = (List<SocialEquityLog>)QueryUtil.list(q, getDialect(),
1065 start, end);
1066 }
1067 catch (Exception e) {
1068 throw processException(e);
1069 }
1070 finally {
1071 if (list == null) {
1072 list = new ArrayList<SocialEquityLog>();
1073 }
1074
1075 cacheResult(list);
1076
1077 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_U_AID_A_T,
1078 finderArgs, list);
1079
1080 closeSession(session);
1081 }
1082 }
1083
1084 return list;
1085 }
1086
1087
1103 public SocialEquityLog findByU_AID_A_T_First(long userId, String actionId,
1104 boolean active, int type, OrderByComparator orderByComparator)
1105 throws NoSuchEquityLogException, SystemException {
1106 List<SocialEquityLog> list = findByU_AID_A_T(userId, actionId, active,
1107 type, 0, 1, orderByComparator);
1108
1109 if (list.isEmpty()) {
1110 StringBundler msg = new StringBundler(10);
1111
1112 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1113
1114 msg.append("userId=");
1115 msg.append(userId);
1116
1117 msg.append(", actionId=");
1118 msg.append(actionId);
1119
1120 msg.append(", active=");
1121 msg.append(active);
1122
1123 msg.append(", type=");
1124 msg.append(type);
1125
1126 msg.append(StringPool.CLOSE_CURLY_BRACE);
1127
1128 throw new NoSuchEquityLogException(msg.toString());
1129 }
1130 else {
1131 return list.get(0);
1132 }
1133 }
1134
1135
1151 public SocialEquityLog findByU_AID_A_T_Last(long userId, String actionId,
1152 boolean active, int type, OrderByComparator orderByComparator)
1153 throws NoSuchEquityLogException, SystemException {
1154 int count = countByU_AID_A_T(userId, actionId, active, type);
1155
1156 List<SocialEquityLog> list = findByU_AID_A_T(userId, actionId, active,
1157 type, count - 1, count, orderByComparator);
1158
1159 if (list.isEmpty()) {
1160 StringBundler msg = new StringBundler(10);
1161
1162 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1163
1164 msg.append("userId=");
1165 msg.append(userId);
1166
1167 msg.append(", actionId=");
1168 msg.append(actionId);
1169
1170 msg.append(", active=");
1171 msg.append(active);
1172
1173 msg.append(", type=");
1174 msg.append(type);
1175
1176 msg.append(StringPool.CLOSE_CURLY_BRACE);
1177
1178 throw new NoSuchEquityLogException(msg.toString());
1179 }
1180 else {
1181 return list.get(0);
1182 }
1183 }
1184
1185
1202 public SocialEquityLog[] findByU_AID_A_T_PrevAndNext(long equityLogId,
1203 long userId, String actionId, boolean active, int type,
1204 OrderByComparator orderByComparator)
1205 throws NoSuchEquityLogException, SystemException {
1206 SocialEquityLog socialEquityLog = findByPrimaryKey(equityLogId);
1207
1208 Session session = null;
1209
1210 try {
1211 session = openSession();
1212
1213 SocialEquityLog[] array = new SocialEquityLogImpl[3];
1214
1215 array[0] = getByU_AID_A_T_PrevAndNext(session, socialEquityLog,
1216 userId, actionId, active, type, orderByComparator, true);
1217
1218 array[1] = socialEquityLog;
1219
1220 array[2] = getByU_AID_A_T_PrevAndNext(session, socialEquityLog,
1221 userId, actionId, active, type, orderByComparator, false);
1222
1223 return array;
1224 }
1225 catch (Exception e) {
1226 throw processException(e);
1227 }
1228 finally {
1229 closeSession(session);
1230 }
1231 }
1232
1233 protected SocialEquityLog getByU_AID_A_T_PrevAndNext(Session session,
1234 SocialEquityLog socialEquityLog, long userId, String actionId,
1235 boolean active, int type, OrderByComparator orderByComparator,
1236 boolean previous) {
1237 StringBundler query = null;
1238
1239 if (orderByComparator != null) {
1240 query = new StringBundler(6 +
1241 (orderByComparator.getOrderByFields().length * 6));
1242 }
1243 else {
1244 query = new StringBundler(3);
1245 }
1246
1247 query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
1248
1249 query.append(_FINDER_COLUMN_U_AID_A_T_USERID_2);
1250
1251 if (actionId == null) {
1252 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_1);
1253 }
1254 else {
1255 if (actionId.equals(StringPool.BLANK)) {
1256 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_3);
1257 }
1258 else {
1259 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_2);
1260 }
1261 }
1262
1263 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIVE_2);
1264
1265 query.append(_FINDER_COLUMN_U_AID_A_T_TYPE_2);
1266
1267 if (orderByComparator != null) {
1268 String[] orderByFields = orderByComparator.getOrderByFields();
1269
1270 if (orderByFields.length > 0) {
1271 query.append(WHERE_AND);
1272 }
1273
1274 for (int i = 0; i < orderByFields.length; i++) {
1275 query.append(_ORDER_BY_ENTITY_ALIAS);
1276 query.append(orderByFields[i]);
1277
1278 if ((i + 1) < orderByFields.length) {
1279 if (orderByComparator.isAscending() ^ previous) {
1280 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1281 }
1282 else {
1283 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1284 }
1285 }
1286 else {
1287 if (orderByComparator.isAscending() ^ previous) {
1288 query.append(WHERE_GREATER_THAN);
1289 }
1290 else {
1291 query.append(WHERE_LESSER_THAN);
1292 }
1293 }
1294 }
1295
1296 query.append(ORDER_BY_CLAUSE);
1297
1298 for (int i = 0; i < orderByFields.length; i++) {
1299 query.append(_ORDER_BY_ENTITY_ALIAS);
1300 query.append(orderByFields[i]);
1301
1302 if ((i + 1) < orderByFields.length) {
1303 if (orderByComparator.isAscending() ^ previous) {
1304 query.append(ORDER_BY_ASC_HAS_NEXT);
1305 }
1306 else {
1307 query.append(ORDER_BY_DESC_HAS_NEXT);
1308 }
1309 }
1310 else {
1311 if (orderByComparator.isAscending() ^ previous) {
1312 query.append(ORDER_BY_ASC);
1313 }
1314 else {
1315 query.append(ORDER_BY_DESC);
1316 }
1317 }
1318 }
1319 }
1320
1321 String sql = query.toString();
1322
1323 Query q = session.createQuery(sql);
1324
1325 q.setFirstResult(0);
1326 q.setMaxResults(2);
1327
1328 QueryPos qPos = QueryPos.getInstance(q);
1329
1330 qPos.add(userId);
1331
1332 if (actionId != null) {
1333 qPos.add(actionId);
1334 }
1335
1336 qPos.add(active);
1337
1338 qPos.add(type);
1339
1340 if (orderByComparator != null) {
1341 Object[] values = orderByComparator.getOrderByValues(socialEquityLog);
1342
1343 for (Object value : values) {
1344 qPos.add(value);
1345 }
1346 }
1347
1348 List<SocialEquityLog> list = q.list();
1349
1350 if (list.size() == 2) {
1351 return list.get(1);
1352 }
1353 else {
1354 return null;
1355 }
1356 }
1357
1358
1368 public List<SocialEquityLog> findByAEI_AID_A_T(long assetEntryId,
1369 String actionId, boolean active, int type) throws SystemException {
1370 return findByAEI_AID_A_T(assetEntryId, actionId, active, type,
1371 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1372 }
1373
1374
1390 public List<SocialEquityLog> findByAEI_AID_A_T(long assetEntryId,
1391 String actionId, boolean active, int type, int start, int end)
1392 throws SystemException {
1393 return findByAEI_AID_A_T(assetEntryId, actionId, active, type, start,
1394 end, null);
1395 }
1396
1397
1414 public List<SocialEquityLog> findByAEI_AID_A_T(long assetEntryId,
1415 String actionId, boolean active, int type, int start, int end,
1416 OrderByComparator orderByComparator) throws SystemException {
1417 Object[] finderArgs = new Object[] {
1418 assetEntryId, actionId, active, type,
1419
1420 String.valueOf(start), String.valueOf(end),
1421 String.valueOf(orderByComparator)
1422 };
1423
1424 List<SocialEquityLog> list = (List<SocialEquityLog>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_AEI_AID_A_T,
1425 finderArgs, this);
1426
1427 if (list == null) {
1428 Session session = null;
1429
1430 try {
1431 session = openSession();
1432
1433 StringBundler query = null;
1434
1435 if (orderByComparator != null) {
1436 query = new StringBundler(6 +
1437 (orderByComparator.getOrderByFields().length * 3));
1438 }
1439 else {
1440 query = new StringBundler(5);
1441 }
1442
1443 query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
1444
1445 query.append(_FINDER_COLUMN_AEI_AID_A_T_ASSETENTRYID_2);
1446
1447 if (actionId == null) {
1448 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_1);
1449 }
1450 else {
1451 if (actionId.equals(StringPool.BLANK)) {
1452 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_3);
1453 }
1454 else {
1455 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_2);
1456 }
1457 }
1458
1459 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIVE_2);
1460
1461 query.append(_FINDER_COLUMN_AEI_AID_A_T_TYPE_2);
1462
1463 if (orderByComparator != null) {
1464 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1465 orderByComparator);
1466 }
1467
1468 String sql = query.toString();
1469
1470 Query q = session.createQuery(sql);
1471
1472 QueryPos qPos = QueryPos.getInstance(q);
1473
1474 qPos.add(assetEntryId);
1475
1476 if (actionId != null) {
1477 qPos.add(actionId);
1478 }
1479
1480 qPos.add(active);
1481
1482 qPos.add(type);
1483
1484 list = (List<SocialEquityLog>)QueryUtil.list(q, getDialect(),
1485 start, end);
1486 }
1487 catch (Exception e) {
1488 throw processException(e);
1489 }
1490 finally {
1491 if (list == null) {
1492 list = new ArrayList<SocialEquityLog>();
1493 }
1494
1495 cacheResult(list);
1496
1497 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_AEI_AID_A_T,
1498 finderArgs, list);
1499
1500 closeSession(session);
1501 }
1502 }
1503
1504 return list;
1505 }
1506
1507
1523 public SocialEquityLog findByAEI_AID_A_T_First(long assetEntryId,
1524 String actionId, boolean active, int type,
1525 OrderByComparator orderByComparator)
1526 throws NoSuchEquityLogException, SystemException {
1527 List<SocialEquityLog> list = findByAEI_AID_A_T(assetEntryId, actionId,
1528 active, type, 0, 1, orderByComparator);
1529
1530 if (list.isEmpty()) {
1531 StringBundler msg = new StringBundler(10);
1532
1533 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1534
1535 msg.append("assetEntryId=");
1536 msg.append(assetEntryId);
1537
1538 msg.append(", actionId=");
1539 msg.append(actionId);
1540
1541 msg.append(", active=");
1542 msg.append(active);
1543
1544 msg.append(", type=");
1545 msg.append(type);
1546
1547 msg.append(StringPool.CLOSE_CURLY_BRACE);
1548
1549 throw new NoSuchEquityLogException(msg.toString());
1550 }
1551 else {
1552 return list.get(0);
1553 }
1554 }
1555
1556
1572 public SocialEquityLog findByAEI_AID_A_T_Last(long assetEntryId,
1573 String actionId, boolean active, int type,
1574 OrderByComparator orderByComparator)
1575 throws NoSuchEquityLogException, SystemException {
1576 int count = countByAEI_AID_A_T(assetEntryId, actionId, active, type);
1577
1578 List<SocialEquityLog> list = findByAEI_AID_A_T(assetEntryId, actionId,
1579 active, type, count - 1, count, orderByComparator);
1580
1581 if (list.isEmpty()) {
1582 StringBundler msg = new StringBundler(10);
1583
1584 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1585
1586 msg.append("assetEntryId=");
1587 msg.append(assetEntryId);
1588
1589 msg.append(", actionId=");
1590 msg.append(actionId);
1591
1592 msg.append(", active=");
1593 msg.append(active);
1594
1595 msg.append(", type=");
1596 msg.append(type);
1597
1598 msg.append(StringPool.CLOSE_CURLY_BRACE);
1599
1600 throw new NoSuchEquityLogException(msg.toString());
1601 }
1602 else {
1603 return list.get(0);
1604 }
1605 }
1606
1607
1624 public SocialEquityLog[] findByAEI_AID_A_T_PrevAndNext(long equityLogId,
1625 long assetEntryId, String actionId, boolean active, int type,
1626 OrderByComparator orderByComparator)
1627 throws NoSuchEquityLogException, SystemException {
1628 SocialEquityLog socialEquityLog = findByPrimaryKey(equityLogId);
1629
1630 Session session = null;
1631
1632 try {
1633 session = openSession();
1634
1635 SocialEquityLog[] array = new SocialEquityLogImpl[3];
1636
1637 array[0] = getByAEI_AID_A_T_PrevAndNext(session, socialEquityLog,
1638 assetEntryId, actionId, active, type, orderByComparator,
1639 true);
1640
1641 array[1] = socialEquityLog;
1642
1643 array[2] = getByAEI_AID_A_T_PrevAndNext(session, socialEquityLog,
1644 assetEntryId, actionId, active, type, orderByComparator,
1645 false);
1646
1647 return array;
1648 }
1649 catch (Exception e) {
1650 throw processException(e);
1651 }
1652 finally {
1653 closeSession(session);
1654 }
1655 }
1656
1657 protected SocialEquityLog getByAEI_AID_A_T_PrevAndNext(Session session,
1658 SocialEquityLog socialEquityLog, long assetEntryId, String actionId,
1659 boolean active, int type, OrderByComparator orderByComparator,
1660 boolean previous) {
1661 StringBundler query = null;
1662
1663 if (orderByComparator != null) {
1664 query = new StringBundler(6 +
1665 (orderByComparator.getOrderByFields().length * 6));
1666 }
1667 else {
1668 query = new StringBundler(3);
1669 }
1670
1671 query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
1672
1673 query.append(_FINDER_COLUMN_AEI_AID_A_T_ASSETENTRYID_2);
1674
1675 if (actionId == null) {
1676 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_1);
1677 }
1678 else {
1679 if (actionId.equals(StringPool.BLANK)) {
1680 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_3);
1681 }
1682 else {
1683 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_2);
1684 }
1685 }
1686
1687 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIVE_2);
1688
1689 query.append(_FINDER_COLUMN_AEI_AID_A_T_TYPE_2);
1690
1691 if (orderByComparator != null) {
1692 String[] orderByFields = orderByComparator.getOrderByFields();
1693
1694 if (orderByFields.length > 0) {
1695 query.append(WHERE_AND);
1696 }
1697
1698 for (int i = 0; i < orderByFields.length; i++) {
1699 query.append(_ORDER_BY_ENTITY_ALIAS);
1700 query.append(orderByFields[i]);
1701
1702 if ((i + 1) < orderByFields.length) {
1703 if (orderByComparator.isAscending() ^ previous) {
1704 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1705 }
1706 else {
1707 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1708 }
1709 }
1710 else {
1711 if (orderByComparator.isAscending() ^ previous) {
1712 query.append(WHERE_GREATER_THAN);
1713 }
1714 else {
1715 query.append(WHERE_LESSER_THAN);
1716 }
1717 }
1718 }
1719
1720 query.append(ORDER_BY_CLAUSE);
1721
1722 for (int i = 0; i < orderByFields.length; i++) {
1723 query.append(_ORDER_BY_ENTITY_ALIAS);
1724 query.append(orderByFields[i]);
1725
1726 if ((i + 1) < orderByFields.length) {
1727 if (orderByComparator.isAscending() ^ previous) {
1728 query.append(ORDER_BY_ASC_HAS_NEXT);
1729 }
1730 else {
1731 query.append(ORDER_BY_DESC_HAS_NEXT);
1732 }
1733 }
1734 else {
1735 if (orderByComparator.isAscending() ^ previous) {
1736 query.append(ORDER_BY_ASC);
1737 }
1738 else {
1739 query.append(ORDER_BY_DESC);
1740 }
1741 }
1742 }
1743 }
1744
1745 String sql = query.toString();
1746
1747 Query q = session.createQuery(sql);
1748
1749 q.setFirstResult(0);
1750 q.setMaxResults(2);
1751
1752 QueryPos qPos = QueryPos.getInstance(q);
1753
1754 qPos.add(assetEntryId);
1755
1756 if (actionId != null) {
1757 qPos.add(actionId);
1758 }
1759
1760 qPos.add(active);
1761
1762 qPos.add(type);
1763
1764 if (orderByComparator != null) {
1765 Object[] values = orderByComparator.getOrderByValues(socialEquityLog);
1766
1767 for (Object value : values) {
1768 qPos.add(value);
1769 }
1770 }
1771
1772 List<SocialEquityLog> list = q.list();
1773
1774 if (list.size() == 2) {
1775 return list.get(1);
1776 }
1777 else {
1778 return null;
1779 }
1780 }
1781
1782
1793 public List<SocialEquityLog> findByU_AID_AD_A_T(long userId,
1794 String actionId, int actionDate, boolean active, int type)
1795 throws SystemException {
1796 return findByU_AID_AD_A_T(userId, actionId, actionDate, active, type,
1797 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1798 }
1799
1800
1817 public List<SocialEquityLog> findByU_AID_AD_A_T(long userId,
1818 String actionId, int actionDate, boolean active, int type, int start,
1819 int end) throws SystemException {
1820 return findByU_AID_AD_A_T(userId, actionId, actionDate, active, type,
1821 start, end, null);
1822 }
1823
1824
1842 public List<SocialEquityLog> findByU_AID_AD_A_T(long userId,
1843 String actionId, int actionDate, boolean active, int type, int start,
1844 int end, OrderByComparator orderByComparator) throws SystemException {
1845 Object[] finderArgs = new Object[] {
1846 userId, actionId, actionDate, active, type,
1847
1848 String.valueOf(start), String.valueOf(end),
1849 String.valueOf(orderByComparator)
1850 };
1851
1852 List<SocialEquityLog> list = (List<SocialEquityLog>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_U_AID_AD_A_T,
1853 finderArgs, this);
1854
1855 if (list == null) {
1856 Session session = null;
1857
1858 try {
1859 session = openSession();
1860
1861 StringBundler query = null;
1862
1863 if (orderByComparator != null) {
1864 query = new StringBundler(7 +
1865 (orderByComparator.getOrderByFields().length * 3));
1866 }
1867 else {
1868 query = new StringBundler(6);
1869 }
1870
1871 query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
1872
1873 query.append(_FINDER_COLUMN_U_AID_AD_A_T_USERID_2);
1874
1875 if (actionId == null) {
1876 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_1);
1877 }
1878 else {
1879 if (actionId.equals(StringPool.BLANK)) {
1880 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_3);
1881 }
1882 else {
1883 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_2);
1884 }
1885 }
1886
1887 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONDATE_2);
1888
1889 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIVE_2);
1890
1891 query.append(_FINDER_COLUMN_U_AID_AD_A_T_TYPE_2);
1892
1893 if (orderByComparator != null) {
1894 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1895 orderByComparator);
1896 }
1897
1898 String sql = query.toString();
1899
1900 Query q = session.createQuery(sql);
1901
1902 QueryPos qPos = QueryPos.getInstance(q);
1903
1904 qPos.add(userId);
1905
1906 if (actionId != null) {
1907 qPos.add(actionId);
1908 }
1909
1910 qPos.add(actionDate);
1911
1912 qPos.add(active);
1913
1914 qPos.add(type);
1915
1916 list = (List<SocialEquityLog>)QueryUtil.list(q, getDialect(),
1917 start, end);
1918 }
1919 catch (Exception e) {
1920 throw processException(e);
1921 }
1922 finally {
1923 if (list == null) {
1924 list = new ArrayList<SocialEquityLog>();
1925 }
1926
1927 cacheResult(list);
1928
1929 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_U_AID_AD_A_T,
1930 finderArgs, list);
1931
1932 closeSession(session);
1933 }
1934 }
1935
1936 return list;
1937 }
1938
1939
1956 public SocialEquityLog findByU_AID_AD_A_T_First(long userId,
1957 String actionId, int actionDate, boolean active, int type,
1958 OrderByComparator orderByComparator)
1959 throws NoSuchEquityLogException, SystemException {
1960 List<SocialEquityLog> list = findByU_AID_AD_A_T(userId, actionId,
1961 actionDate, active, type, 0, 1, orderByComparator);
1962
1963 if (list.isEmpty()) {
1964 StringBundler msg = new StringBundler(12);
1965
1966 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1967
1968 msg.append("userId=");
1969 msg.append(userId);
1970
1971 msg.append(", actionId=");
1972 msg.append(actionId);
1973
1974 msg.append(", actionDate=");
1975 msg.append(actionDate);
1976
1977 msg.append(", active=");
1978 msg.append(active);
1979
1980 msg.append(", type=");
1981 msg.append(type);
1982
1983 msg.append(StringPool.CLOSE_CURLY_BRACE);
1984
1985 throw new NoSuchEquityLogException(msg.toString());
1986 }
1987 else {
1988 return list.get(0);
1989 }
1990 }
1991
1992
2009 public SocialEquityLog findByU_AID_AD_A_T_Last(long userId,
2010 String actionId, int actionDate, boolean active, int type,
2011 OrderByComparator orderByComparator)
2012 throws NoSuchEquityLogException, SystemException {
2013 int count = countByU_AID_AD_A_T(userId, actionId, actionDate, active,
2014 type);
2015
2016 List<SocialEquityLog> list = findByU_AID_AD_A_T(userId, actionId,
2017 actionDate, active, type, count - 1, count, orderByComparator);
2018
2019 if (list.isEmpty()) {
2020 StringBundler msg = new StringBundler(12);
2021
2022 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2023
2024 msg.append("userId=");
2025 msg.append(userId);
2026
2027 msg.append(", actionId=");
2028 msg.append(actionId);
2029
2030 msg.append(", actionDate=");
2031 msg.append(actionDate);
2032
2033 msg.append(", active=");
2034 msg.append(active);
2035
2036 msg.append(", type=");
2037 msg.append(type);
2038
2039 msg.append(StringPool.CLOSE_CURLY_BRACE);
2040
2041 throw new NoSuchEquityLogException(msg.toString());
2042 }
2043 else {
2044 return list.get(0);
2045 }
2046 }
2047
2048
2066 public SocialEquityLog[] findByU_AID_AD_A_T_PrevAndNext(long equityLogId,
2067 long userId, String actionId, int actionDate, boolean active, int type,
2068 OrderByComparator orderByComparator)
2069 throws NoSuchEquityLogException, SystemException {
2070 SocialEquityLog socialEquityLog = findByPrimaryKey(equityLogId);
2071
2072 Session session = null;
2073
2074 try {
2075 session = openSession();
2076
2077 SocialEquityLog[] array = new SocialEquityLogImpl[3];
2078
2079 array[0] = getByU_AID_AD_A_T_PrevAndNext(session, socialEquityLog,
2080 userId, actionId, actionDate, active, type,
2081 orderByComparator, true);
2082
2083 array[1] = socialEquityLog;
2084
2085 array[2] = getByU_AID_AD_A_T_PrevAndNext(session, socialEquityLog,
2086 userId, actionId, actionDate, active, type,
2087 orderByComparator, false);
2088
2089 return array;
2090 }
2091 catch (Exception e) {
2092 throw processException(e);
2093 }
2094 finally {
2095 closeSession(session);
2096 }
2097 }
2098
2099 protected SocialEquityLog getByU_AID_AD_A_T_PrevAndNext(Session session,
2100 SocialEquityLog socialEquityLog, long userId, String actionId,
2101 int actionDate, boolean active, int type,
2102 OrderByComparator orderByComparator, boolean previous) {
2103 StringBundler query = null;
2104
2105 if (orderByComparator != null) {
2106 query = new StringBundler(6 +
2107 (orderByComparator.getOrderByFields().length * 6));
2108 }
2109 else {
2110 query = new StringBundler(3);
2111 }
2112
2113 query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
2114
2115 query.append(_FINDER_COLUMN_U_AID_AD_A_T_USERID_2);
2116
2117 if (actionId == null) {
2118 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_1);
2119 }
2120 else {
2121 if (actionId.equals(StringPool.BLANK)) {
2122 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_3);
2123 }
2124 else {
2125 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_2);
2126 }
2127 }
2128
2129 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONDATE_2);
2130
2131 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIVE_2);
2132
2133 query.append(_FINDER_COLUMN_U_AID_AD_A_T_TYPE_2);
2134
2135 if (orderByComparator != null) {
2136 String[] orderByFields = orderByComparator.getOrderByFields();
2137
2138 if (orderByFields.length > 0) {
2139 query.append(WHERE_AND);
2140 }
2141
2142 for (int i = 0; i < orderByFields.length; i++) {
2143 query.append(_ORDER_BY_ENTITY_ALIAS);
2144 query.append(orderByFields[i]);
2145
2146 if ((i + 1) < orderByFields.length) {
2147 if (orderByComparator.isAscending() ^ previous) {
2148 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2149 }
2150 else {
2151 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2152 }
2153 }
2154 else {
2155 if (orderByComparator.isAscending() ^ previous) {
2156 query.append(WHERE_GREATER_THAN);
2157 }
2158 else {
2159 query.append(WHERE_LESSER_THAN);
2160 }
2161 }
2162 }
2163
2164 query.append(ORDER_BY_CLAUSE);
2165
2166 for (int i = 0; i < orderByFields.length; i++) {
2167 query.append(_ORDER_BY_ENTITY_ALIAS);
2168 query.append(orderByFields[i]);
2169
2170 if ((i + 1) < orderByFields.length) {
2171 if (orderByComparator.isAscending() ^ previous) {
2172 query.append(ORDER_BY_ASC_HAS_NEXT);
2173 }
2174 else {
2175 query.append(ORDER_BY_DESC_HAS_NEXT);
2176 }
2177 }
2178 else {
2179 if (orderByComparator.isAscending() ^ previous) {
2180 query.append(ORDER_BY_ASC);
2181 }
2182 else {
2183 query.append(ORDER_BY_DESC);
2184 }
2185 }
2186 }
2187 }
2188
2189 String sql = query.toString();
2190
2191 Query q = session.createQuery(sql);
2192
2193 q.setFirstResult(0);
2194 q.setMaxResults(2);
2195
2196 QueryPos qPos = QueryPos.getInstance(q);
2197
2198 qPos.add(userId);
2199
2200 if (actionId != null) {
2201 qPos.add(actionId);
2202 }
2203
2204 qPos.add(actionDate);
2205
2206 qPos.add(active);
2207
2208 qPos.add(type);
2209
2210 if (orderByComparator != null) {
2211 Object[] values = orderByComparator.getOrderByValues(socialEquityLog);
2212
2213 for (Object value : values) {
2214 qPos.add(value);
2215 }
2216 }
2217
2218 List<SocialEquityLog> list = q.list();
2219
2220 if (list.size() == 2) {
2221 return list.get(1);
2222 }
2223 else {
2224 return null;
2225 }
2226 }
2227
2228
2239 public List<SocialEquityLog> findByAEI_AID_AD_A_T(long assetEntryId,
2240 String actionId, int actionDate, boolean active, int type)
2241 throws SystemException {
2242 return findByAEI_AID_AD_A_T(assetEntryId, actionId, actionDate, active,
2243 type, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2244 }
2245
2246
2263 public List<SocialEquityLog> findByAEI_AID_AD_A_T(long assetEntryId,
2264 String actionId, int actionDate, boolean active, int type, int start,
2265 int end) throws SystemException {
2266 return findByAEI_AID_AD_A_T(assetEntryId, actionId, actionDate, active,
2267 type, start, end, null);
2268 }
2269
2270
2288 public List<SocialEquityLog> findByAEI_AID_AD_A_T(long assetEntryId,
2289 String actionId, int actionDate, boolean active, int type, int start,
2290 int end, OrderByComparator orderByComparator) throws SystemException {
2291 Object[] finderArgs = new Object[] {
2292 assetEntryId, actionId, actionDate, active, type,
2293
2294 String.valueOf(start), String.valueOf(end),
2295 String.valueOf(orderByComparator)
2296 };
2297
2298 List<SocialEquityLog> list = (List<SocialEquityLog>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_AEI_AID_AD_A_T,
2299 finderArgs, this);
2300
2301 if (list == null) {
2302 Session session = null;
2303
2304 try {
2305 session = openSession();
2306
2307 StringBundler query = null;
2308
2309 if (orderByComparator != null) {
2310 query = new StringBundler(7 +
2311 (orderByComparator.getOrderByFields().length * 3));
2312 }
2313 else {
2314 query = new StringBundler(6);
2315 }
2316
2317 query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
2318
2319 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ASSETENTRYID_2);
2320
2321 if (actionId == null) {
2322 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_1);
2323 }
2324 else {
2325 if (actionId.equals(StringPool.BLANK)) {
2326 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_3);
2327 }
2328 else {
2329 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_2);
2330 }
2331 }
2332
2333 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONDATE_2);
2334
2335 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIVE_2);
2336
2337 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_TYPE_2);
2338
2339 if (orderByComparator != null) {
2340 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2341 orderByComparator);
2342 }
2343
2344 String sql = query.toString();
2345
2346 Query q = session.createQuery(sql);
2347
2348 QueryPos qPos = QueryPos.getInstance(q);
2349
2350 qPos.add(assetEntryId);
2351
2352 if (actionId != null) {
2353 qPos.add(actionId);
2354 }
2355
2356 qPos.add(actionDate);
2357
2358 qPos.add(active);
2359
2360 qPos.add(type);
2361
2362 list = (List<SocialEquityLog>)QueryUtil.list(q, getDialect(),
2363 start, end);
2364 }
2365 catch (Exception e) {
2366 throw processException(e);
2367 }
2368 finally {
2369 if (list == null) {
2370 list = new ArrayList<SocialEquityLog>();
2371 }
2372
2373 cacheResult(list);
2374
2375 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_AEI_AID_AD_A_T,
2376 finderArgs, list);
2377
2378 closeSession(session);
2379 }
2380 }
2381
2382 return list;
2383 }
2384
2385
2402 public SocialEquityLog findByAEI_AID_AD_A_T_First(long assetEntryId,
2403 String actionId, int actionDate, boolean active, int type,
2404 OrderByComparator orderByComparator)
2405 throws NoSuchEquityLogException, SystemException {
2406 List<SocialEquityLog> list = findByAEI_AID_AD_A_T(assetEntryId,
2407 actionId, actionDate, active, type, 0, 1, orderByComparator);
2408
2409 if (list.isEmpty()) {
2410 StringBundler msg = new StringBundler(12);
2411
2412 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2413
2414 msg.append("assetEntryId=");
2415 msg.append(assetEntryId);
2416
2417 msg.append(", actionId=");
2418 msg.append(actionId);
2419
2420 msg.append(", actionDate=");
2421 msg.append(actionDate);
2422
2423 msg.append(", active=");
2424 msg.append(active);
2425
2426 msg.append(", type=");
2427 msg.append(type);
2428
2429 msg.append(StringPool.CLOSE_CURLY_BRACE);
2430
2431 throw new NoSuchEquityLogException(msg.toString());
2432 }
2433 else {
2434 return list.get(0);
2435 }
2436 }
2437
2438
2455 public SocialEquityLog findByAEI_AID_AD_A_T_Last(long assetEntryId,
2456 String actionId, int actionDate, boolean active, int type,
2457 OrderByComparator orderByComparator)
2458 throws NoSuchEquityLogException, SystemException {
2459 int count = countByAEI_AID_AD_A_T(assetEntryId, actionId, actionDate,
2460 active, type);
2461
2462 List<SocialEquityLog> list = findByAEI_AID_AD_A_T(assetEntryId,
2463 actionId, actionDate, active, type, count - 1, count,
2464 orderByComparator);
2465
2466 if (list.isEmpty()) {
2467 StringBundler msg = new StringBundler(12);
2468
2469 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2470
2471 msg.append("assetEntryId=");
2472 msg.append(assetEntryId);
2473
2474 msg.append(", actionId=");
2475 msg.append(actionId);
2476
2477 msg.append(", actionDate=");
2478 msg.append(actionDate);
2479
2480 msg.append(", active=");
2481 msg.append(active);
2482
2483 msg.append(", type=");
2484 msg.append(type);
2485
2486 msg.append(StringPool.CLOSE_CURLY_BRACE);
2487
2488 throw new NoSuchEquityLogException(msg.toString());
2489 }
2490 else {
2491 return list.get(0);
2492 }
2493 }
2494
2495
2513 public SocialEquityLog[] findByAEI_AID_AD_A_T_PrevAndNext(
2514 long equityLogId, long assetEntryId, String actionId, int actionDate,
2515 boolean active, int type, OrderByComparator orderByComparator)
2516 throws NoSuchEquityLogException, SystemException {
2517 SocialEquityLog socialEquityLog = findByPrimaryKey(equityLogId);
2518
2519 Session session = null;
2520
2521 try {
2522 session = openSession();
2523
2524 SocialEquityLog[] array = new SocialEquityLogImpl[3];
2525
2526 array[0] = getByAEI_AID_AD_A_T_PrevAndNext(session,
2527 socialEquityLog, assetEntryId, actionId, actionDate,
2528 active, type, orderByComparator, true);
2529
2530 array[1] = socialEquityLog;
2531
2532 array[2] = getByAEI_AID_AD_A_T_PrevAndNext(session,
2533 socialEquityLog, assetEntryId, actionId, actionDate,
2534 active, type, orderByComparator, false);
2535
2536 return array;
2537 }
2538 catch (Exception e) {
2539 throw processException(e);
2540 }
2541 finally {
2542 closeSession(session);
2543 }
2544 }
2545
2546 protected SocialEquityLog getByAEI_AID_AD_A_T_PrevAndNext(Session session,
2547 SocialEquityLog socialEquityLog, long assetEntryId, String actionId,
2548 int actionDate, boolean active, int type,
2549 OrderByComparator orderByComparator, boolean previous) {
2550 StringBundler query = null;
2551
2552 if (orderByComparator != null) {
2553 query = new StringBundler(6 +
2554 (orderByComparator.getOrderByFields().length * 6));
2555 }
2556 else {
2557 query = new StringBundler(3);
2558 }
2559
2560 query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
2561
2562 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ASSETENTRYID_2);
2563
2564 if (actionId == null) {
2565 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_1);
2566 }
2567 else {
2568 if (actionId.equals(StringPool.BLANK)) {
2569 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_3);
2570 }
2571 else {
2572 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_2);
2573 }
2574 }
2575
2576 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONDATE_2);
2577
2578 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIVE_2);
2579
2580 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_TYPE_2);
2581
2582 if (orderByComparator != null) {
2583 String[] orderByFields = orderByComparator.getOrderByFields();
2584
2585 if (orderByFields.length > 0) {
2586 query.append(WHERE_AND);
2587 }
2588
2589 for (int i = 0; i < orderByFields.length; i++) {
2590 query.append(_ORDER_BY_ENTITY_ALIAS);
2591 query.append(orderByFields[i]);
2592
2593 if ((i + 1) < orderByFields.length) {
2594 if (orderByComparator.isAscending() ^ previous) {
2595 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2596 }
2597 else {
2598 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2599 }
2600 }
2601 else {
2602 if (orderByComparator.isAscending() ^ previous) {
2603 query.append(WHERE_GREATER_THAN);
2604 }
2605 else {
2606 query.append(WHERE_LESSER_THAN);
2607 }
2608 }
2609 }
2610
2611 query.append(ORDER_BY_CLAUSE);
2612
2613 for (int i = 0; i < orderByFields.length; i++) {
2614 query.append(_ORDER_BY_ENTITY_ALIAS);
2615 query.append(orderByFields[i]);
2616
2617 if ((i + 1) < orderByFields.length) {
2618 if (orderByComparator.isAscending() ^ previous) {
2619 query.append(ORDER_BY_ASC_HAS_NEXT);
2620 }
2621 else {
2622 query.append(ORDER_BY_DESC_HAS_NEXT);
2623 }
2624 }
2625 else {
2626 if (orderByComparator.isAscending() ^ previous) {
2627 query.append(ORDER_BY_ASC);
2628 }
2629 else {
2630 query.append(ORDER_BY_DESC);
2631 }
2632 }
2633 }
2634 }
2635
2636 String sql = query.toString();
2637
2638 Query q = session.createQuery(sql);
2639
2640 q.setFirstResult(0);
2641 q.setMaxResults(2);
2642
2643 QueryPos qPos = QueryPos.getInstance(q);
2644
2645 qPos.add(assetEntryId);
2646
2647 if (actionId != null) {
2648 qPos.add(actionId);
2649 }
2650
2651 qPos.add(actionDate);
2652
2653 qPos.add(active);
2654
2655 qPos.add(type);
2656
2657 if (orderByComparator != null) {
2658 Object[] values = orderByComparator.getOrderByValues(socialEquityLog);
2659
2660 for (Object value : values) {
2661 qPos.add(value);
2662 }
2663 }
2664
2665 List<SocialEquityLog> list = q.list();
2666
2667 if (list.size() == 2) {
2668 return list.get(1);
2669 }
2670 else {
2671 return null;
2672 }
2673 }
2674
2675
2688 public SocialEquityLog findByU_AEI_AID_AD_A_T(long userId,
2689 long assetEntryId, String actionId, int actionDate, boolean active,
2690 int type) throws NoSuchEquityLogException, SystemException {
2691 SocialEquityLog socialEquityLog = fetchByU_AEI_AID_AD_A_T(userId,
2692 assetEntryId, actionId, actionDate, active, type);
2693
2694 if (socialEquityLog == null) {
2695 StringBundler msg = new StringBundler(14);
2696
2697 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2698
2699 msg.append("userId=");
2700 msg.append(userId);
2701
2702 msg.append(", assetEntryId=");
2703 msg.append(assetEntryId);
2704
2705 msg.append(", actionId=");
2706 msg.append(actionId);
2707
2708 msg.append(", actionDate=");
2709 msg.append(actionDate);
2710
2711 msg.append(", active=");
2712 msg.append(active);
2713
2714 msg.append(", type=");
2715 msg.append(type);
2716
2717 msg.append(StringPool.CLOSE_CURLY_BRACE);
2718
2719 if (_log.isWarnEnabled()) {
2720 _log.warn(msg.toString());
2721 }
2722
2723 throw new NoSuchEquityLogException(msg.toString());
2724 }
2725
2726 return socialEquityLog;
2727 }
2728
2729
2741 public SocialEquityLog fetchByU_AEI_AID_AD_A_T(long userId,
2742 long assetEntryId, String actionId, int actionDate, boolean active,
2743 int type) throws SystemException {
2744 return fetchByU_AEI_AID_AD_A_T(userId, assetEntryId, actionId,
2745 actionDate, active, type, true);
2746 }
2747
2748
2760 public SocialEquityLog fetchByU_AEI_AID_AD_A_T(long userId,
2761 long assetEntryId, String actionId, int actionDate, boolean active,
2762 int type, boolean retrieveFromCache) throws SystemException {
2763 Object[] finderArgs = new Object[] {
2764 userId, assetEntryId, actionId, actionDate, active, type
2765 };
2766
2767 Object result = null;
2768
2769 if (retrieveFromCache) {
2770 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
2771 finderArgs, this);
2772 }
2773
2774 if (result == null) {
2775 Session session = null;
2776
2777 try {
2778 session = openSession();
2779
2780 StringBundler query = new StringBundler(7);
2781
2782 query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
2783
2784 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_USERID_2);
2785
2786 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ASSETENTRYID_2);
2787
2788 if (actionId == null) {
2789 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_1);
2790 }
2791 else {
2792 if (actionId.equals(StringPool.BLANK)) {
2793 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_3);
2794 }
2795 else {
2796 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_2);
2797 }
2798 }
2799
2800 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONDATE_2);
2801
2802 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIVE_2);
2803
2804 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_TYPE_2);
2805
2806 String sql = query.toString();
2807
2808 Query q = session.createQuery(sql);
2809
2810 QueryPos qPos = QueryPos.getInstance(q);
2811
2812 qPos.add(userId);
2813
2814 qPos.add(assetEntryId);
2815
2816 if (actionId != null) {
2817 qPos.add(actionId);
2818 }
2819
2820 qPos.add(actionDate);
2821
2822 qPos.add(active);
2823
2824 qPos.add(type);
2825
2826 List<SocialEquityLog> list = q.list();
2827
2828 result = list;
2829
2830 SocialEquityLog socialEquityLog = null;
2831
2832 if (list.isEmpty()) {
2833 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
2834 finderArgs, list);
2835 }
2836 else {
2837 socialEquityLog = list.get(0);
2838
2839 cacheResult(socialEquityLog);
2840
2841 if ((socialEquityLog.getUserId() != userId) ||
2842 (socialEquityLog.getAssetEntryId() != assetEntryId) ||
2843 (socialEquityLog.getActionId() == null) ||
2844 !socialEquityLog.getActionId().equals(actionId) ||
2845 (socialEquityLog.getActionDate() != actionDate) ||
2846 (socialEquityLog.getActive() != active) ||
2847 (socialEquityLog.getType() != type)) {
2848 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
2849 finderArgs, socialEquityLog);
2850 }
2851 }
2852
2853 return socialEquityLog;
2854 }
2855 catch (Exception e) {
2856 throw processException(e);
2857 }
2858 finally {
2859 if (result == null) {
2860 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
2861 finderArgs, new ArrayList<SocialEquityLog>());
2862 }
2863
2864 closeSession(session);
2865 }
2866 }
2867 else {
2868 if (result instanceof List<?>) {
2869 return null;
2870 }
2871 else {
2872 return (SocialEquityLog)result;
2873 }
2874 }
2875 }
2876
2877
2883 public List<SocialEquityLog> findAll() throws SystemException {
2884 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2885 }
2886
2887
2899 public List<SocialEquityLog> findAll(int start, int end)
2900 throws SystemException {
2901 return findAll(start, end, null);
2902 }
2903
2904
2917 public List<SocialEquityLog> findAll(int start, int end,
2918 OrderByComparator orderByComparator) throws SystemException {
2919 Object[] finderArgs = new Object[] {
2920 String.valueOf(start), String.valueOf(end),
2921 String.valueOf(orderByComparator)
2922 };
2923
2924 List<SocialEquityLog> list = (List<SocialEquityLog>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2925 finderArgs, this);
2926
2927 if (list == null) {
2928 Session session = null;
2929
2930 try {
2931 session = openSession();
2932
2933 StringBundler query = null;
2934 String sql = null;
2935
2936 if (orderByComparator != null) {
2937 query = new StringBundler(2 +
2938 (orderByComparator.getOrderByFields().length * 3));
2939
2940 query.append(_SQL_SELECT_SOCIALEQUITYLOG);
2941
2942 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2943 orderByComparator);
2944
2945 sql = query.toString();
2946 }
2947 else {
2948 sql = _SQL_SELECT_SOCIALEQUITYLOG;
2949 }
2950
2951 Query q = session.createQuery(sql);
2952
2953 if (orderByComparator == null) {
2954 list = (List<SocialEquityLog>)QueryUtil.list(q,
2955 getDialect(), start, end, false);
2956
2957 Collections.sort(list);
2958 }
2959 else {
2960 list = (List<SocialEquityLog>)QueryUtil.list(q,
2961 getDialect(), start, end);
2962 }
2963 }
2964 catch (Exception e) {
2965 throw processException(e);
2966 }
2967 finally {
2968 if (list == null) {
2969 list = new ArrayList<SocialEquityLog>();
2970 }
2971
2972 cacheResult(list);
2973
2974 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
2975
2976 closeSession(session);
2977 }
2978 }
2979
2980 return list;
2981 }
2982
2983
2991 public void removeByAEI_T_A(long assetEntryId, int type, boolean active)
2992 throws SystemException {
2993 for (SocialEquityLog socialEquityLog : findByAEI_T_A(assetEntryId,
2994 type, active)) {
2995 remove(socialEquityLog);
2996 }
2997 }
2998
2999
3008 public void removeByU_AID_A_T(long userId, String actionId, boolean active,
3009 int type) throws SystemException {
3010 for (SocialEquityLog socialEquityLog : findByU_AID_A_T(userId,
3011 actionId, active, type)) {
3012 remove(socialEquityLog);
3013 }
3014 }
3015
3016
3025 public void removeByAEI_AID_A_T(long assetEntryId, String actionId,
3026 boolean active, int type) throws SystemException {
3027 for (SocialEquityLog socialEquityLog : findByAEI_AID_A_T(assetEntryId,
3028 actionId, active, type)) {
3029 remove(socialEquityLog);
3030 }
3031 }
3032
3033
3043 public void removeByU_AID_AD_A_T(long userId, String actionId,
3044 int actionDate, boolean active, int type) throws SystemException {
3045 for (SocialEquityLog socialEquityLog : findByU_AID_AD_A_T(userId,
3046 actionId, actionDate, active, type)) {
3047 remove(socialEquityLog);
3048 }
3049 }
3050
3051
3061 public void removeByAEI_AID_AD_A_T(long assetEntryId, String actionId,
3062 int actionDate, boolean active, int type) throws SystemException {
3063 for (SocialEquityLog socialEquityLog : findByAEI_AID_AD_A_T(
3064 assetEntryId, actionId, actionDate, active, type)) {
3065 remove(socialEquityLog);
3066 }
3067 }
3068
3069
3080 public void removeByU_AEI_AID_AD_A_T(long userId, long assetEntryId,
3081 String actionId, int actionDate, boolean active, int type)
3082 throws NoSuchEquityLogException, SystemException {
3083 SocialEquityLog socialEquityLog = findByU_AEI_AID_AD_A_T(userId,
3084 assetEntryId, actionId, actionDate, active, type);
3085
3086 remove(socialEquityLog);
3087 }
3088
3089
3094 public void removeAll() throws SystemException {
3095 for (SocialEquityLog socialEquityLog : findAll()) {
3096 remove(socialEquityLog);
3097 }
3098 }
3099
3100
3109 public int countByAEI_T_A(long assetEntryId, int type, boolean active)
3110 throws SystemException {
3111 Object[] finderArgs = new Object[] { assetEntryId, type, active };
3112
3113 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_AEI_T_A,
3114 finderArgs, this);
3115
3116 if (count == null) {
3117 Session session = null;
3118
3119 try {
3120 session = openSession();
3121
3122 StringBundler query = new StringBundler(4);
3123
3124 query.append(_SQL_COUNT_SOCIALEQUITYLOG_WHERE);
3125
3126 query.append(_FINDER_COLUMN_AEI_T_A_ASSETENTRYID_2);
3127
3128 query.append(_FINDER_COLUMN_AEI_T_A_TYPE_2);
3129
3130 query.append(_FINDER_COLUMN_AEI_T_A_ACTIVE_2);
3131
3132 String sql = query.toString();
3133
3134 Query q = session.createQuery(sql);
3135
3136 QueryPos qPos = QueryPos.getInstance(q);
3137
3138 qPos.add(assetEntryId);
3139
3140 qPos.add(type);
3141
3142 qPos.add(active);
3143
3144 count = (Long)q.uniqueResult();
3145 }
3146 catch (Exception e) {
3147 throw processException(e);
3148 }
3149 finally {
3150 if (count == null) {
3151 count = Long.valueOf(0);
3152 }
3153
3154 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_AEI_T_A,
3155 finderArgs, count);
3156
3157 closeSession(session);
3158 }
3159 }
3160
3161 return count.intValue();
3162 }
3163
3164
3174 public int countByU_AID_A_T(long userId, String actionId, boolean active,
3175 int type) throws SystemException {
3176 Object[] finderArgs = new Object[] { userId, actionId, active, type };
3177
3178 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_AID_A_T,
3179 finderArgs, this);
3180
3181 if (count == null) {
3182 Session session = null;
3183
3184 try {
3185 session = openSession();
3186
3187 StringBundler query = new StringBundler(5);
3188
3189 query.append(_SQL_COUNT_SOCIALEQUITYLOG_WHERE);
3190
3191 query.append(_FINDER_COLUMN_U_AID_A_T_USERID_2);
3192
3193 if (actionId == null) {
3194 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_1);
3195 }
3196 else {
3197 if (actionId.equals(StringPool.BLANK)) {
3198 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_3);
3199 }
3200 else {
3201 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_2);
3202 }
3203 }
3204
3205 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIVE_2);
3206
3207 query.append(_FINDER_COLUMN_U_AID_A_T_TYPE_2);
3208
3209 String sql = query.toString();
3210
3211 Query q = session.createQuery(sql);
3212
3213 QueryPos qPos = QueryPos.getInstance(q);
3214
3215 qPos.add(userId);
3216
3217 if (actionId != null) {
3218 qPos.add(actionId);
3219 }
3220
3221 qPos.add(active);
3222
3223 qPos.add(type);
3224
3225 count = (Long)q.uniqueResult();
3226 }
3227 catch (Exception e) {
3228 throw processException(e);
3229 }
3230 finally {
3231 if (count == null) {
3232 count = Long.valueOf(0);
3233 }
3234
3235 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_AID_A_T,
3236 finderArgs, count);
3237
3238 closeSession(session);
3239 }
3240 }
3241
3242 return count.intValue();
3243 }
3244
3245
3255 public int countByAEI_AID_A_T(long assetEntryId, String actionId,
3256 boolean active, int type) throws SystemException {
3257 Object[] finderArgs = new Object[] { assetEntryId, actionId, active, type };
3258
3259 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_AEI_AID_A_T,
3260 finderArgs, this);
3261
3262 if (count == null) {
3263 Session session = null;
3264
3265 try {
3266 session = openSession();
3267
3268 StringBundler query = new StringBundler(5);
3269
3270 query.append(_SQL_COUNT_SOCIALEQUITYLOG_WHERE);
3271
3272 query.append(_FINDER_COLUMN_AEI_AID_A_T_ASSETENTRYID_2);
3273
3274 if (actionId == null) {
3275 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_1);
3276 }
3277 else {
3278 if (actionId.equals(StringPool.BLANK)) {
3279 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_3);
3280 }
3281 else {
3282 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_2);
3283 }
3284 }
3285
3286 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIVE_2);
3287
3288 query.append(_FINDER_COLUMN_AEI_AID_A_T_TYPE_2);
3289
3290 String sql = query.toString();
3291
3292 Query q = session.createQuery(sql);
3293
3294 QueryPos qPos = QueryPos.getInstance(q);
3295
3296 qPos.add(assetEntryId);
3297
3298 if (actionId != null) {
3299 qPos.add(actionId);
3300 }
3301
3302 qPos.add(active);
3303
3304 qPos.add(type);
3305
3306 count = (Long)q.uniqueResult();
3307 }
3308 catch (Exception e) {
3309 throw processException(e);
3310 }
3311 finally {
3312 if (count == null) {
3313 count = Long.valueOf(0);
3314 }
3315
3316 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_AEI_AID_A_T,
3317 finderArgs, count);
3318
3319 closeSession(session);
3320 }
3321 }
3322
3323 return count.intValue();
3324 }
3325
3326
3337 public int countByU_AID_AD_A_T(long userId, String actionId,
3338 int actionDate, boolean active, int type) throws SystemException {
3339 Object[] finderArgs = new Object[] {
3340 userId, actionId, actionDate, active, type
3341 };
3342
3343 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_AID_AD_A_T,
3344 finderArgs, this);
3345
3346 if (count == null) {
3347 Session session = null;
3348
3349 try {
3350 session = openSession();
3351
3352 StringBundler query = new StringBundler(6);
3353
3354 query.append(_SQL_COUNT_SOCIALEQUITYLOG_WHERE);
3355
3356 query.append(_FINDER_COLUMN_U_AID_AD_A_T_USERID_2);
3357
3358 if (actionId == null) {
3359 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_1);
3360 }
3361 else {
3362 if (actionId.equals(StringPool.BLANK)) {
3363 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_3);
3364 }
3365 else {
3366 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_2);
3367 }
3368 }
3369
3370 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONDATE_2);
3371
3372 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIVE_2);
3373
3374 query.append(_FINDER_COLUMN_U_AID_AD_A_T_TYPE_2);
3375
3376 String sql = query.toString();
3377
3378 Query q = session.createQuery(sql);
3379
3380 QueryPos qPos = QueryPos.getInstance(q);
3381
3382 qPos.add(userId);
3383
3384 if (actionId != null) {
3385 qPos.add(actionId);
3386 }
3387
3388 qPos.add(actionDate);
3389
3390 qPos.add(active);
3391
3392 qPos.add(type);
3393
3394 count = (Long)q.uniqueResult();
3395 }
3396 catch (Exception e) {
3397 throw processException(e);
3398 }
3399 finally {
3400 if (count == null) {
3401 count = Long.valueOf(0);
3402 }
3403
3404 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_AID_AD_A_T,
3405 finderArgs, count);
3406
3407 closeSession(session);
3408 }
3409 }
3410
3411 return count.intValue();
3412 }
3413
3414
3425 public int countByAEI_AID_AD_A_T(long assetEntryId, String actionId,
3426 int actionDate, boolean active, int type) throws SystemException {
3427 Object[] finderArgs = new Object[] {
3428 assetEntryId, actionId, actionDate, active, type
3429 };
3430
3431 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_AEI_AID_AD_A_T,
3432 finderArgs, this);
3433
3434 if (count == null) {
3435 Session session = null;
3436
3437 try {
3438 session = openSession();
3439
3440 StringBundler query = new StringBundler(6);
3441
3442 query.append(_SQL_COUNT_SOCIALEQUITYLOG_WHERE);
3443
3444 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ASSETENTRYID_2);
3445
3446 if (actionId == null) {
3447 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_1);
3448 }
3449 else {
3450 if (actionId.equals(StringPool.BLANK)) {
3451 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_3);
3452 }
3453 else {
3454 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_2);
3455 }
3456 }
3457
3458 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONDATE_2);
3459
3460 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIVE_2);
3461
3462 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_TYPE_2);
3463
3464 String sql = query.toString();
3465
3466 Query q = session.createQuery(sql);
3467
3468 QueryPos qPos = QueryPos.getInstance(q);
3469
3470 qPos.add(assetEntryId);
3471
3472 if (actionId != null) {
3473 qPos.add(actionId);
3474 }
3475
3476 qPos.add(actionDate);
3477
3478 qPos.add(active);
3479
3480 qPos.add(type);
3481
3482 count = (Long)q.uniqueResult();
3483 }
3484 catch (Exception e) {
3485 throw processException(e);
3486 }
3487 finally {
3488 if (count == null) {
3489 count = Long.valueOf(0);
3490 }
3491
3492 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_AEI_AID_AD_A_T,
3493 finderArgs, count);
3494
3495 closeSession(session);
3496 }
3497 }
3498
3499 return count.intValue();
3500 }
3501
3502
3514 public int countByU_AEI_AID_AD_A_T(long userId, long assetEntryId,
3515 String actionId, int actionDate, boolean active, int type)
3516 throws SystemException {
3517 Object[] finderArgs = new Object[] {
3518 userId, assetEntryId, actionId, actionDate, active, type
3519 };
3520
3521 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_AEI_AID_AD_A_T,
3522 finderArgs, this);
3523
3524 if (count == null) {
3525 Session session = null;
3526
3527 try {
3528 session = openSession();
3529
3530 StringBundler query = new StringBundler(7);
3531
3532 query.append(_SQL_COUNT_SOCIALEQUITYLOG_WHERE);
3533
3534 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_USERID_2);
3535
3536 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ASSETENTRYID_2);
3537
3538 if (actionId == null) {
3539 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_1);
3540 }
3541 else {
3542 if (actionId.equals(StringPool.BLANK)) {
3543 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_3);
3544 }
3545 else {
3546 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_2);
3547 }
3548 }
3549
3550 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONDATE_2);
3551
3552 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIVE_2);
3553
3554 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_TYPE_2);
3555
3556 String sql = query.toString();
3557
3558 Query q = session.createQuery(sql);
3559
3560 QueryPos qPos = QueryPos.getInstance(q);
3561
3562 qPos.add(userId);
3563
3564 qPos.add(assetEntryId);
3565
3566 if (actionId != null) {
3567 qPos.add(actionId);
3568 }
3569
3570 qPos.add(actionDate);
3571
3572 qPos.add(active);
3573
3574 qPos.add(type);
3575
3576 count = (Long)q.uniqueResult();
3577 }
3578 catch (Exception e) {
3579 throw processException(e);
3580 }
3581 finally {
3582 if (count == null) {
3583 count = Long.valueOf(0);
3584 }
3585
3586 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_AEI_AID_AD_A_T,
3587 finderArgs, count);
3588
3589 closeSession(session);
3590 }
3591 }
3592
3593 return count.intValue();
3594 }
3595
3596
3602 public int countAll() throws SystemException {
3603 Object[] finderArgs = new Object[0];
3604
3605 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3606 finderArgs, this);
3607
3608 if (count == null) {
3609 Session session = null;
3610
3611 try {
3612 session = openSession();
3613
3614 Query q = session.createQuery(_SQL_COUNT_SOCIALEQUITYLOG);
3615
3616 count = (Long)q.uniqueResult();
3617 }
3618 catch (Exception e) {
3619 throw processException(e);
3620 }
3621 finally {
3622 if (count == null) {
3623 count = Long.valueOf(0);
3624 }
3625
3626 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
3627 count);
3628
3629 closeSession(session);
3630 }
3631 }
3632
3633 return count.intValue();
3634 }
3635
3636
3639 public void afterPropertiesSet() {
3640 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3641 com.liferay.portal.util.PropsUtil.get(
3642 "value.object.listener.com.liferay.portlet.social.model.SocialEquityLog")));
3643
3644 if (listenerClassNames.length > 0) {
3645 try {
3646 List<ModelListener<SocialEquityLog>> listenersList = new ArrayList<ModelListener<SocialEquityLog>>();
3647
3648 for (String listenerClassName : listenerClassNames) {
3649 listenersList.add((ModelListener<SocialEquityLog>)InstanceFactory.newInstance(
3650 listenerClassName));
3651 }
3652
3653 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3654 }
3655 catch (Exception e) {
3656 _log.error(e);
3657 }
3658 }
3659 }
3660
3661 @BeanReference(type = SocialActivityPersistence.class)
3662 protected SocialActivityPersistence socialActivityPersistence;
3663 @BeanReference(type = SocialEquityAssetEntryPersistence.class)
3664 protected SocialEquityAssetEntryPersistence socialEquityAssetEntryPersistence;
3665 @BeanReference(type = SocialEquityHistoryPersistence.class)
3666 protected SocialEquityHistoryPersistence socialEquityHistoryPersistence;
3667 @BeanReference(type = SocialEquityLogPersistence.class)
3668 protected SocialEquityLogPersistence socialEquityLogPersistence;
3669 @BeanReference(type = SocialEquitySettingPersistence.class)
3670 protected SocialEquitySettingPersistence socialEquitySettingPersistence;
3671 @BeanReference(type = SocialEquityUserPersistence.class)
3672 protected SocialEquityUserPersistence socialEquityUserPersistence;
3673 @BeanReference(type = SocialRelationPersistence.class)
3674 protected SocialRelationPersistence socialRelationPersistence;
3675 @BeanReference(type = SocialRequestPersistence.class)
3676 protected SocialRequestPersistence socialRequestPersistence;
3677 @BeanReference(type = ResourcePersistence.class)
3678 protected ResourcePersistence resourcePersistence;
3679 @BeanReference(type = UserPersistence.class)
3680 protected UserPersistence userPersistence;
3681 @BeanReference(type = AssetEntryPersistence.class)
3682 protected AssetEntryPersistence assetEntryPersistence;
3683 private static final String _SQL_SELECT_SOCIALEQUITYLOG = "SELECT socialEquityLog FROM SocialEquityLog socialEquityLog";
3684 private static final String _SQL_SELECT_SOCIALEQUITYLOG_WHERE = "SELECT socialEquityLog FROM SocialEquityLog socialEquityLog WHERE ";
3685 private static final String _SQL_COUNT_SOCIALEQUITYLOG = "SELECT COUNT(socialEquityLog) FROM SocialEquityLog socialEquityLog";
3686 private static final String _SQL_COUNT_SOCIALEQUITYLOG_WHERE = "SELECT COUNT(socialEquityLog) FROM SocialEquityLog socialEquityLog WHERE ";
3687 private static final String _FINDER_COLUMN_AEI_T_A_ASSETENTRYID_2 = "socialEquityLog.assetEntryId = ? AND ";
3688 private static final String _FINDER_COLUMN_AEI_T_A_TYPE_2 = "socialEquityLog.type = ? AND ";
3689 private static final String _FINDER_COLUMN_AEI_T_A_ACTIVE_2 = "socialEquityLog.active = ?";
3690 private static final String _FINDER_COLUMN_U_AID_A_T_USERID_2 = "socialEquityLog.userId = ? AND ";
3691 private static final String _FINDER_COLUMN_U_AID_A_T_ACTIONID_1 = "socialEquityLog.actionId IS NULL AND ";
3692 private static final String _FINDER_COLUMN_U_AID_A_T_ACTIONID_2 = "socialEquityLog.actionId = ? AND ";
3693 private static final String _FINDER_COLUMN_U_AID_A_T_ACTIONID_3 = "(socialEquityLog.actionId IS NULL OR socialEquityLog.actionId = ?) AND ";
3694 private static final String _FINDER_COLUMN_U_AID_A_T_ACTIVE_2 = "socialEquityLog.active = ? AND ";
3695 private static final String _FINDER_COLUMN_U_AID_A_T_TYPE_2 = "socialEquityLog.type = ?";
3696 private static final String _FINDER_COLUMN_AEI_AID_A_T_ASSETENTRYID_2 = "socialEquityLog.assetEntryId = ? AND ";
3697 private static final String _FINDER_COLUMN_AEI_AID_A_T_ACTIONID_1 = "socialEquityLog.actionId IS NULL AND ";
3698 private static final String _FINDER_COLUMN_AEI_AID_A_T_ACTIONID_2 = "socialEquityLog.actionId = ? AND ";
3699 private static final String _FINDER_COLUMN_AEI_AID_A_T_ACTIONID_3 = "(socialEquityLog.actionId IS NULL OR socialEquityLog.actionId = ?) AND ";
3700 private static final String _FINDER_COLUMN_AEI_AID_A_T_ACTIVE_2 = "socialEquityLog.active = ? AND ";
3701 private static final String _FINDER_COLUMN_AEI_AID_A_T_TYPE_2 = "socialEquityLog.type = ?";
3702 private static final String _FINDER_COLUMN_U_AID_AD_A_T_USERID_2 = "socialEquityLog.userId = ? AND ";
3703 private static final String _FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_1 = "socialEquityLog.actionId IS NULL AND ";
3704 private static final String _FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_2 = "socialEquityLog.actionId = ? AND ";
3705 private static final String _FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_3 = "(socialEquityLog.actionId IS NULL OR socialEquityLog.actionId = ?) AND ";
3706 private static final String _FINDER_COLUMN_U_AID_AD_A_T_ACTIONDATE_2 = "socialEquityLog.actionDate = ? AND ";
3707 private static final String _FINDER_COLUMN_U_AID_AD_A_T_ACTIVE_2 = "socialEquityLog.active = ? AND ";
3708 private static final String _FINDER_COLUMN_U_AID_AD_A_T_TYPE_2 = "socialEquityLog.type = ?";
3709 private static final String _FINDER_COLUMN_AEI_AID_AD_A_T_ASSETENTRYID_2 = "socialEquityLog.assetEntryId = ? AND ";
3710 private static final String _FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_1 = "socialEquityLog.actionId IS NULL AND ";
3711 private static final String _FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_2 = "socialEquityLog.actionId = ? AND ";
3712 private static final String _FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_3 = "(socialEquityLog.actionId IS NULL OR socialEquityLog.actionId = ?) AND ";
3713 private static final String _FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONDATE_2 = "socialEquityLog.actionDate = ? AND ";
3714 private static final String _FINDER_COLUMN_AEI_AID_AD_A_T_ACTIVE_2 = "socialEquityLog.active = ? AND ";
3715 private static final String _FINDER_COLUMN_AEI_AID_AD_A_T_TYPE_2 = "socialEquityLog.type = ?";
3716 private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_USERID_2 = "socialEquityLog.userId = ? AND ";
3717 private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_ASSETENTRYID_2 = "socialEquityLog.assetEntryId = ? AND ";
3718 private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_1 = "socialEquityLog.actionId IS NULL AND ";
3719 private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_2 = "socialEquityLog.actionId = ? AND ";
3720 private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_3 = "(socialEquityLog.actionId IS NULL OR socialEquityLog.actionId = ?) AND ";
3721 private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONDATE_2 = "socialEquityLog.actionDate = ? AND ";
3722 private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIVE_2 = "socialEquityLog.active = ? AND ";
3723 private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_TYPE_2 = "socialEquityLog.type = ?";
3724 private static final String _ORDER_BY_ENTITY_ALIAS = "socialEquityLog.";
3725 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No SocialEquityLog exists with the primary key ";
3726 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No SocialEquityLog exists with the key {";
3727 private static Log _log = LogFactoryUtil.getLog(SocialEquityLogPersistenceImpl.class);
3728 }