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
061 public class SocialEquityLogPersistenceImpl extends BasePersistenceImpl<SocialEquityLog>
062 implements SocialEquityLogPersistence {
063 public static final String FINDER_CLASS_NAME_ENTITY = SocialEquityLogImpl.class.getName();
064 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
065 ".List";
066 public static final FinderPath FINDER_PATH_FIND_BY_AEI_T_A = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
067 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
068 FINDER_CLASS_NAME_LIST, "findByAEI_T_A",
069 new String[] {
070 Long.class.getName(), Integer.class.getName(),
071 Boolean.class.getName(),
072
073 "java.lang.Integer", "java.lang.Integer",
074 "com.liferay.portal.kernel.util.OrderByComparator"
075 });
076 public static final FinderPath FINDER_PATH_COUNT_BY_AEI_T_A = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
077 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
078 FINDER_CLASS_NAME_LIST, "countByAEI_T_A",
079 new String[] {
080 Long.class.getName(), Integer.class.getName(),
081 Boolean.class.getName()
082 });
083 public static final FinderPath FINDER_PATH_FIND_BY_U_AID_A_T = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
084 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
085 FINDER_CLASS_NAME_LIST, "findByU_AID_A_T",
086 new String[] {
087 Long.class.getName(), String.class.getName(),
088 Boolean.class.getName(), Integer.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_COUNT_BY_U_AID_A_T = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
094 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
095 FINDER_CLASS_NAME_LIST, "countByU_AID_A_T",
096 new String[] {
097 Long.class.getName(), String.class.getName(),
098 Boolean.class.getName(), Integer.class.getName()
099 });
100 public static final FinderPath FINDER_PATH_FIND_BY_AEI_AID_A_T = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
101 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
102 FINDER_CLASS_NAME_LIST, "findByAEI_AID_A_T",
103 new String[] {
104 Long.class.getName(), String.class.getName(),
105 Boolean.class.getName(), Integer.class.getName(),
106
107 "java.lang.Integer", "java.lang.Integer",
108 "com.liferay.portal.kernel.util.OrderByComparator"
109 });
110 public static final FinderPath FINDER_PATH_COUNT_BY_AEI_AID_A_T = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
111 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
112 FINDER_CLASS_NAME_LIST, "countByAEI_AID_A_T",
113 new String[] {
114 Long.class.getName(), String.class.getName(),
115 Boolean.class.getName(), Integer.class.getName()
116 });
117 public static final FinderPath FINDER_PATH_FIND_BY_U_AID_AD_A_T = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
118 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
119 FINDER_CLASS_NAME_LIST, "findByU_AID_AD_A_T",
120 new String[] {
121 Long.class.getName(), String.class.getName(),
122 Integer.class.getName(), Boolean.class.getName(),
123 Integer.class.getName(),
124
125 "java.lang.Integer", "java.lang.Integer",
126 "com.liferay.portal.kernel.util.OrderByComparator"
127 });
128 public static final FinderPath FINDER_PATH_COUNT_BY_U_AID_AD_A_T = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
129 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
130 FINDER_CLASS_NAME_LIST, "countByU_AID_AD_A_T",
131 new String[] {
132 Long.class.getName(), String.class.getName(),
133 Integer.class.getName(), Boolean.class.getName(),
134 Integer.class.getName()
135 });
136 public static final FinderPath FINDER_PATH_FIND_BY_AEI_AID_AD_A_T = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
137 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
138 FINDER_CLASS_NAME_LIST, "findByAEI_AID_AD_A_T",
139 new String[] {
140 Long.class.getName(), String.class.getName(),
141 Integer.class.getName(), Boolean.class.getName(),
142 Integer.class.getName(),
143
144 "java.lang.Integer", "java.lang.Integer",
145 "com.liferay.portal.kernel.util.OrderByComparator"
146 });
147 public static final FinderPath FINDER_PATH_COUNT_BY_AEI_AID_AD_A_T = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
148 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
149 FINDER_CLASS_NAME_LIST, "countByAEI_AID_AD_A_T",
150 new String[] {
151 Long.class.getName(), String.class.getName(),
152 Integer.class.getName(), Boolean.class.getName(),
153 Integer.class.getName()
154 });
155 public static final FinderPath FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
156 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
157 FINDER_CLASS_NAME_ENTITY, "fetchByU_AEI_AID_AD_A_T",
158 new String[] {
159 Long.class.getName(), Long.class.getName(),
160 String.class.getName(), Integer.class.getName(),
161 Boolean.class.getName(), Integer.class.getName()
162 });
163 public static final FinderPath FINDER_PATH_COUNT_BY_U_AEI_AID_AD_A_T = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
164 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
165 FINDER_CLASS_NAME_LIST, "countByU_AEI_AID_AD_A_T",
166 new String[] {
167 Long.class.getName(), Long.class.getName(),
168 String.class.getName(), Integer.class.getName(),
169 Boolean.class.getName(), Integer.class.getName()
170 });
171 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
172 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
173 FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
174 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
175 SocialEquityLogModelImpl.FINDER_CACHE_ENABLED,
176 FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
177
178 public void cacheResult(SocialEquityLog socialEquityLog) {
179 EntityCacheUtil.putResult(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
180 SocialEquityLogImpl.class, socialEquityLog.getPrimaryKey(),
181 socialEquityLog);
182
183 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
184 new Object[] {
185 new Long(socialEquityLog.getUserId()),
186 new Long(socialEquityLog.getAssetEntryId()),
187
188 socialEquityLog.getActionId(),
189 new Integer(socialEquityLog.getActionDate()),
190 Boolean.valueOf(socialEquityLog.getActive()),
191 new Integer(socialEquityLog.getType())
192 }, socialEquityLog);
193 }
194
195 public void cacheResult(List<SocialEquityLog> socialEquityLogs) {
196 for (SocialEquityLog socialEquityLog : socialEquityLogs) {
197 if (EntityCacheUtil.getResult(
198 SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
199 SocialEquityLogImpl.class,
200 socialEquityLog.getPrimaryKey(), this) == null) {
201 cacheResult(socialEquityLog);
202 }
203 }
204 }
205
206 public void clearCache() {
207 CacheRegistryUtil.clear(SocialEquityLogImpl.class.getName());
208 EntityCacheUtil.clearCache(SocialEquityLogImpl.class.getName());
209 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
210 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
211 }
212
213 public void clearCache(SocialEquityLog socialEquityLog) {
214 EntityCacheUtil.removeResult(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
215 SocialEquityLogImpl.class, socialEquityLog.getPrimaryKey());
216
217 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
218 new Object[] {
219 new Long(socialEquityLog.getUserId()),
220 new Long(socialEquityLog.getAssetEntryId()),
221
222 socialEquityLog.getActionId(),
223 new Integer(socialEquityLog.getActionDate()),
224 Boolean.valueOf(socialEquityLog.getActive()),
225 new Integer(socialEquityLog.getType())
226 });
227 }
228
229 public SocialEquityLog create(long equityLogId) {
230 SocialEquityLog socialEquityLog = new SocialEquityLogImpl();
231
232 socialEquityLog.setNew(true);
233 socialEquityLog.setPrimaryKey(equityLogId);
234
235 return socialEquityLog;
236 }
237
238 public SocialEquityLog remove(Serializable primaryKey)
239 throws NoSuchModelException, SystemException {
240 return remove(((Long)primaryKey).longValue());
241 }
242
243 public SocialEquityLog remove(long equityLogId)
244 throws NoSuchEquityLogException, SystemException {
245 Session session = null;
246
247 try {
248 session = openSession();
249
250 SocialEquityLog socialEquityLog = (SocialEquityLog)session.get(SocialEquityLogImpl.class,
251 new Long(equityLogId));
252
253 if (socialEquityLog == null) {
254 if (_log.isWarnEnabled()) {
255 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + equityLogId);
256 }
257
258 throw new NoSuchEquityLogException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
259 equityLogId);
260 }
261
262 return remove(socialEquityLog);
263 }
264 catch (NoSuchEquityLogException nsee) {
265 throw nsee;
266 }
267 catch (Exception e) {
268 throw processException(e);
269 }
270 finally {
271 closeSession(session);
272 }
273 }
274
275 protected SocialEquityLog removeImpl(SocialEquityLog socialEquityLog)
276 throws SystemException {
277 socialEquityLog = toUnwrappedModel(socialEquityLog);
278
279 Session session = null;
280
281 try {
282 session = openSession();
283
284 if (socialEquityLog.isCachedModel() ||
285 BatchSessionUtil.isEnabled()) {
286 Object staleObject = session.get(SocialEquityLogImpl.class,
287 socialEquityLog.getPrimaryKeyObj());
288
289 if (staleObject != null) {
290 session.evict(staleObject);
291 }
292 }
293
294 session.delete(socialEquityLog);
295
296 session.flush();
297 }
298 catch (Exception e) {
299 throw processException(e);
300 }
301 finally {
302 closeSession(session);
303 }
304
305 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
306
307 SocialEquityLogModelImpl socialEquityLogModelImpl = (SocialEquityLogModelImpl)socialEquityLog;
308
309 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
310 new Object[] {
311 new Long(socialEquityLogModelImpl.getOriginalUserId()),
312 new Long(socialEquityLogModelImpl.getOriginalAssetEntryId()),
313
314 socialEquityLogModelImpl.getOriginalActionId(),
315 new Integer(socialEquityLogModelImpl.getOriginalActionDate()),
316 Boolean.valueOf(socialEquityLogModelImpl.getOriginalActive()),
317 new Integer(socialEquityLogModelImpl.getOriginalType())
318 });
319
320 EntityCacheUtil.removeResult(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
321 SocialEquityLogImpl.class, socialEquityLog.getPrimaryKey());
322
323 return socialEquityLog;
324 }
325
326 public SocialEquityLog updateImpl(
327 com.liferay.portlet.social.model.SocialEquityLog socialEquityLog,
328 boolean merge) throws SystemException {
329 socialEquityLog = toUnwrappedModel(socialEquityLog);
330
331 boolean isNew = socialEquityLog.isNew();
332
333 SocialEquityLogModelImpl socialEquityLogModelImpl = (SocialEquityLogModelImpl)socialEquityLog;
334
335 Session session = null;
336
337 try {
338 session = openSession();
339
340 BatchSessionUtil.update(session, socialEquityLog, merge);
341
342 socialEquityLog.setNew(false);
343 }
344 catch (Exception e) {
345 throw processException(e);
346 }
347 finally {
348 closeSession(session);
349 }
350
351 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
352
353 EntityCacheUtil.putResult(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
354 SocialEquityLogImpl.class, socialEquityLog.getPrimaryKey(),
355 socialEquityLog);
356
357 if (!isNew &&
358 ((socialEquityLog.getUserId() != socialEquityLogModelImpl.getOriginalUserId()) ||
359 (socialEquityLog.getAssetEntryId() != socialEquityLogModelImpl.getOriginalAssetEntryId()) ||
360 !Validator.equals(socialEquityLog.getActionId(),
361 socialEquityLogModelImpl.getOriginalActionId()) ||
362 (socialEquityLog.getActionDate() != socialEquityLogModelImpl.getOriginalActionDate()) ||
363 (socialEquityLog.getActive() != socialEquityLogModelImpl.getOriginalActive()) ||
364 (socialEquityLog.getType() != socialEquityLogModelImpl.getOriginalType()))) {
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(
373 socialEquityLogModelImpl.getOriginalActive()),
374 new Integer(socialEquityLogModelImpl.getOriginalType())
375 });
376 }
377
378 if (isNew ||
379 ((socialEquityLog.getUserId() != socialEquityLogModelImpl.getOriginalUserId()) ||
380 (socialEquityLog.getAssetEntryId() != socialEquityLogModelImpl.getOriginalAssetEntryId()) ||
381 !Validator.equals(socialEquityLog.getActionId(),
382 socialEquityLogModelImpl.getOriginalActionId()) ||
383 (socialEquityLog.getActionDate() != socialEquityLogModelImpl.getOriginalActionDate()) ||
384 (socialEquityLog.getActive() != socialEquityLogModelImpl.getOriginalActive()) ||
385 (socialEquityLog.getType() != socialEquityLogModelImpl.getOriginalType()))) {
386 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
387 new Object[] {
388 new Long(socialEquityLog.getUserId()),
389 new Long(socialEquityLog.getAssetEntryId()),
390
391 socialEquityLog.getActionId(),
392 new Integer(socialEquityLog.getActionDate()),
393 Boolean.valueOf(socialEquityLog.getActive()),
394 new Integer(socialEquityLog.getType())
395 }, socialEquityLog);
396 }
397
398 return socialEquityLog;
399 }
400
401 protected SocialEquityLog toUnwrappedModel(SocialEquityLog socialEquityLog) {
402 if (socialEquityLog instanceof SocialEquityLogImpl) {
403 return socialEquityLog;
404 }
405
406 SocialEquityLogImpl socialEquityLogImpl = new SocialEquityLogImpl();
407
408 socialEquityLogImpl.setNew(socialEquityLog.isNew());
409 socialEquityLogImpl.setPrimaryKey(socialEquityLog.getPrimaryKey());
410
411 socialEquityLogImpl.setEquityLogId(socialEquityLog.getEquityLogId());
412 socialEquityLogImpl.setGroupId(socialEquityLog.getGroupId());
413 socialEquityLogImpl.setCompanyId(socialEquityLog.getCompanyId());
414 socialEquityLogImpl.setUserId(socialEquityLog.getUserId());
415 socialEquityLogImpl.setAssetEntryId(socialEquityLog.getAssetEntryId());
416 socialEquityLogImpl.setActionId(socialEquityLog.getActionId());
417 socialEquityLogImpl.setActionDate(socialEquityLog.getActionDate());
418 socialEquityLogImpl.setActive(socialEquityLog.isActive());
419 socialEquityLogImpl.setExpiration(socialEquityLog.getExpiration());
420 socialEquityLogImpl.setType(socialEquityLog.getType());
421 socialEquityLogImpl.setValue(socialEquityLog.getValue());
422
423 return socialEquityLogImpl;
424 }
425
426 public SocialEquityLog findByPrimaryKey(Serializable primaryKey)
427 throws NoSuchModelException, SystemException {
428 return findByPrimaryKey(((Long)primaryKey).longValue());
429 }
430
431 public SocialEquityLog findByPrimaryKey(long equityLogId)
432 throws NoSuchEquityLogException, SystemException {
433 SocialEquityLog socialEquityLog = fetchByPrimaryKey(equityLogId);
434
435 if (socialEquityLog == null) {
436 if (_log.isWarnEnabled()) {
437 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + equityLogId);
438 }
439
440 throw new NoSuchEquityLogException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
441 equityLogId);
442 }
443
444 return socialEquityLog;
445 }
446
447 public SocialEquityLog fetchByPrimaryKey(Serializable primaryKey)
448 throws SystemException {
449 return fetchByPrimaryKey(((Long)primaryKey).longValue());
450 }
451
452 public SocialEquityLog fetchByPrimaryKey(long equityLogId)
453 throws SystemException {
454 SocialEquityLog socialEquityLog = (SocialEquityLog)EntityCacheUtil.getResult(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
455 SocialEquityLogImpl.class, equityLogId, this);
456
457 if (socialEquityLog == null) {
458 Session session = null;
459
460 try {
461 session = openSession();
462
463 socialEquityLog = (SocialEquityLog)session.get(SocialEquityLogImpl.class,
464 new Long(equityLogId));
465 }
466 catch (Exception e) {
467 throw processException(e);
468 }
469 finally {
470 if (socialEquityLog != null) {
471 cacheResult(socialEquityLog);
472 }
473
474 closeSession(session);
475 }
476 }
477
478 return socialEquityLog;
479 }
480
481 public List<SocialEquityLog> findByAEI_T_A(long assetEntryId, int type,
482 boolean active) throws SystemException {
483 return findByAEI_T_A(assetEntryId, type, active, QueryUtil.ALL_POS,
484 QueryUtil.ALL_POS, null);
485 }
486
487 public List<SocialEquityLog> findByAEI_T_A(long assetEntryId, int type,
488 boolean active, int start, int end) throws SystemException {
489 return findByAEI_T_A(assetEntryId, type, active, start, end, null);
490 }
491
492 public List<SocialEquityLog> findByAEI_T_A(long assetEntryId, int type,
493 boolean active, int start, int end, OrderByComparator orderByComparator)
494 throws SystemException {
495 Object[] finderArgs = new Object[] {
496 assetEntryId, type, active,
497
498 String.valueOf(start), String.valueOf(end),
499 String.valueOf(orderByComparator)
500 };
501
502 List<SocialEquityLog> list = (List<SocialEquityLog>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_AEI_T_A,
503 finderArgs, this);
504
505 if (list == null) {
506 Session session = null;
507
508 try {
509 session = openSession();
510
511 StringBundler query = null;
512
513 if (orderByComparator != null) {
514 query = new StringBundler(5 +
515 (orderByComparator.getOrderByFields().length * 3));
516 }
517 else {
518 query = new StringBundler(4);
519 }
520
521 query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
522
523 query.append(_FINDER_COLUMN_AEI_T_A_ASSETENTRYID_2);
524
525 query.append(_FINDER_COLUMN_AEI_T_A_TYPE_2);
526
527 query.append(_FINDER_COLUMN_AEI_T_A_ACTIVE_2);
528
529 if (orderByComparator != null) {
530 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
531 orderByComparator);
532 }
533
534 String sql = query.toString();
535
536 Query q = session.createQuery(sql);
537
538 QueryPos qPos = QueryPos.getInstance(q);
539
540 qPos.add(assetEntryId);
541
542 qPos.add(type);
543
544 qPos.add(active);
545
546 list = (List<SocialEquityLog>)QueryUtil.list(q, getDialect(),
547 start, end);
548 }
549 catch (Exception e) {
550 throw processException(e);
551 }
552 finally {
553 if (list == null) {
554 list = new ArrayList<SocialEquityLog>();
555 }
556
557 cacheResult(list);
558
559 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_AEI_T_A,
560 finderArgs, list);
561
562 closeSession(session);
563 }
564 }
565
566 return list;
567 }
568
569 public SocialEquityLog findByAEI_T_A_First(long assetEntryId, int type,
570 boolean active, OrderByComparator orderByComparator)
571 throws NoSuchEquityLogException, SystemException {
572 List<SocialEquityLog> list = findByAEI_T_A(assetEntryId, type, active,
573 0, 1, orderByComparator);
574
575 if (list.isEmpty()) {
576 StringBundler msg = new StringBundler(8);
577
578 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
579
580 msg.append("assetEntryId=");
581 msg.append(assetEntryId);
582
583 msg.append(", type=");
584 msg.append(type);
585
586 msg.append(", active=");
587 msg.append(active);
588
589 msg.append(StringPool.CLOSE_CURLY_BRACE);
590
591 throw new NoSuchEquityLogException(msg.toString());
592 }
593 else {
594 return list.get(0);
595 }
596 }
597
598 public SocialEquityLog findByAEI_T_A_Last(long assetEntryId, int type,
599 boolean active, OrderByComparator orderByComparator)
600 throws NoSuchEquityLogException, SystemException {
601 int count = countByAEI_T_A(assetEntryId, type, active);
602
603 List<SocialEquityLog> list = findByAEI_T_A(assetEntryId, type, active,
604 count - 1, count, orderByComparator);
605
606 if (list.isEmpty()) {
607 StringBundler msg = new StringBundler(8);
608
609 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
610
611 msg.append("assetEntryId=");
612 msg.append(assetEntryId);
613
614 msg.append(", type=");
615 msg.append(type);
616
617 msg.append(", active=");
618 msg.append(active);
619
620 msg.append(StringPool.CLOSE_CURLY_BRACE);
621
622 throw new NoSuchEquityLogException(msg.toString());
623 }
624 else {
625 return list.get(0);
626 }
627 }
628
629 public SocialEquityLog[] findByAEI_T_A_PrevAndNext(long equityLogId,
630 long assetEntryId, int type, boolean active,
631 OrderByComparator orderByComparator)
632 throws NoSuchEquityLogException, SystemException {
633 SocialEquityLog socialEquityLog = findByPrimaryKey(equityLogId);
634
635 Session session = null;
636
637 try {
638 session = openSession();
639
640 SocialEquityLog[] array = new SocialEquityLogImpl[3];
641
642 array[0] = getByAEI_T_A_PrevAndNext(session, socialEquityLog,
643 assetEntryId, type, active, orderByComparator, true);
644
645 array[1] = socialEquityLog;
646
647 array[2] = getByAEI_T_A_PrevAndNext(session, socialEquityLog,
648 assetEntryId, type, active, orderByComparator, false);
649
650 return array;
651 }
652 catch (Exception e) {
653 throw processException(e);
654 }
655 finally {
656 closeSession(session);
657 }
658 }
659
660 protected SocialEquityLog getByAEI_T_A_PrevAndNext(Session session,
661 SocialEquityLog socialEquityLog, long assetEntryId, int type,
662 boolean active, OrderByComparator orderByComparator, boolean previous) {
663 StringBundler query = null;
664
665 if (orderByComparator != null) {
666 query = new StringBundler(6 +
667 (orderByComparator.getOrderByFields().length * 6));
668 }
669 else {
670 query = new StringBundler(3);
671 }
672
673 query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
674
675 query.append(_FINDER_COLUMN_AEI_T_A_ASSETENTRYID_2);
676
677 query.append(_FINDER_COLUMN_AEI_T_A_TYPE_2);
678
679 query.append(_FINDER_COLUMN_AEI_T_A_ACTIVE_2);
680
681 if (orderByComparator != null) {
682 String[] orderByFields = orderByComparator.getOrderByFields();
683
684 if (orderByFields.length > 0) {
685 query.append(WHERE_AND);
686 }
687
688 for (int i = 0; i < orderByFields.length; i++) {
689 query.append(_ORDER_BY_ENTITY_ALIAS);
690 query.append(orderByFields[i]);
691
692 if ((i + 1) < orderByFields.length) {
693 if (orderByComparator.isAscending() ^ previous) {
694 query.append(WHERE_GREATER_THAN_HAS_NEXT);
695 }
696 else {
697 query.append(WHERE_LESSER_THAN_HAS_NEXT);
698 }
699 }
700 else {
701 if (orderByComparator.isAscending() ^ previous) {
702 query.append(WHERE_GREATER_THAN);
703 }
704 else {
705 query.append(WHERE_LESSER_THAN);
706 }
707 }
708 }
709
710 query.append(ORDER_BY_CLAUSE);
711
712 for (int i = 0; i < orderByFields.length; i++) {
713 query.append(_ORDER_BY_ENTITY_ALIAS);
714 query.append(orderByFields[i]);
715
716 if ((i + 1) < orderByFields.length) {
717 if (orderByComparator.isAscending() ^ previous) {
718 query.append(ORDER_BY_ASC_HAS_NEXT);
719 }
720 else {
721 query.append(ORDER_BY_DESC_HAS_NEXT);
722 }
723 }
724 else {
725 if (orderByComparator.isAscending() ^ previous) {
726 query.append(ORDER_BY_ASC);
727 }
728 else {
729 query.append(ORDER_BY_DESC);
730 }
731 }
732 }
733 }
734
735 String sql = query.toString();
736
737 Query q = session.createQuery(sql);
738
739 q.setFirstResult(0);
740 q.setMaxResults(2);
741
742 QueryPos qPos = QueryPos.getInstance(q);
743
744 qPos.add(assetEntryId);
745
746 qPos.add(type);
747
748 qPos.add(active);
749
750 if (orderByComparator != null) {
751 Object[] values = orderByComparator.getOrderByValues(socialEquityLog);
752
753 for (Object value : values) {
754 qPos.add(value);
755 }
756 }
757
758 List<SocialEquityLog> list = q.list();
759
760 if (list.size() == 2) {
761 return list.get(1);
762 }
763 else {
764 return null;
765 }
766 }
767
768 public List<SocialEquityLog> findByU_AID_A_T(long userId, String actionId,
769 boolean active, int type) throws SystemException {
770 return findByU_AID_A_T(userId, actionId, active, type,
771 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
772 }
773
774 public List<SocialEquityLog> findByU_AID_A_T(long userId, String actionId,
775 boolean active, int type, int start, int end) throws SystemException {
776 return findByU_AID_A_T(userId, actionId, active, type, start, end, null);
777 }
778
779 public List<SocialEquityLog> findByU_AID_A_T(long userId, String actionId,
780 boolean active, int type, int start, int end,
781 OrderByComparator orderByComparator) throws SystemException {
782 Object[] finderArgs = new Object[] {
783 userId, actionId, active, type,
784
785 String.valueOf(start), String.valueOf(end),
786 String.valueOf(orderByComparator)
787 };
788
789 List<SocialEquityLog> list = (List<SocialEquityLog>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_U_AID_A_T,
790 finderArgs, this);
791
792 if (list == null) {
793 Session session = null;
794
795 try {
796 session = openSession();
797
798 StringBundler query = null;
799
800 if (orderByComparator != null) {
801 query = new StringBundler(6 +
802 (orderByComparator.getOrderByFields().length * 3));
803 }
804 else {
805 query = new StringBundler(5);
806 }
807
808 query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
809
810 query.append(_FINDER_COLUMN_U_AID_A_T_USERID_2);
811
812 if (actionId == null) {
813 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_1);
814 }
815 else {
816 if (actionId.equals(StringPool.BLANK)) {
817 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_3);
818 }
819 else {
820 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_2);
821 }
822 }
823
824 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIVE_2);
825
826 query.append(_FINDER_COLUMN_U_AID_A_T_TYPE_2);
827
828 if (orderByComparator != null) {
829 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
830 orderByComparator);
831 }
832
833 String sql = query.toString();
834
835 Query q = session.createQuery(sql);
836
837 QueryPos qPos = QueryPos.getInstance(q);
838
839 qPos.add(userId);
840
841 if (actionId != null) {
842 qPos.add(actionId);
843 }
844
845 qPos.add(active);
846
847 qPos.add(type);
848
849 list = (List<SocialEquityLog>)QueryUtil.list(q, getDialect(),
850 start, end);
851 }
852 catch (Exception e) {
853 throw processException(e);
854 }
855 finally {
856 if (list == null) {
857 list = new ArrayList<SocialEquityLog>();
858 }
859
860 cacheResult(list);
861
862 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_U_AID_A_T,
863 finderArgs, list);
864
865 closeSession(session);
866 }
867 }
868
869 return list;
870 }
871
872 public SocialEquityLog findByU_AID_A_T_First(long userId, String actionId,
873 boolean active, int type, OrderByComparator orderByComparator)
874 throws NoSuchEquityLogException, SystemException {
875 List<SocialEquityLog> list = findByU_AID_A_T(userId, actionId, active,
876 type, 0, 1, orderByComparator);
877
878 if (list.isEmpty()) {
879 StringBundler msg = new StringBundler(10);
880
881 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
882
883 msg.append("userId=");
884 msg.append(userId);
885
886 msg.append(", actionId=");
887 msg.append(actionId);
888
889 msg.append(", active=");
890 msg.append(active);
891
892 msg.append(", type=");
893 msg.append(type);
894
895 msg.append(StringPool.CLOSE_CURLY_BRACE);
896
897 throw new NoSuchEquityLogException(msg.toString());
898 }
899 else {
900 return list.get(0);
901 }
902 }
903
904 public SocialEquityLog findByU_AID_A_T_Last(long userId, String actionId,
905 boolean active, int type, OrderByComparator orderByComparator)
906 throws NoSuchEquityLogException, SystemException {
907 int count = countByU_AID_A_T(userId, actionId, active, type);
908
909 List<SocialEquityLog> list = findByU_AID_A_T(userId, actionId, active,
910 type, count - 1, count, orderByComparator);
911
912 if (list.isEmpty()) {
913 StringBundler msg = new StringBundler(10);
914
915 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
916
917 msg.append("userId=");
918 msg.append(userId);
919
920 msg.append(", actionId=");
921 msg.append(actionId);
922
923 msg.append(", active=");
924 msg.append(active);
925
926 msg.append(", type=");
927 msg.append(type);
928
929 msg.append(StringPool.CLOSE_CURLY_BRACE);
930
931 throw new NoSuchEquityLogException(msg.toString());
932 }
933 else {
934 return list.get(0);
935 }
936 }
937
938 public SocialEquityLog[] findByU_AID_A_T_PrevAndNext(long equityLogId,
939 long userId, String actionId, boolean active, int type,
940 OrderByComparator orderByComparator)
941 throws NoSuchEquityLogException, SystemException {
942 SocialEquityLog socialEquityLog = findByPrimaryKey(equityLogId);
943
944 Session session = null;
945
946 try {
947 session = openSession();
948
949 SocialEquityLog[] array = new SocialEquityLogImpl[3];
950
951 array[0] = getByU_AID_A_T_PrevAndNext(session, socialEquityLog,
952 userId, actionId, active, type, orderByComparator, true);
953
954 array[1] = socialEquityLog;
955
956 array[2] = getByU_AID_A_T_PrevAndNext(session, socialEquityLog,
957 userId, actionId, active, type, orderByComparator, false);
958
959 return array;
960 }
961 catch (Exception e) {
962 throw processException(e);
963 }
964 finally {
965 closeSession(session);
966 }
967 }
968
969 protected SocialEquityLog getByU_AID_A_T_PrevAndNext(Session session,
970 SocialEquityLog socialEquityLog, long userId, String actionId,
971 boolean active, int type, OrderByComparator orderByComparator,
972 boolean previous) {
973 StringBundler query = null;
974
975 if (orderByComparator != null) {
976 query = new StringBundler(6 +
977 (orderByComparator.getOrderByFields().length * 6));
978 }
979 else {
980 query = new StringBundler(3);
981 }
982
983 query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
984
985 query.append(_FINDER_COLUMN_U_AID_A_T_USERID_2);
986
987 if (actionId == null) {
988 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_1);
989 }
990 else {
991 if (actionId.equals(StringPool.BLANK)) {
992 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_3);
993 }
994 else {
995 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_2);
996 }
997 }
998
999 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIVE_2);
1000
1001 query.append(_FINDER_COLUMN_U_AID_A_T_TYPE_2);
1002
1003 if (orderByComparator != null) {
1004 String[] orderByFields = orderByComparator.getOrderByFields();
1005
1006 if (orderByFields.length > 0) {
1007 query.append(WHERE_AND);
1008 }
1009
1010 for (int i = 0; i < orderByFields.length; i++) {
1011 query.append(_ORDER_BY_ENTITY_ALIAS);
1012 query.append(orderByFields[i]);
1013
1014 if ((i + 1) < orderByFields.length) {
1015 if (orderByComparator.isAscending() ^ previous) {
1016 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1017 }
1018 else {
1019 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1020 }
1021 }
1022 else {
1023 if (orderByComparator.isAscending() ^ previous) {
1024 query.append(WHERE_GREATER_THAN);
1025 }
1026 else {
1027 query.append(WHERE_LESSER_THAN);
1028 }
1029 }
1030 }
1031
1032 query.append(ORDER_BY_CLAUSE);
1033
1034 for (int i = 0; i < orderByFields.length; i++) {
1035 query.append(_ORDER_BY_ENTITY_ALIAS);
1036 query.append(orderByFields[i]);
1037
1038 if ((i + 1) < orderByFields.length) {
1039 if (orderByComparator.isAscending() ^ previous) {
1040 query.append(ORDER_BY_ASC_HAS_NEXT);
1041 }
1042 else {
1043 query.append(ORDER_BY_DESC_HAS_NEXT);
1044 }
1045 }
1046 else {
1047 if (orderByComparator.isAscending() ^ previous) {
1048 query.append(ORDER_BY_ASC);
1049 }
1050 else {
1051 query.append(ORDER_BY_DESC);
1052 }
1053 }
1054 }
1055 }
1056
1057 String sql = query.toString();
1058
1059 Query q = session.createQuery(sql);
1060
1061 q.setFirstResult(0);
1062 q.setMaxResults(2);
1063
1064 QueryPos qPos = QueryPos.getInstance(q);
1065
1066 qPos.add(userId);
1067
1068 if (actionId != null) {
1069 qPos.add(actionId);
1070 }
1071
1072 qPos.add(active);
1073
1074 qPos.add(type);
1075
1076 if (orderByComparator != null) {
1077 Object[] values = orderByComparator.getOrderByValues(socialEquityLog);
1078
1079 for (Object value : values) {
1080 qPos.add(value);
1081 }
1082 }
1083
1084 List<SocialEquityLog> list = q.list();
1085
1086 if (list.size() == 2) {
1087 return list.get(1);
1088 }
1089 else {
1090 return null;
1091 }
1092 }
1093
1094 public List<SocialEquityLog> findByAEI_AID_A_T(long assetEntryId,
1095 String actionId, boolean active, int type) throws SystemException {
1096 return findByAEI_AID_A_T(assetEntryId, actionId, active, type,
1097 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1098 }
1099
1100 public List<SocialEquityLog> findByAEI_AID_A_T(long assetEntryId,
1101 String actionId, boolean active, int type, int start, int end)
1102 throws SystemException {
1103 return findByAEI_AID_A_T(assetEntryId, actionId, active, type, start,
1104 end, null);
1105 }
1106
1107 public List<SocialEquityLog> findByAEI_AID_A_T(long assetEntryId,
1108 String actionId, boolean active, int type, int start, int end,
1109 OrderByComparator orderByComparator) throws SystemException {
1110 Object[] finderArgs = new Object[] {
1111 assetEntryId, actionId, active, type,
1112
1113 String.valueOf(start), String.valueOf(end),
1114 String.valueOf(orderByComparator)
1115 };
1116
1117 List<SocialEquityLog> list = (List<SocialEquityLog>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_AEI_AID_A_T,
1118 finderArgs, this);
1119
1120 if (list == null) {
1121 Session session = null;
1122
1123 try {
1124 session = openSession();
1125
1126 StringBundler query = null;
1127
1128 if (orderByComparator != null) {
1129 query = new StringBundler(6 +
1130 (orderByComparator.getOrderByFields().length * 3));
1131 }
1132 else {
1133 query = new StringBundler(5);
1134 }
1135
1136 query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
1137
1138 query.append(_FINDER_COLUMN_AEI_AID_A_T_ASSETENTRYID_2);
1139
1140 if (actionId == null) {
1141 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_1);
1142 }
1143 else {
1144 if (actionId.equals(StringPool.BLANK)) {
1145 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_3);
1146 }
1147 else {
1148 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_2);
1149 }
1150 }
1151
1152 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIVE_2);
1153
1154 query.append(_FINDER_COLUMN_AEI_AID_A_T_TYPE_2);
1155
1156 if (orderByComparator != null) {
1157 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1158 orderByComparator);
1159 }
1160
1161 String sql = query.toString();
1162
1163 Query q = session.createQuery(sql);
1164
1165 QueryPos qPos = QueryPos.getInstance(q);
1166
1167 qPos.add(assetEntryId);
1168
1169 if (actionId != null) {
1170 qPos.add(actionId);
1171 }
1172
1173 qPos.add(active);
1174
1175 qPos.add(type);
1176
1177 list = (List<SocialEquityLog>)QueryUtil.list(q, getDialect(),
1178 start, end);
1179 }
1180 catch (Exception e) {
1181 throw processException(e);
1182 }
1183 finally {
1184 if (list == null) {
1185 list = new ArrayList<SocialEquityLog>();
1186 }
1187
1188 cacheResult(list);
1189
1190 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_AEI_AID_A_T,
1191 finderArgs, list);
1192
1193 closeSession(session);
1194 }
1195 }
1196
1197 return list;
1198 }
1199
1200 public SocialEquityLog findByAEI_AID_A_T_First(long assetEntryId,
1201 String actionId, boolean active, int type,
1202 OrderByComparator orderByComparator)
1203 throws NoSuchEquityLogException, SystemException {
1204 List<SocialEquityLog> list = findByAEI_AID_A_T(assetEntryId, actionId,
1205 active, type, 0, 1, orderByComparator);
1206
1207 if (list.isEmpty()) {
1208 StringBundler msg = new StringBundler(10);
1209
1210 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1211
1212 msg.append("assetEntryId=");
1213 msg.append(assetEntryId);
1214
1215 msg.append(", actionId=");
1216 msg.append(actionId);
1217
1218 msg.append(", active=");
1219 msg.append(active);
1220
1221 msg.append(", type=");
1222 msg.append(type);
1223
1224 msg.append(StringPool.CLOSE_CURLY_BRACE);
1225
1226 throw new NoSuchEquityLogException(msg.toString());
1227 }
1228 else {
1229 return list.get(0);
1230 }
1231 }
1232
1233 public SocialEquityLog findByAEI_AID_A_T_Last(long assetEntryId,
1234 String actionId, boolean active, int type,
1235 OrderByComparator orderByComparator)
1236 throws NoSuchEquityLogException, SystemException {
1237 int count = countByAEI_AID_A_T(assetEntryId, actionId, active, type);
1238
1239 List<SocialEquityLog> list = findByAEI_AID_A_T(assetEntryId, actionId,
1240 active, type, count - 1, count, orderByComparator);
1241
1242 if (list.isEmpty()) {
1243 StringBundler msg = new StringBundler(10);
1244
1245 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1246
1247 msg.append("assetEntryId=");
1248 msg.append(assetEntryId);
1249
1250 msg.append(", actionId=");
1251 msg.append(actionId);
1252
1253 msg.append(", active=");
1254 msg.append(active);
1255
1256 msg.append(", type=");
1257 msg.append(type);
1258
1259 msg.append(StringPool.CLOSE_CURLY_BRACE);
1260
1261 throw new NoSuchEquityLogException(msg.toString());
1262 }
1263 else {
1264 return list.get(0);
1265 }
1266 }
1267
1268 public SocialEquityLog[] findByAEI_AID_A_T_PrevAndNext(long equityLogId,
1269 long assetEntryId, String actionId, boolean active, int type,
1270 OrderByComparator orderByComparator)
1271 throws NoSuchEquityLogException, SystemException {
1272 SocialEquityLog socialEquityLog = findByPrimaryKey(equityLogId);
1273
1274 Session session = null;
1275
1276 try {
1277 session = openSession();
1278
1279 SocialEquityLog[] array = new SocialEquityLogImpl[3];
1280
1281 array[0] = getByAEI_AID_A_T_PrevAndNext(session, socialEquityLog,
1282 assetEntryId, actionId, active, type, orderByComparator,
1283 true);
1284
1285 array[1] = socialEquityLog;
1286
1287 array[2] = getByAEI_AID_A_T_PrevAndNext(session, socialEquityLog,
1288 assetEntryId, actionId, active, type, orderByComparator,
1289 false);
1290
1291 return array;
1292 }
1293 catch (Exception e) {
1294 throw processException(e);
1295 }
1296 finally {
1297 closeSession(session);
1298 }
1299 }
1300
1301 protected SocialEquityLog getByAEI_AID_A_T_PrevAndNext(Session session,
1302 SocialEquityLog socialEquityLog, long assetEntryId, String actionId,
1303 boolean active, int type, OrderByComparator orderByComparator,
1304 boolean previous) {
1305 StringBundler query = null;
1306
1307 if (orderByComparator != null) {
1308 query = new StringBundler(6 +
1309 (orderByComparator.getOrderByFields().length * 6));
1310 }
1311 else {
1312 query = new StringBundler(3);
1313 }
1314
1315 query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
1316
1317 query.append(_FINDER_COLUMN_AEI_AID_A_T_ASSETENTRYID_2);
1318
1319 if (actionId == null) {
1320 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_1);
1321 }
1322 else {
1323 if (actionId.equals(StringPool.BLANK)) {
1324 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_3);
1325 }
1326 else {
1327 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_2);
1328 }
1329 }
1330
1331 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIVE_2);
1332
1333 query.append(_FINDER_COLUMN_AEI_AID_A_T_TYPE_2);
1334
1335 if (orderByComparator != null) {
1336 String[] orderByFields = orderByComparator.getOrderByFields();
1337
1338 if (orderByFields.length > 0) {
1339 query.append(WHERE_AND);
1340 }
1341
1342 for (int i = 0; i < orderByFields.length; i++) {
1343 query.append(_ORDER_BY_ENTITY_ALIAS);
1344 query.append(orderByFields[i]);
1345
1346 if ((i + 1) < orderByFields.length) {
1347 if (orderByComparator.isAscending() ^ previous) {
1348 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1349 }
1350 else {
1351 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1352 }
1353 }
1354 else {
1355 if (orderByComparator.isAscending() ^ previous) {
1356 query.append(WHERE_GREATER_THAN);
1357 }
1358 else {
1359 query.append(WHERE_LESSER_THAN);
1360 }
1361 }
1362 }
1363
1364 query.append(ORDER_BY_CLAUSE);
1365
1366 for (int i = 0; i < orderByFields.length; i++) {
1367 query.append(_ORDER_BY_ENTITY_ALIAS);
1368 query.append(orderByFields[i]);
1369
1370 if ((i + 1) < orderByFields.length) {
1371 if (orderByComparator.isAscending() ^ previous) {
1372 query.append(ORDER_BY_ASC_HAS_NEXT);
1373 }
1374 else {
1375 query.append(ORDER_BY_DESC_HAS_NEXT);
1376 }
1377 }
1378 else {
1379 if (orderByComparator.isAscending() ^ previous) {
1380 query.append(ORDER_BY_ASC);
1381 }
1382 else {
1383 query.append(ORDER_BY_DESC);
1384 }
1385 }
1386 }
1387 }
1388
1389 String sql = query.toString();
1390
1391 Query q = session.createQuery(sql);
1392
1393 q.setFirstResult(0);
1394 q.setMaxResults(2);
1395
1396 QueryPos qPos = QueryPos.getInstance(q);
1397
1398 qPos.add(assetEntryId);
1399
1400 if (actionId != null) {
1401 qPos.add(actionId);
1402 }
1403
1404 qPos.add(active);
1405
1406 qPos.add(type);
1407
1408 if (orderByComparator != null) {
1409 Object[] values = orderByComparator.getOrderByValues(socialEquityLog);
1410
1411 for (Object value : values) {
1412 qPos.add(value);
1413 }
1414 }
1415
1416 List<SocialEquityLog> list = q.list();
1417
1418 if (list.size() == 2) {
1419 return list.get(1);
1420 }
1421 else {
1422 return null;
1423 }
1424 }
1425
1426 public List<SocialEquityLog> findByU_AID_AD_A_T(long userId,
1427 String actionId, int actionDate, boolean active, int type)
1428 throws SystemException {
1429 return findByU_AID_AD_A_T(userId, actionId, actionDate, active, type,
1430 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1431 }
1432
1433 public List<SocialEquityLog> findByU_AID_AD_A_T(long userId,
1434 String actionId, int actionDate, boolean active, int type, int start,
1435 int end) throws SystemException {
1436 return findByU_AID_AD_A_T(userId, actionId, actionDate, active, type,
1437 start, end, null);
1438 }
1439
1440 public List<SocialEquityLog> findByU_AID_AD_A_T(long userId,
1441 String actionId, int actionDate, boolean active, int type, int start,
1442 int end, OrderByComparator orderByComparator) throws SystemException {
1443 Object[] finderArgs = new Object[] {
1444 userId, actionId, actionDate, active, type,
1445
1446 String.valueOf(start), String.valueOf(end),
1447 String.valueOf(orderByComparator)
1448 };
1449
1450 List<SocialEquityLog> list = (List<SocialEquityLog>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_U_AID_AD_A_T,
1451 finderArgs, this);
1452
1453 if (list == null) {
1454 Session session = null;
1455
1456 try {
1457 session = openSession();
1458
1459 StringBundler query = null;
1460
1461 if (orderByComparator != null) {
1462 query = new StringBundler(7 +
1463 (orderByComparator.getOrderByFields().length * 3));
1464 }
1465 else {
1466 query = new StringBundler(6);
1467 }
1468
1469 query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
1470
1471 query.append(_FINDER_COLUMN_U_AID_AD_A_T_USERID_2);
1472
1473 if (actionId == null) {
1474 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_1);
1475 }
1476 else {
1477 if (actionId.equals(StringPool.BLANK)) {
1478 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_3);
1479 }
1480 else {
1481 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_2);
1482 }
1483 }
1484
1485 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONDATE_2);
1486
1487 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIVE_2);
1488
1489 query.append(_FINDER_COLUMN_U_AID_AD_A_T_TYPE_2);
1490
1491 if (orderByComparator != null) {
1492 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1493 orderByComparator);
1494 }
1495
1496 String sql = query.toString();
1497
1498 Query q = session.createQuery(sql);
1499
1500 QueryPos qPos = QueryPos.getInstance(q);
1501
1502 qPos.add(userId);
1503
1504 if (actionId != null) {
1505 qPos.add(actionId);
1506 }
1507
1508 qPos.add(actionDate);
1509
1510 qPos.add(active);
1511
1512 qPos.add(type);
1513
1514 list = (List<SocialEquityLog>)QueryUtil.list(q, getDialect(),
1515 start, end);
1516 }
1517 catch (Exception e) {
1518 throw processException(e);
1519 }
1520 finally {
1521 if (list == null) {
1522 list = new ArrayList<SocialEquityLog>();
1523 }
1524
1525 cacheResult(list);
1526
1527 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_U_AID_AD_A_T,
1528 finderArgs, list);
1529
1530 closeSession(session);
1531 }
1532 }
1533
1534 return list;
1535 }
1536
1537 public SocialEquityLog findByU_AID_AD_A_T_First(long userId,
1538 String actionId, int actionDate, boolean active, int type,
1539 OrderByComparator orderByComparator)
1540 throws NoSuchEquityLogException, SystemException {
1541 List<SocialEquityLog> list = findByU_AID_AD_A_T(userId, actionId,
1542 actionDate, active, type, 0, 1, orderByComparator);
1543
1544 if (list.isEmpty()) {
1545 StringBundler msg = new StringBundler(12);
1546
1547 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1548
1549 msg.append("userId=");
1550 msg.append(userId);
1551
1552 msg.append(", actionId=");
1553 msg.append(actionId);
1554
1555 msg.append(", actionDate=");
1556 msg.append(actionDate);
1557
1558 msg.append(", active=");
1559 msg.append(active);
1560
1561 msg.append(", type=");
1562 msg.append(type);
1563
1564 msg.append(StringPool.CLOSE_CURLY_BRACE);
1565
1566 throw new NoSuchEquityLogException(msg.toString());
1567 }
1568 else {
1569 return list.get(0);
1570 }
1571 }
1572
1573 public SocialEquityLog findByU_AID_AD_A_T_Last(long userId,
1574 String actionId, int actionDate, boolean active, int type,
1575 OrderByComparator orderByComparator)
1576 throws NoSuchEquityLogException, SystemException {
1577 int count = countByU_AID_AD_A_T(userId, actionId, actionDate, active,
1578 type);
1579
1580 List<SocialEquityLog> list = findByU_AID_AD_A_T(userId, actionId,
1581 actionDate, active, type, count - 1, count, orderByComparator);
1582
1583 if (list.isEmpty()) {
1584 StringBundler msg = new StringBundler(12);
1585
1586 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1587
1588 msg.append("userId=");
1589 msg.append(userId);
1590
1591 msg.append(", actionId=");
1592 msg.append(actionId);
1593
1594 msg.append(", actionDate=");
1595 msg.append(actionDate);
1596
1597 msg.append(", active=");
1598 msg.append(active);
1599
1600 msg.append(", type=");
1601 msg.append(type);
1602
1603 msg.append(StringPool.CLOSE_CURLY_BRACE);
1604
1605 throw new NoSuchEquityLogException(msg.toString());
1606 }
1607 else {
1608 return list.get(0);
1609 }
1610 }
1611
1612 public SocialEquityLog[] findByU_AID_AD_A_T_PrevAndNext(long equityLogId,
1613 long userId, String actionId, int actionDate, boolean active, int type,
1614 OrderByComparator orderByComparator)
1615 throws NoSuchEquityLogException, SystemException {
1616 SocialEquityLog socialEquityLog = findByPrimaryKey(equityLogId);
1617
1618 Session session = null;
1619
1620 try {
1621 session = openSession();
1622
1623 SocialEquityLog[] array = new SocialEquityLogImpl[3];
1624
1625 array[0] = getByU_AID_AD_A_T_PrevAndNext(session, socialEquityLog,
1626 userId, actionId, actionDate, active, type,
1627 orderByComparator, true);
1628
1629 array[1] = socialEquityLog;
1630
1631 array[2] = getByU_AID_AD_A_T_PrevAndNext(session, socialEquityLog,
1632 userId, actionId, actionDate, active, type,
1633 orderByComparator, false);
1634
1635 return array;
1636 }
1637 catch (Exception e) {
1638 throw processException(e);
1639 }
1640 finally {
1641 closeSession(session);
1642 }
1643 }
1644
1645 protected SocialEquityLog getByU_AID_AD_A_T_PrevAndNext(Session session,
1646 SocialEquityLog socialEquityLog, long userId, String actionId,
1647 int actionDate, boolean active, int type,
1648 OrderByComparator orderByComparator, boolean previous) {
1649 StringBundler query = null;
1650
1651 if (orderByComparator != null) {
1652 query = new StringBundler(6 +
1653 (orderByComparator.getOrderByFields().length * 6));
1654 }
1655 else {
1656 query = new StringBundler(3);
1657 }
1658
1659 query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
1660
1661 query.append(_FINDER_COLUMN_U_AID_AD_A_T_USERID_2);
1662
1663 if (actionId == null) {
1664 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_1);
1665 }
1666 else {
1667 if (actionId.equals(StringPool.BLANK)) {
1668 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_3);
1669 }
1670 else {
1671 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_2);
1672 }
1673 }
1674
1675 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONDATE_2);
1676
1677 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIVE_2);
1678
1679 query.append(_FINDER_COLUMN_U_AID_AD_A_T_TYPE_2);
1680
1681 if (orderByComparator != null) {
1682 String[] orderByFields = orderByComparator.getOrderByFields();
1683
1684 if (orderByFields.length > 0) {
1685 query.append(WHERE_AND);
1686 }
1687
1688 for (int i = 0; i < orderByFields.length; i++) {
1689 query.append(_ORDER_BY_ENTITY_ALIAS);
1690 query.append(orderByFields[i]);
1691
1692 if ((i + 1) < orderByFields.length) {
1693 if (orderByComparator.isAscending() ^ previous) {
1694 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1695 }
1696 else {
1697 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1698 }
1699 }
1700 else {
1701 if (orderByComparator.isAscending() ^ previous) {
1702 query.append(WHERE_GREATER_THAN);
1703 }
1704 else {
1705 query.append(WHERE_LESSER_THAN);
1706 }
1707 }
1708 }
1709
1710 query.append(ORDER_BY_CLAUSE);
1711
1712 for (int i = 0; i < orderByFields.length; i++) {
1713 query.append(_ORDER_BY_ENTITY_ALIAS);
1714 query.append(orderByFields[i]);
1715
1716 if ((i + 1) < orderByFields.length) {
1717 if (orderByComparator.isAscending() ^ previous) {
1718 query.append(ORDER_BY_ASC_HAS_NEXT);
1719 }
1720 else {
1721 query.append(ORDER_BY_DESC_HAS_NEXT);
1722 }
1723 }
1724 else {
1725 if (orderByComparator.isAscending() ^ previous) {
1726 query.append(ORDER_BY_ASC);
1727 }
1728 else {
1729 query.append(ORDER_BY_DESC);
1730 }
1731 }
1732 }
1733 }
1734
1735 String sql = query.toString();
1736
1737 Query q = session.createQuery(sql);
1738
1739 q.setFirstResult(0);
1740 q.setMaxResults(2);
1741
1742 QueryPos qPos = QueryPos.getInstance(q);
1743
1744 qPos.add(userId);
1745
1746 if (actionId != null) {
1747 qPos.add(actionId);
1748 }
1749
1750 qPos.add(actionDate);
1751
1752 qPos.add(active);
1753
1754 qPos.add(type);
1755
1756 if (orderByComparator != null) {
1757 Object[] values = orderByComparator.getOrderByValues(socialEquityLog);
1758
1759 for (Object value : values) {
1760 qPos.add(value);
1761 }
1762 }
1763
1764 List<SocialEquityLog> list = q.list();
1765
1766 if (list.size() == 2) {
1767 return list.get(1);
1768 }
1769 else {
1770 return null;
1771 }
1772 }
1773
1774 public List<SocialEquityLog> findByAEI_AID_AD_A_T(long assetEntryId,
1775 String actionId, int actionDate, boolean active, int type)
1776 throws SystemException {
1777 return findByAEI_AID_AD_A_T(assetEntryId, actionId, actionDate, active,
1778 type, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1779 }
1780
1781 public List<SocialEquityLog> findByAEI_AID_AD_A_T(long assetEntryId,
1782 String actionId, int actionDate, boolean active, int type, int start,
1783 int end) throws SystemException {
1784 return findByAEI_AID_AD_A_T(assetEntryId, actionId, actionDate, active,
1785 type, start, end, null);
1786 }
1787
1788 public List<SocialEquityLog> findByAEI_AID_AD_A_T(long assetEntryId,
1789 String actionId, int actionDate, boolean active, int type, int start,
1790 int end, OrderByComparator orderByComparator) throws SystemException {
1791 Object[] finderArgs = new Object[] {
1792 assetEntryId, actionId, actionDate, active, type,
1793
1794 String.valueOf(start), String.valueOf(end),
1795 String.valueOf(orderByComparator)
1796 };
1797
1798 List<SocialEquityLog> list = (List<SocialEquityLog>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_AEI_AID_AD_A_T,
1799 finderArgs, this);
1800
1801 if (list == null) {
1802 Session session = null;
1803
1804 try {
1805 session = openSession();
1806
1807 StringBundler query = null;
1808
1809 if (orderByComparator != null) {
1810 query = new StringBundler(7 +
1811 (orderByComparator.getOrderByFields().length * 3));
1812 }
1813 else {
1814 query = new StringBundler(6);
1815 }
1816
1817 query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
1818
1819 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ASSETENTRYID_2);
1820
1821 if (actionId == null) {
1822 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_1);
1823 }
1824 else {
1825 if (actionId.equals(StringPool.BLANK)) {
1826 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_3);
1827 }
1828 else {
1829 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_2);
1830 }
1831 }
1832
1833 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONDATE_2);
1834
1835 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIVE_2);
1836
1837 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_TYPE_2);
1838
1839 if (orderByComparator != null) {
1840 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1841 orderByComparator);
1842 }
1843
1844 String sql = query.toString();
1845
1846 Query q = session.createQuery(sql);
1847
1848 QueryPos qPos = QueryPos.getInstance(q);
1849
1850 qPos.add(assetEntryId);
1851
1852 if (actionId != null) {
1853 qPos.add(actionId);
1854 }
1855
1856 qPos.add(actionDate);
1857
1858 qPos.add(active);
1859
1860 qPos.add(type);
1861
1862 list = (List<SocialEquityLog>)QueryUtil.list(q, getDialect(),
1863 start, end);
1864 }
1865 catch (Exception e) {
1866 throw processException(e);
1867 }
1868 finally {
1869 if (list == null) {
1870 list = new ArrayList<SocialEquityLog>();
1871 }
1872
1873 cacheResult(list);
1874
1875 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_AEI_AID_AD_A_T,
1876 finderArgs, list);
1877
1878 closeSession(session);
1879 }
1880 }
1881
1882 return list;
1883 }
1884
1885 public SocialEquityLog findByAEI_AID_AD_A_T_First(long assetEntryId,
1886 String actionId, int actionDate, boolean active, int type,
1887 OrderByComparator orderByComparator)
1888 throws NoSuchEquityLogException, SystemException {
1889 List<SocialEquityLog> list = findByAEI_AID_AD_A_T(assetEntryId,
1890 actionId, actionDate, active, type, 0, 1, orderByComparator);
1891
1892 if (list.isEmpty()) {
1893 StringBundler msg = new StringBundler(12);
1894
1895 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1896
1897 msg.append("assetEntryId=");
1898 msg.append(assetEntryId);
1899
1900 msg.append(", actionId=");
1901 msg.append(actionId);
1902
1903 msg.append(", actionDate=");
1904 msg.append(actionDate);
1905
1906 msg.append(", active=");
1907 msg.append(active);
1908
1909 msg.append(", type=");
1910 msg.append(type);
1911
1912 msg.append(StringPool.CLOSE_CURLY_BRACE);
1913
1914 throw new NoSuchEquityLogException(msg.toString());
1915 }
1916 else {
1917 return list.get(0);
1918 }
1919 }
1920
1921 public SocialEquityLog findByAEI_AID_AD_A_T_Last(long assetEntryId,
1922 String actionId, int actionDate, boolean active, int type,
1923 OrderByComparator orderByComparator)
1924 throws NoSuchEquityLogException, SystemException {
1925 int count = countByAEI_AID_AD_A_T(assetEntryId, actionId, actionDate,
1926 active, type);
1927
1928 List<SocialEquityLog> list = findByAEI_AID_AD_A_T(assetEntryId,
1929 actionId, actionDate, active, type, count - 1, count,
1930 orderByComparator);
1931
1932 if (list.isEmpty()) {
1933 StringBundler msg = new StringBundler(12);
1934
1935 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1936
1937 msg.append("assetEntryId=");
1938 msg.append(assetEntryId);
1939
1940 msg.append(", actionId=");
1941 msg.append(actionId);
1942
1943 msg.append(", actionDate=");
1944 msg.append(actionDate);
1945
1946 msg.append(", active=");
1947 msg.append(active);
1948
1949 msg.append(", type=");
1950 msg.append(type);
1951
1952 msg.append(StringPool.CLOSE_CURLY_BRACE);
1953
1954 throw new NoSuchEquityLogException(msg.toString());
1955 }
1956 else {
1957 return list.get(0);
1958 }
1959 }
1960
1961 public SocialEquityLog[] findByAEI_AID_AD_A_T_PrevAndNext(
1962 long equityLogId, long assetEntryId, String actionId, int actionDate,
1963 boolean active, int type, OrderByComparator orderByComparator)
1964 throws NoSuchEquityLogException, SystemException {
1965 SocialEquityLog socialEquityLog = findByPrimaryKey(equityLogId);
1966
1967 Session session = null;
1968
1969 try {
1970 session = openSession();
1971
1972 SocialEquityLog[] array = new SocialEquityLogImpl[3];
1973
1974 array[0] = getByAEI_AID_AD_A_T_PrevAndNext(session,
1975 socialEquityLog, assetEntryId, actionId, actionDate,
1976 active, type, orderByComparator, true);
1977
1978 array[1] = socialEquityLog;
1979
1980 array[2] = getByAEI_AID_AD_A_T_PrevAndNext(session,
1981 socialEquityLog, assetEntryId, actionId, actionDate,
1982 active, type, orderByComparator, false);
1983
1984 return array;
1985 }
1986 catch (Exception e) {
1987 throw processException(e);
1988 }
1989 finally {
1990 closeSession(session);
1991 }
1992 }
1993
1994 protected SocialEquityLog getByAEI_AID_AD_A_T_PrevAndNext(Session session,
1995 SocialEquityLog socialEquityLog, long assetEntryId, String actionId,
1996 int actionDate, boolean active, int type,
1997 OrderByComparator orderByComparator, boolean previous) {
1998 StringBundler query = null;
1999
2000 if (orderByComparator != null) {
2001 query = new StringBundler(6 +
2002 (orderByComparator.getOrderByFields().length * 6));
2003 }
2004 else {
2005 query = new StringBundler(3);
2006 }
2007
2008 query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
2009
2010 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ASSETENTRYID_2);
2011
2012 if (actionId == null) {
2013 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_1);
2014 }
2015 else {
2016 if (actionId.equals(StringPool.BLANK)) {
2017 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_3);
2018 }
2019 else {
2020 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_2);
2021 }
2022 }
2023
2024 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONDATE_2);
2025
2026 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIVE_2);
2027
2028 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_TYPE_2);
2029
2030 if (orderByComparator != null) {
2031 String[] orderByFields = orderByComparator.getOrderByFields();
2032
2033 if (orderByFields.length > 0) {
2034 query.append(WHERE_AND);
2035 }
2036
2037 for (int i = 0; i < orderByFields.length; i++) {
2038 query.append(_ORDER_BY_ENTITY_ALIAS);
2039 query.append(orderByFields[i]);
2040
2041 if ((i + 1) < orderByFields.length) {
2042 if (orderByComparator.isAscending() ^ previous) {
2043 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2044 }
2045 else {
2046 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2047 }
2048 }
2049 else {
2050 if (orderByComparator.isAscending() ^ previous) {
2051 query.append(WHERE_GREATER_THAN);
2052 }
2053 else {
2054 query.append(WHERE_LESSER_THAN);
2055 }
2056 }
2057 }
2058
2059 query.append(ORDER_BY_CLAUSE);
2060
2061 for (int i = 0; i < orderByFields.length; i++) {
2062 query.append(_ORDER_BY_ENTITY_ALIAS);
2063 query.append(orderByFields[i]);
2064
2065 if ((i + 1) < orderByFields.length) {
2066 if (orderByComparator.isAscending() ^ previous) {
2067 query.append(ORDER_BY_ASC_HAS_NEXT);
2068 }
2069 else {
2070 query.append(ORDER_BY_DESC_HAS_NEXT);
2071 }
2072 }
2073 else {
2074 if (orderByComparator.isAscending() ^ previous) {
2075 query.append(ORDER_BY_ASC);
2076 }
2077 else {
2078 query.append(ORDER_BY_DESC);
2079 }
2080 }
2081 }
2082 }
2083
2084 String sql = query.toString();
2085
2086 Query q = session.createQuery(sql);
2087
2088 q.setFirstResult(0);
2089 q.setMaxResults(2);
2090
2091 QueryPos qPos = QueryPos.getInstance(q);
2092
2093 qPos.add(assetEntryId);
2094
2095 if (actionId != null) {
2096 qPos.add(actionId);
2097 }
2098
2099 qPos.add(actionDate);
2100
2101 qPos.add(active);
2102
2103 qPos.add(type);
2104
2105 if (orderByComparator != null) {
2106 Object[] values = orderByComparator.getOrderByValues(socialEquityLog);
2107
2108 for (Object value : values) {
2109 qPos.add(value);
2110 }
2111 }
2112
2113 List<SocialEquityLog> list = q.list();
2114
2115 if (list.size() == 2) {
2116 return list.get(1);
2117 }
2118 else {
2119 return null;
2120 }
2121 }
2122
2123 public SocialEquityLog findByU_AEI_AID_AD_A_T(long userId,
2124 long assetEntryId, String actionId, int actionDate, boolean active,
2125 int type) throws NoSuchEquityLogException, SystemException {
2126 SocialEquityLog socialEquityLog = fetchByU_AEI_AID_AD_A_T(userId,
2127 assetEntryId, actionId, actionDate, active, type);
2128
2129 if (socialEquityLog == null) {
2130 StringBundler msg = new StringBundler(14);
2131
2132 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2133
2134 msg.append("userId=");
2135 msg.append(userId);
2136
2137 msg.append(", assetEntryId=");
2138 msg.append(assetEntryId);
2139
2140 msg.append(", actionId=");
2141 msg.append(actionId);
2142
2143 msg.append(", actionDate=");
2144 msg.append(actionDate);
2145
2146 msg.append(", active=");
2147 msg.append(active);
2148
2149 msg.append(", type=");
2150 msg.append(type);
2151
2152 msg.append(StringPool.CLOSE_CURLY_BRACE);
2153
2154 if (_log.isWarnEnabled()) {
2155 _log.warn(msg.toString());
2156 }
2157
2158 throw new NoSuchEquityLogException(msg.toString());
2159 }
2160
2161 return socialEquityLog;
2162 }
2163
2164 public SocialEquityLog fetchByU_AEI_AID_AD_A_T(long userId,
2165 long assetEntryId, String actionId, int actionDate, boolean active,
2166 int type) throws SystemException {
2167 return fetchByU_AEI_AID_AD_A_T(userId, assetEntryId, actionId,
2168 actionDate, active, type, true);
2169 }
2170
2171 public SocialEquityLog fetchByU_AEI_AID_AD_A_T(long userId,
2172 long assetEntryId, String actionId, int actionDate, boolean active,
2173 int type, boolean retrieveFromCache) throws SystemException {
2174 Object[] finderArgs = new Object[] {
2175 userId, assetEntryId, actionId, actionDate, active, type
2176 };
2177
2178 Object result = null;
2179
2180 if (retrieveFromCache) {
2181 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
2182 finderArgs, this);
2183 }
2184
2185 if (result == null) {
2186 Session session = null;
2187
2188 try {
2189 session = openSession();
2190
2191 StringBundler query = new StringBundler(7);
2192
2193 query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
2194
2195 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_USERID_2);
2196
2197 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ASSETENTRYID_2);
2198
2199 if (actionId == null) {
2200 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_1);
2201 }
2202 else {
2203 if (actionId.equals(StringPool.BLANK)) {
2204 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_3);
2205 }
2206 else {
2207 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_2);
2208 }
2209 }
2210
2211 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONDATE_2);
2212
2213 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIVE_2);
2214
2215 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_TYPE_2);
2216
2217 String sql = query.toString();
2218
2219 Query q = session.createQuery(sql);
2220
2221 QueryPos qPos = QueryPos.getInstance(q);
2222
2223 qPos.add(userId);
2224
2225 qPos.add(assetEntryId);
2226
2227 if (actionId != null) {
2228 qPos.add(actionId);
2229 }
2230
2231 qPos.add(actionDate);
2232
2233 qPos.add(active);
2234
2235 qPos.add(type);
2236
2237 List<SocialEquityLog> list = q.list();
2238
2239 result = list;
2240
2241 SocialEquityLog socialEquityLog = null;
2242
2243 if (list.isEmpty()) {
2244 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
2245 finderArgs, list);
2246 }
2247 else {
2248 socialEquityLog = list.get(0);
2249
2250 cacheResult(socialEquityLog);
2251
2252 if ((socialEquityLog.getUserId() != userId) ||
2253 (socialEquityLog.getAssetEntryId() != assetEntryId) ||
2254 (socialEquityLog.getActionId() == null) ||
2255 !socialEquityLog.getActionId().equals(actionId) ||
2256 (socialEquityLog.getActionDate() != actionDate) ||
2257 (socialEquityLog.getActive() != active) ||
2258 (socialEquityLog.getType() != type)) {
2259 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
2260 finderArgs, socialEquityLog);
2261 }
2262 }
2263
2264 return socialEquityLog;
2265 }
2266 catch (Exception e) {
2267 throw processException(e);
2268 }
2269 finally {
2270 if (result == null) {
2271 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
2272 finderArgs, new ArrayList<SocialEquityLog>());
2273 }
2274
2275 closeSession(session);
2276 }
2277 }
2278 else {
2279 if (result instanceof List<?>) {
2280 return null;
2281 }
2282 else {
2283 return (SocialEquityLog)result;
2284 }
2285 }
2286 }
2287
2288 public List<SocialEquityLog> findAll() throws SystemException {
2289 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2290 }
2291
2292 public List<SocialEquityLog> findAll(int start, int end)
2293 throws SystemException {
2294 return findAll(start, end, null);
2295 }
2296
2297 public List<SocialEquityLog> findAll(int start, int end,
2298 OrderByComparator orderByComparator) throws SystemException {
2299 Object[] finderArgs = new Object[] {
2300 String.valueOf(start), String.valueOf(end),
2301 String.valueOf(orderByComparator)
2302 };
2303
2304 List<SocialEquityLog> list = (List<SocialEquityLog>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2305 finderArgs, this);
2306
2307 if (list == null) {
2308 Session session = null;
2309
2310 try {
2311 session = openSession();
2312
2313 StringBundler query = null;
2314 String sql = null;
2315
2316 if (orderByComparator != null) {
2317 query = new StringBundler(2 +
2318 (orderByComparator.getOrderByFields().length * 3));
2319
2320 query.append(_SQL_SELECT_SOCIALEQUITYLOG);
2321
2322 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2323 orderByComparator);
2324
2325 sql = query.toString();
2326 }
2327 else {
2328 sql = _SQL_SELECT_SOCIALEQUITYLOG;
2329 }
2330
2331 Query q = session.createQuery(sql);
2332
2333 if (orderByComparator == null) {
2334 list = (List<SocialEquityLog>)QueryUtil.list(q,
2335 getDialect(), start, end, false);
2336
2337 Collections.sort(list);
2338 }
2339 else {
2340 list = (List<SocialEquityLog>)QueryUtil.list(q,
2341 getDialect(), start, end);
2342 }
2343 }
2344 catch (Exception e) {
2345 throw processException(e);
2346 }
2347 finally {
2348 if (list == null) {
2349 list = new ArrayList<SocialEquityLog>();
2350 }
2351
2352 cacheResult(list);
2353
2354 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
2355
2356 closeSession(session);
2357 }
2358 }
2359
2360 return list;
2361 }
2362
2363 public void removeByAEI_T_A(long assetEntryId, int type, boolean active)
2364 throws SystemException {
2365 for (SocialEquityLog socialEquityLog : findByAEI_T_A(assetEntryId,
2366 type, active)) {
2367 remove(socialEquityLog);
2368 }
2369 }
2370
2371 public void removeByU_AID_A_T(long userId, String actionId, boolean active,
2372 int type) throws SystemException {
2373 for (SocialEquityLog socialEquityLog : findByU_AID_A_T(userId,
2374 actionId, active, type)) {
2375 remove(socialEquityLog);
2376 }
2377 }
2378
2379 public void removeByAEI_AID_A_T(long assetEntryId, String actionId,
2380 boolean active, int type) throws SystemException {
2381 for (SocialEquityLog socialEquityLog : findByAEI_AID_A_T(assetEntryId,
2382 actionId, active, type)) {
2383 remove(socialEquityLog);
2384 }
2385 }
2386
2387 public void removeByU_AID_AD_A_T(long userId, String actionId,
2388 int actionDate, boolean active, int type) throws SystemException {
2389 for (SocialEquityLog socialEquityLog : findByU_AID_AD_A_T(userId,
2390 actionId, actionDate, active, type)) {
2391 remove(socialEquityLog);
2392 }
2393 }
2394
2395 public void removeByAEI_AID_AD_A_T(long assetEntryId, String actionId,
2396 int actionDate, boolean active, int type) throws SystemException {
2397 for (SocialEquityLog socialEquityLog : findByAEI_AID_AD_A_T(
2398 assetEntryId, actionId, actionDate, active, type)) {
2399 remove(socialEquityLog);
2400 }
2401 }
2402
2403 public void removeByU_AEI_AID_AD_A_T(long userId, long assetEntryId,
2404 String actionId, int actionDate, boolean active, int type)
2405 throws NoSuchEquityLogException, SystemException {
2406 SocialEquityLog socialEquityLog = findByU_AEI_AID_AD_A_T(userId,
2407 assetEntryId, actionId, actionDate, active, type);
2408
2409 remove(socialEquityLog);
2410 }
2411
2412 public void removeAll() throws SystemException {
2413 for (SocialEquityLog socialEquityLog : findAll()) {
2414 remove(socialEquityLog);
2415 }
2416 }
2417
2418 public int countByAEI_T_A(long assetEntryId, int type, boolean active)
2419 throws SystemException {
2420 Object[] finderArgs = new Object[] { assetEntryId, type, active };
2421
2422 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_AEI_T_A,
2423 finderArgs, this);
2424
2425 if (count == null) {
2426 Session session = null;
2427
2428 try {
2429 session = openSession();
2430
2431 StringBundler query = new StringBundler(4);
2432
2433 query.append(_SQL_COUNT_SOCIALEQUITYLOG_WHERE);
2434
2435 query.append(_FINDER_COLUMN_AEI_T_A_ASSETENTRYID_2);
2436
2437 query.append(_FINDER_COLUMN_AEI_T_A_TYPE_2);
2438
2439 query.append(_FINDER_COLUMN_AEI_T_A_ACTIVE_2);
2440
2441 String sql = query.toString();
2442
2443 Query q = session.createQuery(sql);
2444
2445 QueryPos qPos = QueryPos.getInstance(q);
2446
2447 qPos.add(assetEntryId);
2448
2449 qPos.add(type);
2450
2451 qPos.add(active);
2452
2453 count = (Long)q.uniqueResult();
2454 }
2455 catch (Exception e) {
2456 throw processException(e);
2457 }
2458 finally {
2459 if (count == null) {
2460 count = Long.valueOf(0);
2461 }
2462
2463 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_AEI_T_A,
2464 finderArgs, count);
2465
2466 closeSession(session);
2467 }
2468 }
2469
2470 return count.intValue();
2471 }
2472
2473 public int countByU_AID_A_T(long userId, String actionId, boolean active,
2474 int type) throws SystemException {
2475 Object[] finderArgs = new Object[] { userId, actionId, active, type };
2476
2477 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_AID_A_T,
2478 finderArgs, this);
2479
2480 if (count == null) {
2481 Session session = null;
2482
2483 try {
2484 session = openSession();
2485
2486 StringBundler query = new StringBundler(5);
2487
2488 query.append(_SQL_COUNT_SOCIALEQUITYLOG_WHERE);
2489
2490 query.append(_FINDER_COLUMN_U_AID_A_T_USERID_2);
2491
2492 if (actionId == null) {
2493 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_1);
2494 }
2495 else {
2496 if (actionId.equals(StringPool.BLANK)) {
2497 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_3);
2498 }
2499 else {
2500 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_2);
2501 }
2502 }
2503
2504 query.append(_FINDER_COLUMN_U_AID_A_T_ACTIVE_2);
2505
2506 query.append(_FINDER_COLUMN_U_AID_A_T_TYPE_2);
2507
2508 String sql = query.toString();
2509
2510 Query q = session.createQuery(sql);
2511
2512 QueryPos qPos = QueryPos.getInstance(q);
2513
2514 qPos.add(userId);
2515
2516 if (actionId != null) {
2517 qPos.add(actionId);
2518 }
2519
2520 qPos.add(active);
2521
2522 qPos.add(type);
2523
2524 count = (Long)q.uniqueResult();
2525 }
2526 catch (Exception e) {
2527 throw processException(e);
2528 }
2529 finally {
2530 if (count == null) {
2531 count = Long.valueOf(0);
2532 }
2533
2534 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_AID_A_T,
2535 finderArgs, count);
2536
2537 closeSession(session);
2538 }
2539 }
2540
2541 return count.intValue();
2542 }
2543
2544 public int countByAEI_AID_A_T(long assetEntryId, String actionId,
2545 boolean active, int type) throws SystemException {
2546 Object[] finderArgs = new Object[] { assetEntryId, actionId, active, type };
2547
2548 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_AEI_AID_A_T,
2549 finderArgs, this);
2550
2551 if (count == null) {
2552 Session session = null;
2553
2554 try {
2555 session = openSession();
2556
2557 StringBundler query = new StringBundler(5);
2558
2559 query.append(_SQL_COUNT_SOCIALEQUITYLOG_WHERE);
2560
2561 query.append(_FINDER_COLUMN_AEI_AID_A_T_ASSETENTRYID_2);
2562
2563 if (actionId == null) {
2564 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_1);
2565 }
2566 else {
2567 if (actionId.equals(StringPool.BLANK)) {
2568 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_3);
2569 }
2570 else {
2571 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_2);
2572 }
2573 }
2574
2575 query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIVE_2);
2576
2577 query.append(_FINDER_COLUMN_AEI_AID_A_T_TYPE_2);
2578
2579 String sql = query.toString();
2580
2581 Query q = session.createQuery(sql);
2582
2583 QueryPos qPos = QueryPos.getInstance(q);
2584
2585 qPos.add(assetEntryId);
2586
2587 if (actionId != null) {
2588 qPos.add(actionId);
2589 }
2590
2591 qPos.add(active);
2592
2593 qPos.add(type);
2594
2595 count = (Long)q.uniqueResult();
2596 }
2597 catch (Exception e) {
2598 throw processException(e);
2599 }
2600 finally {
2601 if (count == null) {
2602 count = Long.valueOf(0);
2603 }
2604
2605 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_AEI_AID_A_T,
2606 finderArgs, count);
2607
2608 closeSession(session);
2609 }
2610 }
2611
2612 return count.intValue();
2613 }
2614
2615 public int countByU_AID_AD_A_T(long userId, String actionId,
2616 int actionDate, boolean active, int type) throws SystemException {
2617 Object[] finderArgs = new Object[] {
2618 userId, actionId, actionDate, active, type
2619 };
2620
2621 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_AID_AD_A_T,
2622 finderArgs, this);
2623
2624 if (count == null) {
2625 Session session = null;
2626
2627 try {
2628 session = openSession();
2629
2630 StringBundler query = new StringBundler(6);
2631
2632 query.append(_SQL_COUNT_SOCIALEQUITYLOG_WHERE);
2633
2634 query.append(_FINDER_COLUMN_U_AID_AD_A_T_USERID_2);
2635
2636 if (actionId == null) {
2637 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_1);
2638 }
2639 else {
2640 if (actionId.equals(StringPool.BLANK)) {
2641 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_3);
2642 }
2643 else {
2644 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_2);
2645 }
2646 }
2647
2648 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONDATE_2);
2649
2650 query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIVE_2);
2651
2652 query.append(_FINDER_COLUMN_U_AID_AD_A_T_TYPE_2);
2653
2654 String sql = query.toString();
2655
2656 Query q = session.createQuery(sql);
2657
2658 QueryPos qPos = QueryPos.getInstance(q);
2659
2660 qPos.add(userId);
2661
2662 if (actionId != null) {
2663 qPos.add(actionId);
2664 }
2665
2666 qPos.add(actionDate);
2667
2668 qPos.add(active);
2669
2670 qPos.add(type);
2671
2672 count = (Long)q.uniqueResult();
2673 }
2674 catch (Exception e) {
2675 throw processException(e);
2676 }
2677 finally {
2678 if (count == null) {
2679 count = Long.valueOf(0);
2680 }
2681
2682 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_AID_AD_A_T,
2683 finderArgs, count);
2684
2685 closeSession(session);
2686 }
2687 }
2688
2689 return count.intValue();
2690 }
2691
2692 public int countByAEI_AID_AD_A_T(long assetEntryId, String actionId,
2693 int actionDate, boolean active, int type) throws SystemException {
2694 Object[] finderArgs = new Object[] {
2695 assetEntryId, actionId, actionDate, active, type
2696 };
2697
2698 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_AEI_AID_AD_A_T,
2699 finderArgs, this);
2700
2701 if (count == null) {
2702 Session session = null;
2703
2704 try {
2705 session = openSession();
2706
2707 StringBundler query = new StringBundler(6);
2708
2709 query.append(_SQL_COUNT_SOCIALEQUITYLOG_WHERE);
2710
2711 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ASSETENTRYID_2);
2712
2713 if (actionId == null) {
2714 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_1);
2715 }
2716 else {
2717 if (actionId.equals(StringPool.BLANK)) {
2718 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_3);
2719 }
2720 else {
2721 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_2);
2722 }
2723 }
2724
2725 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONDATE_2);
2726
2727 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIVE_2);
2728
2729 query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_TYPE_2);
2730
2731 String sql = query.toString();
2732
2733 Query q = session.createQuery(sql);
2734
2735 QueryPos qPos = QueryPos.getInstance(q);
2736
2737 qPos.add(assetEntryId);
2738
2739 if (actionId != null) {
2740 qPos.add(actionId);
2741 }
2742
2743 qPos.add(actionDate);
2744
2745 qPos.add(active);
2746
2747 qPos.add(type);
2748
2749 count = (Long)q.uniqueResult();
2750 }
2751 catch (Exception e) {
2752 throw processException(e);
2753 }
2754 finally {
2755 if (count == null) {
2756 count = Long.valueOf(0);
2757 }
2758
2759 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_AEI_AID_AD_A_T,
2760 finderArgs, count);
2761
2762 closeSession(session);
2763 }
2764 }
2765
2766 return count.intValue();
2767 }
2768
2769 public int countByU_AEI_AID_AD_A_T(long userId, long assetEntryId,
2770 String actionId, int actionDate, boolean active, int type)
2771 throws SystemException {
2772 Object[] finderArgs = new Object[] {
2773 userId, assetEntryId, actionId, actionDate, active, type
2774 };
2775
2776 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_AEI_AID_AD_A_T,
2777 finderArgs, this);
2778
2779 if (count == null) {
2780 Session session = null;
2781
2782 try {
2783 session = openSession();
2784
2785 StringBundler query = new StringBundler(7);
2786
2787 query.append(_SQL_COUNT_SOCIALEQUITYLOG_WHERE);
2788
2789 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_USERID_2);
2790
2791 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ASSETENTRYID_2);
2792
2793 if (actionId == null) {
2794 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_1);
2795 }
2796 else {
2797 if (actionId.equals(StringPool.BLANK)) {
2798 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_3);
2799 }
2800 else {
2801 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_2);
2802 }
2803 }
2804
2805 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONDATE_2);
2806
2807 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIVE_2);
2808
2809 query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_TYPE_2);
2810
2811 String sql = query.toString();
2812
2813 Query q = session.createQuery(sql);
2814
2815 QueryPos qPos = QueryPos.getInstance(q);
2816
2817 qPos.add(userId);
2818
2819 qPos.add(assetEntryId);
2820
2821 if (actionId != null) {
2822 qPos.add(actionId);
2823 }
2824
2825 qPos.add(actionDate);
2826
2827 qPos.add(active);
2828
2829 qPos.add(type);
2830
2831 count = (Long)q.uniqueResult();
2832 }
2833 catch (Exception e) {
2834 throw processException(e);
2835 }
2836 finally {
2837 if (count == null) {
2838 count = Long.valueOf(0);
2839 }
2840
2841 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_AEI_AID_AD_A_T,
2842 finderArgs, count);
2843
2844 closeSession(session);
2845 }
2846 }
2847
2848 return count.intValue();
2849 }
2850
2851 public int countAll() throws SystemException {
2852 Object[] finderArgs = new Object[0];
2853
2854 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2855 finderArgs, this);
2856
2857 if (count == null) {
2858 Session session = null;
2859
2860 try {
2861 session = openSession();
2862
2863 Query q = session.createQuery(_SQL_COUNT_SOCIALEQUITYLOG);
2864
2865 count = (Long)q.uniqueResult();
2866 }
2867 catch (Exception e) {
2868 throw processException(e);
2869 }
2870 finally {
2871 if (count == null) {
2872 count = Long.valueOf(0);
2873 }
2874
2875 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2876 count);
2877
2878 closeSession(session);
2879 }
2880 }
2881
2882 return count.intValue();
2883 }
2884
2885 public void afterPropertiesSet() {
2886 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2887 com.liferay.portal.util.PropsUtil.get(
2888 "value.object.listener.com.liferay.portlet.social.model.SocialEquityLog")));
2889
2890 if (listenerClassNames.length > 0) {
2891 try {
2892 List<ModelListener<SocialEquityLog>> listenersList = new ArrayList<ModelListener<SocialEquityLog>>();
2893
2894 for (String listenerClassName : listenerClassNames) {
2895 listenersList.add((ModelListener<SocialEquityLog>)InstanceFactory.newInstance(
2896 listenerClassName));
2897 }
2898
2899 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2900 }
2901 catch (Exception e) {
2902 _log.error(e);
2903 }
2904 }
2905 }
2906
2907 @BeanReference(type = SocialActivityPersistence.class)
2908 protected SocialActivityPersistence socialActivityPersistence;
2909 @BeanReference(type = SocialEquityAssetEntryPersistence.class)
2910 protected SocialEquityAssetEntryPersistence socialEquityAssetEntryPersistence;
2911 @BeanReference(type = SocialEquityHistoryPersistence.class)
2912 protected SocialEquityHistoryPersistence socialEquityHistoryPersistence;
2913 @BeanReference(type = SocialEquityLogPersistence.class)
2914 protected SocialEquityLogPersistence socialEquityLogPersistence;
2915 @BeanReference(type = SocialEquitySettingPersistence.class)
2916 protected SocialEquitySettingPersistence socialEquitySettingPersistence;
2917 @BeanReference(type = SocialEquityUserPersistence.class)
2918 protected SocialEquityUserPersistence socialEquityUserPersistence;
2919 @BeanReference(type = SocialRelationPersistence.class)
2920 protected SocialRelationPersistence socialRelationPersistence;
2921 @BeanReference(type = SocialRequestPersistence.class)
2922 protected SocialRequestPersistence socialRequestPersistence;
2923 @BeanReference(type = ResourcePersistence.class)
2924 protected ResourcePersistence resourcePersistence;
2925 @BeanReference(type = UserPersistence.class)
2926 protected UserPersistence userPersistence;
2927 @BeanReference(type = AssetEntryPersistence.class)
2928 protected AssetEntryPersistence assetEntryPersistence;
2929 private static final String _SQL_SELECT_SOCIALEQUITYLOG = "SELECT socialEquityLog FROM SocialEquityLog socialEquityLog";
2930 private static final String _SQL_SELECT_SOCIALEQUITYLOG_WHERE = "SELECT socialEquityLog FROM SocialEquityLog socialEquityLog WHERE ";
2931 private static final String _SQL_COUNT_SOCIALEQUITYLOG = "SELECT COUNT(socialEquityLog) FROM SocialEquityLog socialEquityLog";
2932 private static final String _SQL_COUNT_SOCIALEQUITYLOG_WHERE = "SELECT COUNT(socialEquityLog) FROM SocialEquityLog socialEquityLog WHERE ";
2933 private static final String _FINDER_COLUMN_AEI_T_A_ASSETENTRYID_2 = "socialEquityLog.assetEntryId = ? AND ";
2934 private static final String _FINDER_COLUMN_AEI_T_A_TYPE_2 = "socialEquityLog.type = ? AND ";
2935 private static final String _FINDER_COLUMN_AEI_T_A_ACTIVE_2 = "socialEquityLog.active = ?";
2936 private static final String _FINDER_COLUMN_U_AID_A_T_USERID_2 = "socialEquityLog.userId = ? AND ";
2937 private static final String _FINDER_COLUMN_U_AID_A_T_ACTIONID_1 = "socialEquityLog.actionId IS NULL AND ";
2938 private static final String _FINDER_COLUMN_U_AID_A_T_ACTIONID_2 = "socialEquityLog.actionId = ? AND ";
2939 private static final String _FINDER_COLUMN_U_AID_A_T_ACTIONID_3 = "(socialEquityLog.actionId IS NULL OR socialEquityLog.actionId = ?) AND ";
2940 private static final String _FINDER_COLUMN_U_AID_A_T_ACTIVE_2 = "socialEquityLog.active = ? AND ";
2941 private static final String _FINDER_COLUMN_U_AID_A_T_TYPE_2 = "socialEquityLog.type = ?";
2942 private static final String _FINDER_COLUMN_AEI_AID_A_T_ASSETENTRYID_2 = "socialEquityLog.assetEntryId = ? AND ";
2943 private static final String _FINDER_COLUMN_AEI_AID_A_T_ACTIONID_1 = "socialEquityLog.actionId IS NULL AND ";
2944 private static final String _FINDER_COLUMN_AEI_AID_A_T_ACTIONID_2 = "socialEquityLog.actionId = ? AND ";
2945 private static final String _FINDER_COLUMN_AEI_AID_A_T_ACTIONID_3 = "(socialEquityLog.actionId IS NULL OR socialEquityLog.actionId = ?) AND ";
2946 private static final String _FINDER_COLUMN_AEI_AID_A_T_ACTIVE_2 = "socialEquityLog.active = ? AND ";
2947 private static final String _FINDER_COLUMN_AEI_AID_A_T_TYPE_2 = "socialEquityLog.type = ?";
2948 private static final String _FINDER_COLUMN_U_AID_AD_A_T_USERID_2 = "socialEquityLog.userId = ? AND ";
2949 private static final String _FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_1 = "socialEquityLog.actionId IS NULL AND ";
2950 private static final String _FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_2 = "socialEquityLog.actionId = ? AND ";
2951 private static final String _FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_3 = "(socialEquityLog.actionId IS NULL OR socialEquityLog.actionId = ?) AND ";
2952 private static final String _FINDER_COLUMN_U_AID_AD_A_T_ACTIONDATE_2 = "socialEquityLog.actionDate = ? AND ";
2953 private static final String _FINDER_COLUMN_U_AID_AD_A_T_ACTIVE_2 = "socialEquityLog.active = ? AND ";
2954 private static final String _FINDER_COLUMN_U_AID_AD_A_T_TYPE_2 = "socialEquityLog.type = ?";
2955 private static final String _FINDER_COLUMN_AEI_AID_AD_A_T_ASSETENTRYID_2 = "socialEquityLog.assetEntryId = ? AND ";
2956 private static final String _FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_1 = "socialEquityLog.actionId IS NULL AND ";
2957 private static final String _FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_2 = "socialEquityLog.actionId = ? AND ";
2958 private static final String _FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_3 = "(socialEquityLog.actionId IS NULL OR socialEquityLog.actionId = ?) AND ";
2959 private static final String _FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONDATE_2 = "socialEquityLog.actionDate = ? AND ";
2960 private static final String _FINDER_COLUMN_AEI_AID_AD_A_T_ACTIVE_2 = "socialEquityLog.active = ? AND ";
2961 private static final String _FINDER_COLUMN_AEI_AID_AD_A_T_TYPE_2 = "socialEquityLog.type = ?";
2962 private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_USERID_2 = "socialEquityLog.userId = ? AND ";
2963 private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_ASSETENTRYID_2 = "socialEquityLog.assetEntryId = ? AND ";
2964 private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_1 = "socialEquityLog.actionId IS NULL AND ";
2965 private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_2 = "socialEquityLog.actionId = ? AND ";
2966 private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_3 = "(socialEquityLog.actionId IS NULL OR socialEquityLog.actionId = ?) AND ";
2967 private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONDATE_2 = "socialEquityLog.actionDate = ? AND ";
2968 private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIVE_2 = "socialEquityLog.active = ? AND ";
2969 private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_TYPE_2 = "socialEquityLog.type = ?";
2970 private static final String _ORDER_BY_ENTITY_ALIAS = "socialEquityLog.";
2971 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No SocialEquityLog exists with the primary key ";
2972 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No SocialEquityLog exists with the key {";
2973 private static Log _log = LogFactoryUtil.getLog(SocialEquityLogPersistenceImpl.class);
2974 }