001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
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    /**
056     * The persistence implementation for the social equity log service.
057     *
058     * <p>
059     * Never modify or reference this class directly. Always use {@link SocialEquityLogUtil} to access the social equity log persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
060     * </p>
061     *
062     * <p>
063     * Caching information and settings can be found in <code>portal.properties</code>
064     * </p>
065     *
066     * @author Brian Wing Shun Chan
067     * @see SocialEquityLogPersistence
068     * @see SocialEquityLogUtil
069     * @generated
070     */
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            /**
189             * Caches the social equity log in the entity cache if it is enabled.
190             *
191             * @param socialEquityLog the social equity log to cache
192             */
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            /**
211             * Caches the social equity logs in the entity cache if it is enabled.
212             *
213             * @param socialEquityLogs the social equity logs to cache
214             */
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            /**
227             * Clears the cache for all social equity logs.
228             *
229             * <p>
230             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
231             * </p>
232             */
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            /**
241             * Clears the cache for the social equity log.
242             *
243             * <p>
244             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
245             * </p>
246             */
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            /**
264             * Creates a new social equity log with the primary key. Does not add the social equity log to the database.
265             *
266             * @param equityLogId the primary key for the new social equity log
267             * @return the new social equity log
268             */
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            /**
279             * Removes the social equity log with the primary key from the database. Also notifies the appropriate model listeners.
280             *
281             * @param primaryKey the primary key of the social equity log to remove
282             * @return the social equity log that was removed
283             * @throws com.liferay.portal.NoSuchModelException if a social equity log with the primary key could not be found
284             * @throws SystemException if a system exception occurred
285             */
286            public SocialEquityLog remove(Serializable primaryKey)
287                    throws NoSuchModelException, SystemException {
288                    return remove(((Long)primaryKey).longValue());
289            }
290    
291            /**
292             * Removes the social equity log with the primary key from the database. Also notifies the appropriate model listeners.
293             *
294             * @param equityLogId the primary key of the social equity log to remove
295             * @return the social equity log that was removed
296             * @throws com.liferay.portlet.social.NoSuchEquityLogException if a social equity log with the primary key could not be found
297             * @throws SystemException if a system exception occurred
298             */
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                            BatchSessionUtil.delete(session, socialEquityLog);
341                    }
342                    catch (Exception e) {
343                            throw processException(e);
344                    }
345                    finally {
346                            closeSession(session);
347                    }
348    
349                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
350    
351                    SocialEquityLogModelImpl socialEquityLogModelImpl = (SocialEquityLogModelImpl)socialEquityLog;
352    
353                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
354                            new Object[] {
355                                    new Long(socialEquityLogModelImpl.getUserId()),
356                                    new Long(socialEquityLogModelImpl.getAssetEntryId()),
357                                    
358                            socialEquityLogModelImpl.getActionId(),
359                                    new Integer(socialEquityLogModelImpl.getActionDate()),
360                                    Boolean.valueOf(socialEquityLogModelImpl.getActive()),
361                                    new Integer(socialEquityLogModelImpl.getType())
362                            });
363    
364                    EntityCacheUtil.removeResult(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
365                            SocialEquityLogImpl.class, socialEquityLog.getPrimaryKey());
366    
367                    return socialEquityLog;
368            }
369    
370            public SocialEquityLog updateImpl(
371                    com.liferay.portlet.social.model.SocialEquityLog socialEquityLog,
372                    boolean merge) throws SystemException {
373                    socialEquityLog = toUnwrappedModel(socialEquityLog);
374    
375                    boolean isNew = socialEquityLog.isNew();
376    
377                    SocialEquityLogModelImpl socialEquityLogModelImpl = (SocialEquityLogModelImpl)socialEquityLog;
378    
379                    Session session = null;
380    
381                    try {
382                            session = openSession();
383    
384                            BatchSessionUtil.update(session, socialEquityLog, merge);
385    
386                            socialEquityLog.setNew(false);
387                    }
388                    catch (Exception e) {
389                            throw processException(e);
390                    }
391                    finally {
392                            closeSession(session);
393                    }
394    
395                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
396    
397                    EntityCacheUtil.putResult(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
398                            SocialEquityLogImpl.class, socialEquityLog.getPrimaryKey(),
399                            socialEquityLog);
400    
401                    if (!isNew &&
402                                    ((socialEquityLog.getUserId() != socialEquityLogModelImpl.getOriginalUserId()) ||
403                                    (socialEquityLog.getAssetEntryId() != socialEquityLogModelImpl.getOriginalAssetEntryId()) ||
404                                    !Validator.equals(socialEquityLog.getActionId(),
405                                            socialEquityLogModelImpl.getOriginalActionId()) ||
406                                    (socialEquityLog.getActionDate() != socialEquityLogModelImpl.getOriginalActionDate()) ||
407                                    (socialEquityLog.getActive() != socialEquityLogModelImpl.getOriginalActive()) ||
408                                    (socialEquityLog.getType() != socialEquityLogModelImpl.getOriginalType()))) {
409                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
410                                    new Object[] {
411                                            new Long(socialEquityLogModelImpl.getOriginalUserId()),
412                                            new Long(socialEquityLogModelImpl.getOriginalAssetEntryId()),
413                                            
414                                    socialEquityLogModelImpl.getOriginalActionId(),
415                                            new Integer(socialEquityLogModelImpl.getOriginalActionDate()),
416                                            Boolean.valueOf(
417                                                    socialEquityLogModelImpl.getOriginalActive()),
418                                            new Integer(socialEquityLogModelImpl.getOriginalType())
419                                    });
420                    }
421    
422                    if (isNew ||
423                                    ((socialEquityLog.getUserId() != socialEquityLogModelImpl.getOriginalUserId()) ||
424                                    (socialEquityLog.getAssetEntryId() != socialEquityLogModelImpl.getOriginalAssetEntryId()) ||
425                                    !Validator.equals(socialEquityLog.getActionId(),
426                                            socialEquityLogModelImpl.getOriginalActionId()) ||
427                                    (socialEquityLog.getActionDate() != socialEquityLogModelImpl.getOriginalActionDate()) ||
428                                    (socialEquityLog.getActive() != socialEquityLogModelImpl.getOriginalActive()) ||
429                                    (socialEquityLog.getType() != socialEquityLogModelImpl.getOriginalType()))) {
430                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
431                                    new Object[] {
432                                            new Long(socialEquityLog.getUserId()),
433                                            new Long(socialEquityLog.getAssetEntryId()),
434                                            
435                                    socialEquityLog.getActionId(),
436                                            new Integer(socialEquityLog.getActionDate()),
437                                            Boolean.valueOf(socialEquityLog.getActive()),
438                                            new Integer(socialEquityLog.getType())
439                                    }, socialEquityLog);
440                    }
441    
442                    return socialEquityLog;
443            }
444    
445            protected SocialEquityLog toUnwrappedModel(SocialEquityLog socialEquityLog) {
446                    if (socialEquityLog instanceof SocialEquityLogImpl) {
447                            return socialEquityLog;
448                    }
449    
450                    SocialEquityLogImpl socialEquityLogImpl = new SocialEquityLogImpl();
451    
452                    socialEquityLogImpl.setNew(socialEquityLog.isNew());
453                    socialEquityLogImpl.setPrimaryKey(socialEquityLog.getPrimaryKey());
454    
455                    socialEquityLogImpl.setEquityLogId(socialEquityLog.getEquityLogId());
456                    socialEquityLogImpl.setGroupId(socialEquityLog.getGroupId());
457                    socialEquityLogImpl.setCompanyId(socialEquityLog.getCompanyId());
458                    socialEquityLogImpl.setUserId(socialEquityLog.getUserId());
459                    socialEquityLogImpl.setAssetEntryId(socialEquityLog.getAssetEntryId());
460                    socialEquityLogImpl.setActionId(socialEquityLog.getActionId());
461                    socialEquityLogImpl.setActionDate(socialEquityLog.getActionDate());
462                    socialEquityLogImpl.setActive(socialEquityLog.isActive());
463                    socialEquityLogImpl.setExpiration(socialEquityLog.getExpiration());
464                    socialEquityLogImpl.setType(socialEquityLog.getType());
465                    socialEquityLogImpl.setValue(socialEquityLog.getValue());
466    
467                    return socialEquityLogImpl;
468            }
469    
470            /**
471             * Finds the social equity log with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
472             *
473             * @param primaryKey the primary key of the social equity log to find
474             * @return the social equity log
475             * @throws com.liferay.portal.NoSuchModelException if a social equity log with the primary key could not be found
476             * @throws SystemException if a system exception occurred
477             */
478            public SocialEquityLog findByPrimaryKey(Serializable primaryKey)
479                    throws NoSuchModelException, SystemException {
480                    return findByPrimaryKey(((Long)primaryKey).longValue());
481            }
482    
483            /**
484             * Finds the social equity log with the primary key or throws a {@link com.liferay.portlet.social.NoSuchEquityLogException} if it could not be found.
485             *
486             * @param equityLogId the primary key of the social equity log to find
487             * @return the social equity log
488             * @throws com.liferay.portlet.social.NoSuchEquityLogException if a social equity log with the primary key could not be found
489             * @throws SystemException if a system exception occurred
490             */
491            public SocialEquityLog findByPrimaryKey(long equityLogId)
492                    throws NoSuchEquityLogException, SystemException {
493                    SocialEquityLog socialEquityLog = fetchByPrimaryKey(equityLogId);
494    
495                    if (socialEquityLog == null) {
496                            if (_log.isWarnEnabled()) {
497                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + equityLogId);
498                            }
499    
500                            throw new NoSuchEquityLogException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
501                                    equityLogId);
502                    }
503    
504                    return socialEquityLog;
505            }
506    
507            /**
508             * Finds the social equity log with the primary key or returns <code>null</code> if it could not be found.
509             *
510             * @param primaryKey the primary key of the social equity log to find
511             * @return the social equity log, or <code>null</code> if a social equity log with the primary key could not be found
512             * @throws SystemException if a system exception occurred
513             */
514            public SocialEquityLog fetchByPrimaryKey(Serializable primaryKey)
515                    throws SystemException {
516                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
517            }
518    
519            /**
520             * Finds the social equity log with the primary key or returns <code>null</code> if it could not be found.
521             *
522             * @param equityLogId the primary key of the social equity log to find
523             * @return the social equity log, or <code>null</code> if a social equity log with the primary key could not be found
524             * @throws SystemException if a system exception occurred
525             */
526            public SocialEquityLog fetchByPrimaryKey(long equityLogId)
527                    throws SystemException {
528                    SocialEquityLog socialEquityLog = (SocialEquityLog)EntityCacheUtil.getResult(SocialEquityLogModelImpl.ENTITY_CACHE_ENABLED,
529                                    SocialEquityLogImpl.class, equityLogId, this);
530    
531                    if (socialEquityLog == null) {
532                            Session session = null;
533    
534                            try {
535                                    session = openSession();
536    
537                                    socialEquityLog = (SocialEquityLog)session.get(SocialEquityLogImpl.class,
538                                                    new Long(equityLogId));
539                            }
540                            catch (Exception e) {
541                                    throw processException(e);
542                            }
543                            finally {
544                                    if (socialEquityLog != null) {
545                                            cacheResult(socialEquityLog);
546                                    }
547    
548                                    closeSession(session);
549                            }
550                    }
551    
552                    return socialEquityLog;
553            }
554    
555            /**
556             * Finds all the social equity logs where assetEntryId = &#63; and type = &#63; and active = &#63;.
557             *
558             * @param assetEntryId the asset entry id to search with
559             * @param type the type to search with
560             * @param active the active to search with
561             * @return the matching social equity logs
562             * @throws SystemException if a system exception occurred
563             */
564            public List<SocialEquityLog> findByAEI_T_A(long assetEntryId, int type,
565                    boolean active) throws SystemException {
566                    return findByAEI_T_A(assetEntryId, type, active, QueryUtil.ALL_POS,
567                            QueryUtil.ALL_POS, null);
568            }
569    
570            /**
571             * Finds a range of all the social equity logs where assetEntryId = &#63; and type = &#63; and active = &#63;.
572             *
573             * <p>
574             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
575             * </p>
576             *
577             * @param assetEntryId the asset entry id to search with
578             * @param type the type to search with
579             * @param active the active to search with
580             * @param start the lower bound of the range of social equity logs to return
581             * @param end the upper bound of the range of social equity logs to return (not inclusive)
582             * @return the range of matching social equity logs
583             * @throws SystemException if a system exception occurred
584             */
585            public List<SocialEquityLog> findByAEI_T_A(long assetEntryId, int type,
586                    boolean active, int start, int end) throws SystemException {
587                    return findByAEI_T_A(assetEntryId, type, active, start, end, null);
588            }
589    
590            /**
591             * Finds an ordered range of all the social equity logs where assetEntryId = &#63; and type = &#63; and active = &#63;.
592             *
593             * <p>
594             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
595             * </p>
596             *
597             * @param assetEntryId the asset entry id to search with
598             * @param type the type to search with
599             * @param active the active to search with
600             * @param start the lower bound of the range of social equity logs to return
601             * @param end the upper bound of the range of social equity logs to return (not inclusive)
602             * @param orderByComparator the comparator to order the results by
603             * @return the ordered range of matching social equity logs
604             * @throws SystemException if a system exception occurred
605             */
606            public List<SocialEquityLog> findByAEI_T_A(long assetEntryId, int type,
607                    boolean active, int start, int end, OrderByComparator orderByComparator)
608                    throws SystemException {
609                    Object[] finderArgs = new Object[] {
610                                    assetEntryId, type, active,
611                                    
612                                    String.valueOf(start), String.valueOf(end),
613                                    String.valueOf(orderByComparator)
614                            };
615    
616                    List<SocialEquityLog> list = (List<SocialEquityLog>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_AEI_T_A,
617                                    finderArgs, this);
618    
619                    if (list == null) {
620                            StringBundler query = null;
621    
622                            if (orderByComparator != null) {
623                                    query = new StringBundler(5 +
624                                                    (orderByComparator.getOrderByFields().length * 3));
625                            }
626                            else {
627                                    query = new StringBundler(4);
628                            }
629    
630                            query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
631    
632                            query.append(_FINDER_COLUMN_AEI_T_A_ASSETENTRYID_2);
633    
634                            query.append(_FINDER_COLUMN_AEI_T_A_TYPE_2);
635    
636                            query.append(_FINDER_COLUMN_AEI_T_A_ACTIVE_2);
637    
638                            if (orderByComparator != null) {
639                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
640                                            orderByComparator);
641                            }
642    
643                            String sql = query.toString();
644    
645                            Session session = null;
646    
647                            try {
648                                    session = openSession();
649    
650                                    Query q = session.createQuery(sql);
651    
652                                    QueryPos qPos = QueryPos.getInstance(q);
653    
654                                    qPos.add(assetEntryId);
655    
656                                    qPos.add(type);
657    
658                                    qPos.add(active);
659    
660                                    list = (List<SocialEquityLog>)QueryUtil.list(q, getDialect(),
661                                                    start, end);
662                            }
663                            catch (Exception e) {
664                                    throw processException(e);
665                            }
666                            finally {
667                                    if (list == null) {
668                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_AEI_T_A,
669                                                    finderArgs);
670                                    }
671                                    else {
672                                            cacheResult(list);
673    
674                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_AEI_T_A,
675                                                    finderArgs, list);
676                                    }
677    
678                                    closeSession(session);
679                            }
680                    }
681    
682                    return list;
683            }
684    
685            /**
686             * Finds the first social equity log in the ordered set where assetEntryId = &#63; and type = &#63; and active = &#63;.
687             *
688             * <p>
689             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
690             * </p>
691             *
692             * @param assetEntryId the asset entry id to search with
693             * @param type the type to search with
694             * @param active the active to search with
695             * @param orderByComparator the comparator to order the set by
696             * @return the first matching social equity log
697             * @throws com.liferay.portlet.social.NoSuchEquityLogException if a matching social equity log could not be found
698             * @throws SystemException if a system exception occurred
699             */
700            public SocialEquityLog findByAEI_T_A_First(long assetEntryId, int type,
701                    boolean active, OrderByComparator orderByComparator)
702                    throws NoSuchEquityLogException, SystemException {
703                    List<SocialEquityLog> list = findByAEI_T_A(assetEntryId, type, active,
704                                    0, 1, orderByComparator);
705    
706                    if (list.isEmpty()) {
707                            StringBundler msg = new StringBundler(8);
708    
709                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
710    
711                            msg.append("assetEntryId=");
712                            msg.append(assetEntryId);
713    
714                            msg.append(", type=");
715                            msg.append(type);
716    
717                            msg.append(", active=");
718                            msg.append(active);
719    
720                            msg.append(StringPool.CLOSE_CURLY_BRACE);
721    
722                            throw new NoSuchEquityLogException(msg.toString());
723                    }
724                    else {
725                            return list.get(0);
726                    }
727            }
728    
729            /**
730             * Finds the last social equity log in the ordered set where assetEntryId = &#63; and type = &#63; and active = &#63;.
731             *
732             * <p>
733             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
734             * </p>
735             *
736             * @param assetEntryId the asset entry id to search with
737             * @param type the type to search with
738             * @param active the active to search with
739             * @param orderByComparator the comparator to order the set by
740             * @return the last matching social equity log
741             * @throws com.liferay.portlet.social.NoSuchEquityLogException if a matching social equity log could not be found
742             * @throws SystemException if a system exception occurred
743             */
744            public SocialEquityLog findByAEI_T_A_Last(long assetEntryId, int type,
745                    boolean active, OrderByComparator orderByComparator)
746                    throws NoSuchEquityLogException, SystemException {
747                    int count = countByAEI_T_A(assetEntryId, type, active);
748    
749                    List<SocialEquityLog> list = findByAEI_T_A(assetEntryId, type, active,
750                                    count - 1, count, orderByComparator);
751    
752                    if (list.isEmpty()) {
753                            StringBundler msg = new StringBundler(8);
754    
755                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
756    
757                            msg.append("assetEntryId=");
758                            msg.append(assetEntryId);
759    
760                            msg.append(", type=");
761                            msg.append(type);
762    
763                            msg.append(", active=");
764                            msg.append(active);
765    
766                            msg.append(StringPool.CLOSE_CURLY_BRACE);
767    
768                            throw new NoSuchEquityLogException(msg.toString());
769                    }
770                    else {
771                            return list.get(0);
772                    }
773            }
774    
775            /**
776             * Finds the social equity logs before and after the current social equity log in the ordered set where assetEntryId = &#63; and type = &#63; and active = &#63;.
777             *
778             * <p>
779             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
780             * </p>
781             *
782             * @param equityLogId the primary key of the current social equity log
783             * @param assetEntryId the asset entry id to search with
784             * @param type the type to search with
785             * @param active the active to search with
786             * @param orderByComparator the comparator to order the set by
787             * @return the previous, current, and next social equity log
788             * @throws com.liferay.portlet.social.NoSuchEquityLogException if a social equity log with the primary key could not be found
789             * @throws SystemException if a system exception occurred
790             */
791            public SocialEquityLog[] findByAEI_T_A_PrevAndNext(long equityLogId,
792                    long assetEntryId, int type, boolean active,
793                    OrderByComparator orderByComparator)
794                    throws NoSuchEquityLogException, SystemException {
795                    SocialEquityLog socialEquityLog = findByPrimaryKey(equityLogId);
796    
797                    Session session = null;
798    
799                    try {
800                            session = openSession();
801    
802                            SocialEquityLog[] array = new SocialEquityLogImpl[3];
803    
804                            array[0] = getByAEI_T_A_PrevAndNext(session, socialEquityLog,
805                                            assetEntryId, type, active, orderByComparator, true);
806    
807                            array[1] = socialEquityLog;
808    
809                            array[2] = getByAEI_T_A_PrevAndNext(session, socialEquityLog,
810                                            assetEntryId, type, active, orderByComparator, false);
811    
812                            return array;
813                    }
814                    catch (Exception e) {
815                            throw processException(e);
816                    }
817                    finally {
818                            closeSession(session);
819                    }
820            }
821    
822            protected SocialEquityLog getByAEI_T_A_PrevAndNext(Session session,
823                    SocialEquityLog socialEquityLog, long assetEntryId, int type,
824                    boolean active, OrderByComparator orderByComparator, boolean previous) {
825                    StringBundler query = null;
826    
827                    if (orderByComparator != null) {
828                            query = new StringBundler(6 +
829                                            (orderByComparator.getOrderByFields().length * 6));
830                    }
831                    else {
832                            query = new StringBundler(3);
833                    }
834    
835                    query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
836    
837                    query.append(_FINDER_COLUMN_AEI_T_A_ASSETENTRYID_2);
838    
839                    query.append(_FINDER_COLUMN_AEI_T_A_TYPE_2);
840    
841                    query.append(_FINDER_COLUMN_AEI_T_A_ACTIVE_2);
842    
843                    if (orderByComparator != null) {
844                            String[] orderByFields = orderByComparator.getOrderByFields();
845    
846                            if (orderByFields.length > 0) {
847                                    query.append(WHERE_AND);
848                            }
849    
850                            for (int i = 0; i < orderByFields.length; i++) {
851                                    query.append(_ORDER_BY_ENTITY_ALIAS);
852                                    query.append(orderByFields[i]);
853    
854                                    if ((i + 1) < orderByFields.length) {
855                                            if (orderByComparator.isAscending() ^ previous) {
856                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
857                                            }
858                                            else {
859                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
860                                            }
861                                    }
862                                    else {
863                                            if (orderByComparator.isAscending() ^ previous) {
864                                                    query.append(WHERE_GREATER_THAN);
865                                            }
866                                            else {
867                                                    query.append(WHERE_LESSER_THAN);
868                                            }
869                                    }
870                            }
871    
872                            query.append(ORDER_BY_CLAUSE);
873    
874                            for (int i = 0; i < orderByFields.length; i++) {
875                                    query.append(_ORDER_BY_ENTITY_ALIAS);
876                                    query.append(orderByFields[i]);
877    
878                                    if ((i + 1) < orderByFields.length) {
879                                            if (orderByComparator.isAscending() ^ previous) {
880                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
881                                            }
882                                            else {
883                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
884                                            }
885                                    }
886                                    else {
887                                            if (orderByComparator.isAscending() ^ previous) {
888                                                    query.append(ORDER_BY_ASC);
889                                            }
890                                            else {
891                                                    query.append(ORDER_BY_DESC);
892                                            }
893                                    }
894                            }
895                    }
896    
897                    String sql = query.toString();
898    
899                    Query q = session.createQuery(sql);
900    
901                    q.setFirstResult(0);
902                    q.setMaxResults(2);
903    
904                    QueryPos qPos = QueryPos.getInstance(q);
905    
906                    qPos.add(assetEntryId);
907    
908                    qPos.add(type);
909    
910                    qPos.add(active);
911    
912                    if (orderByComparator != null) {
913                            Object[] values = orderByComparator.getOrderByValues(socialEquityLog);
914    
915                            for (Object value : values) {
916                                    qPos.add(value);
917                            }
918                    }
919    
920                    List<SocialEquityLog> list = q.list();
921    
922                    if (list.size() == 2) {
923                            return list.get(1);
924                    }
925                    else {
926                            return null;
927                    }
928            }
929    
930            /**
931             * Finds all the social equity logs where userId = &#63; and actionId = &#63; and active = &#63; and type = &#63;.
932             *
933             * @param userId the user id to search with
934             * @param actionId the action id to search with
935             * @param active the active to search with
936             * @param type the type to search with
937             * @return the matching social equity logs
938             * @throws SystemException if a system exception occurred
939             */
940            public List<SocialEquityLog> findByU_AID_A_T(long userId, String actionId,
941                    boolean active, int type) throws SystemException {
942                    return findByU_AID_A_T(userId, actionId, active, type,
943                            QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
944            }
945    
946            /**
947             * Finds a range of all the social equity logs where userId = &#63; and actionId = &#63; and active = &#63; and type = &#63;.
948             *
949             * <p>
950             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
951             * </p>
952             *
953             * @param userId the user id to search with
954             * @param actionId the action id to search with
955             * @param active the active to search with
956             * @param type the type to search with
957             * @param start the lower bound of the range of social equity logs to return
958             * @param end the upper bound of the range of social equity logs to return (not inclusive)
959             * @return the range of matching social equity logs
960             * @throws SystemException if a system exception occurred
961             */
962            public List<SocialEquityLog> findByU_AID_A_T(long userId, String actionId,
963                    boolean active, int type, int start, int end) throws SystemException {
964                    return findByU_AID_A_T(userId, actionId, active, type, start, end, null);
965            }
966    
967            /**
968             * Finds an ordered range of all the social equity logs where userId = &#63; and actionId = &#63; and active = &#63; and type = &#63;.
969             *
970             * <p>
971             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
972             * </p>
973             *
974             * @param userId the user id to search with
975             * @param actionId the action id to search with
976             * @param active the active to search with
977             * @param type the type to search with
978             * @param start the lower bound of the range of social equity logs to return
979             * @param end the upper bound of the range of social equity logs to return (not inclusive)
980             * @param orderByComparator the comparator to order the results by
981             * @return the ordered range of matching social equity logs
982             * @throws SystemException if a system exception occurred
983             */
984            public List<SocialEquityLog> findByU_AID_A_T(long userId, String actionId,
985                    boolean active, int type, int start, int end,
986                    OrderByComparator orderByComparator) throws SystemException {
987                    Object[] finderArgs = new Object[] {
988                                    userId, actionId, active, type,
989                                    
990                                    String.valueOf(start), String.valueOf(end),
991                                    String.valueOf(orderByComparator)
992                            };
993    
994                    List<SocialEquityLog> list = (List<SocialEquityLog>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_U_AID_A_T,
995                                    finderArgs, this);
996    
997                    if (list == null) {
998                            StringBundler query = null;
999    
1000                            if (orderByComparator != null) {
1001                                    query = new StringBundler(6 +
1002                                                    (orderByComparator.getOrderByFields().length * 3));
1003                            }
1004                            else {
1005                                    query = new StringBundler(5);
1006                            }
1007    
1008                            query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
1009    
1010                            query.append(_FINDER_COLUMN_U_AID_A_T_USERID_2);
1011    
1012                            if (actionId == null) {
1013                                    query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_1);
1014                            }
1015                            else {
1016                                    if (actionId.equals(StringPool.BLANK)) {
1017                                            query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_3);
1018                                    }
1019                                    else {
1020                                            query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_2);
1021                                    }
1022                            }
1023    
1024                            query.append(_FINDER_COLUMN_U_AID_A_T_ACTIVE_2);
1025    
1026                            query.append(_FINDER_COLUMN_U_AID_A_T_TYPE_2);
1027    
1028                            if (orderByComparator != null) {
1029                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1030                                            orderByComparator);
1031                            }
1032    
1033                            String sql = query.toString();
1034    
1035                            Session session = null;
1036    
1037                            try {
1038                                    session = openSession();
1039    
1040                                    Query q = session.createQuery(sql);
1041    
1042                                    QueryPos qPos = QueryPos.getInstance(q);
1043    
1044                                    qPos.add(userId);
1045    
1046                                    if (actionId != null) {
1047                                            qPos.add(actionId);
1048                                    }
1049    
1050                                    qPos.add(active);
1051    
1052                                    qPos.add(type);
1053    
1054                                    list = (List<SocialEquityLog>)QueryUtil.list(q, getDialect(),
1055                                                    start, end);
1056                            }
1057                            catch (Exception e) {
1058                                    throw processException(e);
1059                            }
1060                            finally {
1061                                    if (list == null) {
1062                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_U_AID_A_T,
1063                                                    finderArgs);
1064                                    }
1065                                    else {
1066                                            cacheResult(list);
1067    
1068                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_U_AID_A_T,
1069                                                    finderArgs, list);
1070                                    }
1071    
1072                                    closeSession(session);
1073                            }
1074                    }
1075    
1076                    return list;
1077            }
1078    
1079            /**
1080             * Finds the first social equity log in the ordered set where userId = &#63; and actionId = &#63; and active = &#63; and type = &#63;.
1081             *
1082             * <p>
1083             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1084             * </p>
1085             *
1086             * @param userId the user id to search with
1087             * @param actionId the action id to search with
1088             * @param active the active to search with
1089             * @param type the type to search with
1090             * @param orderByComparator the comparator to order the set by
1091             * @return the first matching social equity log
1092             * @throws com.liferay.portlet.social.NoSuchEquityLogException if a matching social equity log could not be found
1093             * @throws SystemException if a system exception occurred
1094             */
1095            public SocialEquityLog findByU_AID_A_T_First(long userId, String actionId,
1096                    boolean active, int type, OrderByComparator orderByComparator)
1097                    throws NoSuchEquityLogException, SystemException {
1098                    List<SocialEquityLog> list = findByU_AID_A_T(userId, actionId, active,
1099                                    type, 0, 1, orderByComparator);
1100    
1101                    if (list.isEmpty()) {
1102                            StringBundler msg = new StringBundler(10);
1103    
1104                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1105    
1106                            msg.append("userId=");
1107                            msg.append(userId);
1108    
1109                            msg.append(", actionId=");
1110                            msg.append(actionId);
1111    
1112                            msg.append(", active=");
1113                            msg.append(active);
1114    
1115                            msg.append(", type=");
1116                            msg.append(type);
1117    
1118                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1119    
1120                            throw new NoSuchEquityLogException(msg.toString());
1121                    }
1122                    else {
1123                            return list.get(0);
1124                    }
1125            }
1126    
1127            /**
1128             * Finds the last social equity log in the ordered set where userId = &#63; and actionId = &#63; and active = &#63; and type = &#63;.
1129             *
1130             * <p>
1131             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1132             * </p>
1133             *
1134             * @param userId the user id to search with
1135             * @param actionId the action id to search with
1136             * @param active the active to search with
1137             * @param type the type to search with
1138             * @param orderByComparator the comparator to order the set by
1139             * @return the last matching social equity log
1140             * @throws com.liferay.portlet.social.NoSuchEquityLogException if a matching social equity log could not be found
1141             * @throws SystemException if a system exception occurred
1142             */
1143            public SocialEquityLog findByU_AID_A_T_Last(long userId, String actionId,
1144                    boolean active, int type, OrderByComparator orderByComparator)
1145                    throws NoSuchEquityLogException, SystemException {
1146                    int count = countByU_AID_A_T(userId, actionId, active, type);
1147    
1148                    List<SocialEquityLog> list = findByU_AID_A_T(userId, actionId, active,
1149                                    type, count - 1, count, orderByComparator);
1150    
1151                    if (list.isEmpty()) {
1152                            StringBundler msg = new StringBundler(10);
1153    
1154                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1155    
1156                            msg.append("userId=");
1157                            msg.append(userId);
1158    
1159                            msg.append(", actionId=");
1160                            msg.append(actionId);
1161    
1162                            msg.append(", active=");
1163                            msg.append(active);
1164    
1165                            msg.append(", type=");
1166                            msg.append(type);
1167    
1168                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1169    
1170                            throw new NoSuchEquityLogException(msg.toString());
1171                    }
1172                    else {
1173                            return list.get(0);
1174                    }
1175            }
1176    
1177            /**
1178             * Finds the social equity logs before and after the current social equity log in the ordered set where userId = &#63; and actionId = &#63; and active = &#63; and type = &#63;.
1179             *
1180             * <p>
1181             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1182             * </p>
1183             *
1184             * @param equityLogId the primary key of the current social equity log
1185             * @param userId the user id to search with
1186             * @param actionId the action id to search with
1187             * @param active the active to search with
1188             * @param type the type to search with
1189             * @param orderByComparator the comparator to order the set by
1190             * @return the previous, current, and next social equity log
1191             * @throws com.liferay.portlet.social.NoSuchEquityLogException if a social equity log with the primary key could not be found
1192             * @throws SystemException if a system exception occurred
1193             */
1194            public SocialEquityLog[] findByU_AID_A_T_PrevAndNext(long equityLogId,
1195                    long userId, String actionId, boolean active, int type,
1196                    OrderByComparator orderByComparator)
1197                    throws NoSuchEquityLogException, SystemException {
1198                    SocialEquityLog socialEquityLog = findByPrimaryKey(equityLogId);
1199    
1200                    Session session = null;
1201    
1202                    try {
1203                            session = openSession();
1204    
1205                            SocialEquityLog[] array = new SocialEquityLogImpl[3];
1206    
1207                            array[0] = getByU_AID_A_T_PrevAndNext(session, socialEquityLog,
1208                                            userId, actionId, active, type, orderByComparator, true);
1209    
1210                            array[1] = socialEquityLog;
1211    
1212                            array[2] = getByU_AID_A_T_PrevAndNext(session, socialEquityLog,
1213                                            userId, actionId, active, type, orderByComparator, false);
1214    
1215                            return array;
1216                    }
1217                    catch (Exception e) {
1218                            throw processException(e);
1219                    }
1220                    finally {
1221                            closeSession(session);
1222                    }
1223            }
1224    
1225            protected SocialEquityLog getByU_AID_A_T_PrevAndNext(Session session,
1226                    SocialEquityLog socialEquityLog, long userId, String actionId,
1227                    boolean active, int type, OrderByComparator orderByComparator,
1228                    boolean previous) {
1229                    StringBundler query = null;
1230    
1231                    if (orderByComparator != null) {
1232                            query = new StringBundler(6 +
1233                                            (orderByComparator.getOrderByFields().length * 6));
1234                    }
1235                    else {
1236                            query = new StringBundler(3);
1237                    }
1238    
1239                    query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
1240    
1241                    query.append(_FINDER_COLUMN_U_AID_A_T_USERID_2);
1242    
1243                    if (actionId == null) {
1244                            query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_1);
1245                    }
1246                    else {
1247                            if (actionId.equals(StringPool.BLANK)) {
1248                                    query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_3);
1249                            }
1250                            else {
1251                                    query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_2);
1252                            }
1253                    }
1254    
1255                    query.append(_FINDER_COLUMN_U_AID_A_T_ACTIVE_2);
1256    
1257                    query.append(_FINDER_COLUMN_U_AID_A_T_TYPE_2);
1258    
1259                    if (orderByComparator != null) {
1260                            String[] orderByFields = orderByComparator.getOrderByFields();
1261    
1262                            if (orderByFields.length > 0) {
1263                                    query.append(WHERE_AND);
1264                            }
1265    
1266                            for (int i = 0; i < orderByFields.length; i++) {
1267                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1268                                    query.append(orderByFields[i]);
1269    
1270                                    if ((i + 1) < orderByFields.length) {
1271                                            if (orderByComparator.isAscending() ^ previous) {
1272                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1273                                            }
1274                                            else {
1275                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1276                                            }
1277                                    }
1278                                    else {
1279                                            if (orderByComparator.isAscending() ^ previous) {
1280                                                    query.append(WHERE_GREATER_THAN);
1281                                            }
1282                                            else {
1283                                                    query.append(WHERE_LESSER_THAN);
1284                                            }
1285                                    }
1286                            }
1287    
1288                            query.append(ORDER_BY_CLAUSE);
1289    
1290                            for (int i = 0; i < orderByFields.length; i++) {
1291                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1292                                    query.append(orderByFields[i]);
1293    
1294                                    if ((i + 1) < orderByFields.length) {
1295                                            if (orderByComparator.isAscending() ^ previous) {
1296                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1297                                            }
1298                                            else {
1299                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1300                                            }
1301                                    }
1302                                    else {
1303                                            if (orderByComparator.isAscending() ^ previous) {
1304                                                    query.append(ORDER_BY_ASC);
1305                                            }
1306                                            else {
1307                                                    query.append(ORDER_BY_DESC);
1308                                            }
1309                                    }
1310                            }
1311                    }
1312    
1313                    String sql = query.toString();
1314    
1315                    Query q = session.createQuery(sql);
1316    
1317                    q.setFirstResult(0);
1318                    q.setMaxResults(2);
1319    
1320                    QueryPos qPos = QueryPos.getInstance(q);
1321    
1322                    qPos.add(userId);
1323    
1324                    if (actionId != null) {
1325                            qPos.add(actionId);
1326                    }
1327    
1328                    qPos.add(active);
1329    
1330                    qPos.add(type);
1331    
1332                    if (orderByComparator != null) {
1333                            Object[] values = orderByComparator.getOrderByValues(socialEquityLog);
1334    
1335                            for (Object value : values) {
1336                                    qPos.add(value);
1337                            }
1338                    }
1339    
1340                    List<SocialEquityLog> list = q.list();
1341    
1342                    if (list.size() == 2) {
1343                            return list.get(1);
1344                    }
1345                    else {
1346                            return null;
1347                    }
1348            }
1349    
1350            /**
1351             * Finds all the social equity logs where assetEntryId = &#63; and actionId = &#63; and active = &#63; and type = &#63;.
1352             *
1353             * @param assetEntryId the asset entry id to search with
1354             * @param actionId the action id to search with
1355             * @param active the active to search with
1356             * @param type the type to search with
1357             * @return the matching social equity logs
1358             * @throws SystemException if a system exception occurred
1359             */
1360            public List<SocialEquityLog> findByAEI_AID_A_T(long assetEntryId,
1361                    String actionId, boolean active, int type) throws SystemException {
1362                    return findByAEI_AID_A_T(assetEntryId, actionId, active, type,
1363                            QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1364            }
1365    
1366            /**
1367             * Finds a range of all the social equity logs where assetEntryId = &#63; and actionId = &#63; and active = &#63; and type = &#63;.
1368             *
1369             * <p>
1370             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1371             * </p>
1372             *
1373             * @param assetEntryId the asset entry id to search with
1374             * @param actionId the action id to search with
1375             * @param active the active to search with
1376             * @param type the type to search with
1377             * @param start the lower bound of the range of social equity logs to return
1378             * @param end the upper bound of the range of social equity logs to return (not inclusive)
1379             * @return the range of matching social equity logs
1380             * @throws SystemException if a system exception occurred
1381             */
1382            public List<SocialEquityLog> findByAEI_AID_A_T(long assetEntryId,
1383                    String actionId, boolean active, int type, int start, int end)
1384                    throws SystemException {
1385                    return findByAEI_AID_A_T(assetEntryId, actionId, active, type, start,
1386                            end, null);
1387            }
1388    
1389            /**
1390             * Finds an ordered range of all the social equity logs where assetEntryId = &#63; and actionId = &#63; and active = &#63; and type = &#63;.
1391             *
1392             * <p>
1393             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1394             * </p>
1395             *
1396             * @param assetEntryId the asset entry id to search with
1397             * @param actionId the action id to search with
1398             * @param active the active to search with
1399             * @param type the type to search with
1400             * @param start the lower bound of the range of social equity logs to return
1401             * @param end the upper bound of the range of social equity logs to return (not inclusive)
1402             * @param orderByComparator the comparator to order the results by
1403             * @return the ordered range of matching social equity logs
1404             * @throws SystemException if a system exception occurred
1405             */
1406            public List<SocialEquityLog> findByAEI_AID_A_T(long assetEntryId,
1407                    String actionId, boolean active, int type, int start, int end,
1408                    OrderByComparator orderByComparator) throws SystemException {
1409                    Object[] finderArgs = new Object[] {
1410                                    assetEntryId, actionId, active, type,
1411                                    
1412                                    String.valueOf(start), String.valueOf(end),
1413                                    String.valueOf(orderByComparator)
1414                            };
1415    
1416                    List<SocialEquityLog> list = (List<SocialEquityLog>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_AEI_AID_A_T,
1417                                    finderArgs, this);
1418    
1419                    if (list == null) {
1420                            StringBundler query = null;
1421    
1422                            if (orderByComparator != null) {
1423                                    query = new StringBundler(6 +
1424                                                    (orderByComparator.getOrderByFields().length * 3));
1425                            }
1426                            else {
1427                                    query = new StringBundler(5);
1428                            }
1429    
1430                            query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
1431    
1432                            query.append(_FINDER_COLUMN_AEI_AID_A_T_ASSETENTRYID_2);
1433    
1434                            if (actionId == null) {
1435                                    query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_1);
1436                            }
1437                            else {
1438                                    if (actionId.equals(StringPool.BLANK)) {
1439                                            query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_3);
1440                                    }
1441                                    else {
1442                                            query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_2);
1443                                    }
1444                            }
1445    
1446                            query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIVE_2);
1447    
1448                            query.append(_FINDER_COLUMN_AEI_AID_A_T_TYPE_2);
1449    
1450                            if (orderByComparator != null) {
1451                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1452                                            orderByComparator);
1453                            }
1454    
1455                            String sql = query.toString();
1456    
1457                            Session session = null;
1458    
1459                            try {
1460                                    session = openSession();
1461    
1462                                    Query q = session.createQuery(sql);
1463    
1464                                    QueryPos qPos = QueryPos.getInstance(q);
1465    
1466                                    qPos.add(assetEntryId);
1467    
1468                                    if (actionId != null) {
1469                                            qPos.add(actionId);
1470                                    }
1471    
1472                                    qPos.add(active);
1473    
1474                                    qPos.add(type);
1475    
1476                                    list = (List<SocialEquityLog>)QueryUtil.list(q, getDialect(),
1477                                                    start, end);
1478                            }
1479                            catch (Exception e) {
1480                                    throw processException(e);
1481                            }
1482                            finally {
1483                                    if (list == null) {
1484                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_AEI_AID_A_T,
1485                                                    finderArgs);
1486                                    }
1487                                    else {
1488                                            cacheResult(list);
1489    
1490                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_AEI_AID_A_T,
1491                                                    finderArgs, list);
1492                                    }
1493    
1494                                    closeSession(session);
1495                            }
1496                    }
1497    
1498                    return list;
1499            }
1500    
1501            /**
1502             * Finds the first social equity log in the ordered set where assetEntryId = &#63; and actionId = &#63; and active = &#63; and type = &#63;.
1503             *
1504             * <p>
1505             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1506             * </p>
1507             *
1508             * @param assetEntryId the asset entry id to search with
1509             * @param actionId the action id to search with
1510             * @param active the active to search with
1511             * @param type the type to search with
1512             * @param orderByComparator the comparator to order the set by
1513             * @return the first matching social equity log
1514             * @throws com.liferay.portlet.social.NoSuchEquityLogException if a matching social equity log could not be found
1515             * @throws SystemException if a system exception occurred
1516             */
1517            public SocialEquityLog findByAEI_AID_A_T_First(long assetEntryId,
1518                    String actionId, boolean active, int type,
1519                    OrderByComparator orderByComparator)
1520                    throws NoSuchEquityLogException, SystemException {
1521                    List<SocialEquityLog> list = findByAEI_AID_A_T(assetEntryId, actionId,
1522                                    active, type, 0, 1, orderByComparator);
1523    
1524                    if (list.isEmpty()) {
1525                            StringBundler msg = new StringBundler(10);
1526    
1527                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1528    
1529                            msg.append("assetEntryId=");
1530                            msg.append(assetEntryId);
1531    
1532                            msg.append(", actionId=");
1533                            msg.append(actionId);
1534    
1535                            msg.append(", active=");
1536                            msg.append(active);
1537    
1538                            msg.append(", type=");
1539                            msg.append(type);
1540    
1541                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1542    
1543                            throw new NoSuchEquityLogException(msg.toString());
1544                    }
1545                    else {
1546                            return list.get(0);
1547                    }
1548            }
1549    
1550            /**
1551             * Finds the last social equity log in the ordered set where assetEntryId = &#63; and actionId = &#63; and active = &#63; and type = &#63;.
1552             *
1553             * <p>
1554             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1555             * </p>
1556             *
1557             * @param assetEntryId the asset entry id to search with
1558             * @param actionId the action id to search with
1559             * @param active the active to search with
1560             * @param type the type to search with
1561             * @param orderByComparator the comparator to order the set by
1562             * @return the last matching social equity log
1563             * @throws com.liferay.portlet.social.NoSuchEquityLogException if a matching social equity log could not be found
1564             * @throws SystemException if a system exception occurred
1565             */
1566            public SocialEquityLog findByAEI_AID_A_T_Last(long assetEntryId,
1567                    String actionId, boolean active, int type,
1568                    OrderByComparator orderByComparator)
1569                    throws NoSuchEquityLogException, SystemException {
1570                    int count = countByAEI_AID_A_T(assetEntryId, actionId, active, type);
1571    
1572                    List<SocialEquityLog> list = findByAEI_AID_A_T(assetEntryId, actionId,
1573                                    active, type, count - 1, count, orderByComparator);
1574    
1575                    if (list.isEmpty()) {
1576                            StringBundler msg = new StringBundler(10);
1577    
1578                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1579    
1580                            msg.append("assetEntryId=");
1581                            msg.append(assetEntryId);
1582    
1583                            msg.append(", actionId=");
1584                            msg.append(actionId);
1585    
1586                            msg.append(", active=");
1587                            msg.append(active);
1588    
1589                            msg.append(", type=");
1590                            msg.append(type);
1591    
1592                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1593    
1594                            throw new NoSuchEquityLogException(msg.toString());
1595                    }
1596                    else {
1597                            return list.get(0);
1598                    }
1599            }
1600    
1601            /**
1602             * Finds the social equity logs before and after the current social equity log in the ordered set where assetEntryId = &#63; and actionId = &#63; and active = &#63; and type = &#63;.
1603             *
1604             * <p>
1605             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1606             * </p>
1607             *
1608             * @param equityLogId the primary key of the current social equity log
1609             * @param assetEntryId the asset entry id to search with
1610             * @param actionId the action id to search with
1611             * @param active the active to search with
1612             * @param type the type to search with
1613             * @param orderByComparator the comparator to order the set by
1614             * @return the previous, current, and next social equity log
1615             * @throws com.liferay.portlet.social.NoSuchEquityLogException if a social equity log with the primary key could not be found
1616             * @throws SystemException if a system exception occurred
1617             */
1618            public SocialEquityLog[] findByAEI_AID_A_T_PrevAndNext(long equityLogId,
1619                    long assetEntryId, String actionId, boolean active, int type,
1620                    OrderByComparator orderByComparator)
1621                    throws NoSuchEquityLogException, SystemException {
1622                    SocialEquityLog socialEquityLog = findByPrimaryKey(equityLogId);
1623    
1624                    Session session = null;
1625    
1626                    try {
1627                            session = openSession();
1628    
1629                            SocialEquityLog[] array = new SocialEquityLogImpl[3];
1630    
1631                            array[0] = getByAEI_AID_A_T_PrevAndNext(session, socialEquityLog,
1632                                            assetEntryId, actionId, active, type, orderByComparator,
1633                                            true);
1634    
1635                            array[1] = socialEquityLog;
1636    
1637                            array[2] = getByAEI_AID_A_T_PrevAndNext(session, socialEquityLog,
1638                                            assetEntryId, actionId, active, type, orderByComparator,
1639                                            false);
1640    
1641                            return array;
1642                    }
1643                    catch (Exception e) {
1644                            throw processException(e);
1645                    }
1646                    finally {
1647                            closeSession(session);
1648                    }
1649            }
1650    
1651            protected SocialEquityLog getByAEI_AID_A_T_PrevAndNext(Session session,
1652                    SocialEquityLog socialEquityLog, long assetEntryId, String actionId,
1653                    boolean active, int type, OrderByComparator orderByComparator,
1654                    boolean previous) {
1655                    StringBundler query = null;
1656    
1657                    if (orderByComparator != null) {
1658                            query = new StringBundler(6 +
1659                                            (orderByComparator.getOrderByFields().length * 6));
1660                    }
1661                    else {
1662                            query = new StringBundler(3);
1663                    }
1664    
1665                    query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
1666    
1667                    query.append(_FINDER_COLUMN_AEI_AID_A_T_ASSETENTRYID_2);
1668    
1669                    if (actionId == null) {
1670                            query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_1);
1671                    }
1672                    else {
1673                            if (actionId.equals(StringPool.BLANK)) {
1674                                    query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_3);
1675                            }
1676                            else {
1677                                    query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_2);
1678                            }
1679                    }
1680    
1681                    query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIVE_2);
1682    
1683                    query.append(_FINDER_COLUMN_AEI_AID_A_T_TYPE_2);
1684    
1685                    if (orderByComparator != null) {
1686                            String[] orderByFields = orderByComparator.getOrderByFields();
1687    
1688                            if (orderByFields.length > 0) {
1689                                    query.append(WHERE_AND);
1690                            }
1691    
1692                            for (int i = 0; i < orderByFields.length; i++) {
1693                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1694                                    query.append(orderByFields[i]);
1695    
1696                                    if ((i + 1) < orderByFields.length) {
1697                                            if (orderByComparator.isAscending() ^ previous) {
1698                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1699                                            }
1700                                            else {
1701                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1702                                            }
1703                                    }
1704                                    else {
1705                                            if (orderByComparator.isAscending() ^ previous) {
1706                                                    query.append(WHERE_GREATER_THAN);
1707                                            }
1708                                            else {
1709                                                    query.append(WHERE_LESSER_THAN);
1710                                            }
1711                                    }
1712                            }
1713    
1714                            query.append(ORDER_BY_CLAUSE);
1715    
1716                            for (int i = 0; i < orderByFields.length; i++) {
1717                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1718                                    query.append(orderByFields[i]);
1719    
1720                                    if ((i + 1) < orderByFields.length) {
1721                                            if (orderByComparator.isAscending() ^ previous) {
1722                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1723                                            }
1724                                            else {
1725                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1726                                            }
1727                                    }
1728                                    else {
1729                                            if (orderByComparator.isAscending() ^ previous) {
1730                                                    query.append(ORDER_BY_ASC);
1731                                            }
1732                                            else {
1733                                                    query.append(ORDER_BY_DESC);
1734                                            }
1735                                    }
1736                            }
1737                    }
1738    
1739                    String sql = query.toString();
1740    
1741                    Query q = session.createQuery(sql);
1742    
1743                    q.setFirstResult(0);
1744                    q.setMaxResults(2);
1745    
1746                    QueryPos qPos = QueryPos.getInstance(q);
1747    
1748                    qPos.add(assetEntryId);
1749    
1750                    if (actionId != null) {
1751                            qPos.add(actionId);
1752                    }
1753    
1754                    qPos.add(active);
1755    
1756                    qPos.add(type);
1757    
1758                    if (orderByComparator != null) {
1759                            Object[] values = orderByComparator.getOrderByValues(socialEquityLog);
1760    
1761                            for (Object value : values) {
1762                                    qPos.add(value);
1763                            }
1764                    }
1765    
1766                    List<SocialEquityLog> list = q.list();
1767    
1768                    if (list.size() == 2) {
1769                            return list.get(1);
1770                    }
1771                    else {
1772                            return null;
1773                    }
1774            }
1775    
1776            /**
1777             * Finds all the social equity logs where userId = &#63; and actionId = &#63; and actionDate = &#63; and active = &#63; and type = &#63;.
1778             *
1779             * @param userId the user id to search with
1780             * @param actionId the action id to search with
1781             * @param actionDate the action date to search with
1782             * @param active the active to search with
1783             * @param type the type to search with
1784             * @return the matching social equity logs
1785             * @throws SystemException if a system exception occurred
1786             */
1787            public List<SocialEquityLog> findByU_AID_AD_A_T(long userId,
1788                    String actionId, int actionDate, boolean active, int type)
1789                    throws SystemException {
1790                    return findByU_AID_AD_A_T(userId, actionId, actionDate, active, type,
1791                            QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1792            }
1793    
1794            /**
1795             * Finds a range of all the social equity logs where userId = &#63; and actionId = &#63; and actionDate = &#63; and active = &#63; and type = &#63;.
1796             *
1797             * <p>
1798             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1799             * </p>
1800             *
1801             * @param userId the user id to search with
1802             * @param actionId the action id to search with
1803             * @param actionDate the action date to search with
1804             * @param active the active to search with
1805             * @param type the type to search with
1806             * @param start the lower bound of the range of social equity logs to return
1807             * @param end the upper bound of the range of social equity logs to return (not inclusive)
1808             * @return the range of matching social equity logs
1809             * @throws SystemException if a system exception occurred
1810             */
1811            public List<SocialEquityLog> findByU_AID_AD_A_T(long userId,
1812                    String actionId, int actionDate, boolean active, int type, int start,
1813                    int end) throws SystemException {
1814                    return findByU_AID_AD_A_T(userId, actionId, actionDate, active, type,
1815                            start, end, null);
1816            }
1817    
1818            /**
1819             * Finds an ordered range of all the social equity logs where userId = &#63; and actionId = &#63; and actionDate = &#63; and active = &#63; and type = &#63;.
1820             *
1821             * <p>
1822             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1823             * </p>
1824             *
1825             * @param userId the user id to search with
1826             * @param actionId the action id to search with
1827             * @param actionDate the action date to search with
1828             * @param active the active to search with
1829             * @param type the type to search with
1830             * @param start the lower bound of the range of social equity logs to return
1831             * @param end the upper bound of the range of social equity logs to return (not inclusive)
1832             * @param orderByComparator the comparator to order the results by
1833             * @return the ordered range of matching social equity logs
1834             * @throws SystemException if a system exception occurred
1835             */
1836            public List<SocialEquityLog> findByU_AID_AD_A_T(long userId,
1837                    String actionId, int actionDate, boolean active, int type, int start,
1838                    int end, OrderByComparator orderByComparator) throws SystemException {
1839                    Object[] finderArgs = new Object[] {
1840                                    userId, actionId, actionDate, active, type,
1841                                    
1842                                    String.valueOf(start), String.valueOf(end),
1843                                    String.valueOf(orderByComparator)
1844                            };
1845    
1846                    List<SocialEquityLog> list = (List<SocialEquityLog>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_U_AID_AD_A_T,
1847                                    finderArgs, this);
1848    
1849                    if (list == null) {
1850                            StringBundler query = null;
1851    
1852                            if (orderByComparator != null) {
1853                                    query = new StringBundler(7 +
1854                                                    (orderByComparator.getOrderByFields().length * 3));
1855                            }
1856                            else {
1857                                    query = new StringBundler(6);
1858                            }
1859    
1860                            query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
1861    
1862                            query.append(_FINDER_COLUMN_U_AID_AD_A_T_USERID_2);
1863    
1864                            if (actionId == null) {
1865                                    query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_1);
1866                            }
1867                            else {
1868                                    if (actionId.equals(StringPool.BLANK)) {
1869                                            query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_3);
1870                                    }
1871                                    else {
1872                                            query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_2);
1873                                    }
1874                            }
1875    
1876                            query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONDATE_2);
1877    
1878                            query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIVE_2);
1879    
1880                            query.append(_FINDER_COLUMN_U_AID_AD_A_T_TYPE_2);
1881    
1882                            if (orderByComparator != null) {
1883                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1884                                            orderByComparator);
1885                            }
1886    
1887                            String sql = query.toString();
1888    
1889                            Session session = null;
1890    
1891                            try {
1892                                    session = openSession();
1893    
1894                                    Query q = session.createQuery(sql);
1895    
1896                                    QueryPos qPos = QueryPos.getInstance(q);
1897    
1898                                    qPos.add(userId);
1899    
1900                                    if (actionId != null) {
1901                                            qPos.add(actionId);
1902                                    }
1903    
1904                                    qPos.add(actionDate);
1905    
1906                                    qPos.add(active);
1907    
1908                                    qPos.add(type);
1909    
1910                                    list = (List<SocialEquityLog>)QueryUtil.list(q, getDialect(),
1911                                                    start, end);
1912                            }
1913                            catch (Exception e) {
1914                                    throw processException(e);
1915                            }
1916                            finally {
1917                                    if (list == null) {
1918                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_U_AID_AD_A_T,
1919                                                    finderArgs);
1920                                    }
1921                                    else {
1922                                            cacheResult(list);
1923    
1924                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_U_AID_AD_A_T,
1925                                                    finderArgs, list);
1926                                    }
1927    
1928                                    closeSession(session);
1929                            }
1930                    }
1931    
1932                    return list;
1933            }
1934    
1935            /**
1936             * Finds the first social equity log in the ordered set where userId = &#63; and actionId = &#63; and actionDate = &#63; and active = &#63; and type = &#63;.
1937             *
1938             * <p>
1939             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1940             * </p>
1941             *
1942             * @param userId the user id to search with
1943             * @param actionId the action id to search with
1944             * @param actionDate the action date to search with
1945             * @param active the active to search with
1946             * @param type the type to search with
1947             * @param orderByComparator the comparator to order the set by
1948             * @return the first matching social equity log
1949             * @throws com.liferay.portlet.social.NoSuchEquityLogException if a matching social equity log could not be found
1950             * @throws SystemException if a system exception occurred
1951             */
1952            public SocialEquityLog findByU_AID_AD_A_T_First(long userId,
1953                    String actionId, int actionDate, boolean active, int type,
1954                    OrderByComparator orderByComparator)
1955                    throws NoSuchEquityLogException, SystemException {
1956                    List<SocialEquityLog> list = findByU_AID_AD_A_T(userId, actionId,
1957                                    actionDate, active, type, 0, 1, orderByComparator);
1958    
1959                    if (list.isEmpty()) {
1960                            StringBundler msg = new StringBundler(12);
1961    
1962                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1963    
1964                            msg.append("userId=");
1965                            msg.append(userId);
1966    
1967                            msg.append(", actionId=");
1968                            msg.append(actionId);
1969    
1970                            msg.append(", actionDate=");
1971                            msg.append(actionDate);
1972    
1973                            msg.append(", active=");
1974                            msg.append(active);
1975    
1976                            msg.append(", type=");
1977                            msg.append(type);
1978    
1979                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1980    
1981                            throw new NoSuchEquityLogException(msg.toString());
1982                    }
1983                    else {
1984                            return list.get(0);
1985                    }
1986            }
1987    
1988            /**
1989             * Finds the last social equity log in the ordered set where userId = &#63; and actionId = &#63; and actionDate = &#63; and active = &#63; and type = &#63;.
1990             *
1991             * <p>
1992             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1993             * </p>
1994             *
1995             * @param userId the user id to search with
1996             * @param actionId the action id to search with
1997             * @param actionDate the action date to search with
1998             * @param active the active to search with
1999             * @param type the type to search with
2000             * @param orderByComparator the comparator to order the set by
2001             * @return the last matching social equity log
2002             * @throws com.liferay.portlet.social.NoSuchEquityLogException if a matching social equity log could not be found
2003             * @throws SystemException if a system exception occurred
2004             */
2005            public SocialEquityLog findByU_AID_AD_A_T_Last(long userId,
2006                    String actionId, int actionDate, boolean active, int type,
2007                    OrderByComparator orderByComparator)
2008                    throws NoSuchEquityLogException, SystemException {
2009                    int count = countByU_AID_AD_A_T(userId, actionId, actionDate, active,
2010                                    type);
2011    
2012                    List<SocialEquityLog> list = findByU_AID_AD_A_T(userId, actionId,
2013                                    actionDate, active, type, count - 1, count, orderByComparator);
2014    
2015                    if (list.isEmpty()) {
2016                            StringBundler msg = new StringBundler(12);
2017    
2018                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2019    
2020                            msg.append("userId=");
2021                            msg.append(userId);
2022    
2023                            msg.append(", actionId=");
2024                            msg.append(actionId);
2025    
2026                            msg.append(", actionDate=");
2027                            msg.append(actionDate);
2028    
2029                            msg.append(", active=");
2030                            msg.append(active);
2031    
2032                            msg.append(", type=");
2033                            msg.append(type);
2034    
2035                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2036    
2037                            throw new NoSuchEquityLogException(msg.toString());
2038                    }
2039                    else {
2040                            return list.get(0);
2041                    }
2042            }
2043    
2044            /**
2045             * Finds the social equity logs before and after the current social equity log in the ordered set where userId = &#63; and actionId = &#63; and actionDate = &#63; and active = &#63; and type = &#63;.
2046             *
2047             * <p>
2048             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2049             * </p>
2050             *
2051             * @param equityLogId the primary key of the current social equity log
2052             * @param userId the user id to search with
2053             * @param actionId the action id to search with
2054             * @param actionDate the action date to search with
2055             * @param active the active to search with
2056             * @param type the type to search with
2057             * @param orderByComparator the comparator to order the set by
2058             * @return the previous, current, and next social equity log
2059             * @throws com.liferay.portlet.social.NoSuchEquityLogException if a social equity log with the primary key could not be found
2060             * @throws SystemException if a system exception occurred
2061             */
2062            public SocialEquityLog[] findByU_AID_AD_A_T_PrevAndNext(long equityLogId,
2063                    long userId, String actionId, int actionDate, boolean active, int type,
2064                    OrderByComparator orderByComparator)
2065                    throws NoSuchEquityLogException, SystemException {
2066                    SocialEquityLog socialEquityLog = findByPrimaryKey(equityLogId);
2067    
2068                    Session session = null;
2069    
2070                    try {
2071                            session = openSession();
2072    
2073                            SocialEquityLog[] array = new SocialEquityLogImpl[3];
2074    
2075                            array[0] = getByU_AID_AD_A_T_PrevAndNext(session, socialEquityLog,
2076                                            userId, actionId, actionDate, active, type,
2077                                            orderByComparator, true);
2078    
2079                            array[1] = socialEquityLog;
2080    
2081                            array[2] = getByU_AID_AD_A_T_PrevAndNext(session, socialEquityLog,
2082                                            userId, actionId, actionDate, active, type,
2083                                            orderByComparator, false);
2084    
2085                            return array;
2086                    }
2087                    catch (Exception e) {
2088                            throw processException(e);
2089                    }
2090                    finally {
2091                            closeSession(session);
2092                    }
2093            }
2094    
2095            protected SocialEquityLog getByU_AID_AD_A_T_PrevAndNext(Session session,
2096                    SocialEquityLog socialEquityLog, long userId, String actionId,
2097                    int actionDate, boolean active, int type,
2098                    OrderByComparator orderByComparator, boolean previous) {
2099                    StringBundler query = null;
2100    
2101                    if (orderByComparator != null) {
2102                            query = new StringBundler(6 +
2103                                            (orderByComparator.getOrderByFields().length * 6));
2104                    }
2105                    else {
2106                            query = new StringBundler(3);
2107                    }
2108    
2109                    query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
2110    
2111                    query.append(_FINDER_COLUMN_U_AID_AD_A_T_USERID_2);
2112    
2113                    if (actionId == null) {
2114                            query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_1);
2115                    }
2116                    else {
2117                            if (actionId.equals(StringPool.BLANK)) {
2118                                    query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_3);
2119                            }
2120                            else {
2121                                    query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_2);
2122                            }
2123                    }
2124    
2125                    query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONDATE_2);
2126    
2127                    query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIVE_2);
2128    
2129                    query.append(_FINDER_COLUMN_U_AID_AD_A_T_TYPE_2);
2130    
2131                    if (orderByComparator != null) {
2132                            String[] orderByFields = orderByComparator.getOrderByFields();
2133    
2134                            if (orderByFields.length > 0) {
2135                                    query.append(WHERE_AND);
2136                            }
2137    
2138                            for (int i = 0; i < orderByFields.length; i++) {
2139                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2140                                    query.append(orderByFields[i]);
2141    
2142                                    if ((i + 1) < orderByFields.length) {
2143                                            if (orderByComparator.isAscending() ^ previous) {
2144                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
2145                                            }
2146                                            else {
2147                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
2148                                            }
2149                                    }
2150                                    else {
2151                                            if (orderByComparator.isAscending() ^ previous) {
2152                                                    query.append(WHERE_GREATER_THAN);
2153                                            }
2154                                            else {
2155                                                    query.append(WHERE_LESSER_THAN);
2156                                            }
2157                                    }
2158                            }
2159    
2160                            query.append(ORDER_BY_CLAUSE);
2161    
2162                            for (int i = 0; i < orderByFields.length; i++) {
2163                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2164                                    query.append(orderByFields[i]);
2165    
2166                                    if ((i + 1) < orderByFields.length) {
2167                                            if (orderByComparator.isAscending() ^ previous) {
2168                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
2169                                            }
2170                                            else {
2171                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
2172                                            }
2173                                    }
2174                                    else {
2175                                            if (orderByComparator.isAscending() ^ previous) {
2176                                                    query.append(ORDER_BY_ASC);
2177                                            }
2178                                            else {
2179                                                    query.append(ORDER_BY_DESC);
2180                                            }
2181                                    }
2182                            }
2183                    }
2184    
2185                    String sql = query.toString();
2186    
2187                    Query q = session.createQuery(sql);
2188    
2189                    q.setFirstResult(0);
2190                    q.setMaxResults(2);
2191    
2192                    QueryPos qPos = QueryPos.getInstance(q);
2193    
2194                    qPos.add(userId);
2195    
2196                    if (actionId != null) {
2197                            qPos.add(actionId);
2198                    }
2199    
2200                    qPos.add(actionDate);
2201    
2202                    qPos.add(active);
2203    
2204                    qPos.add(type);
2205    
2206                    if (orderByComparator != null) {
2207                            Object[] values = orderByComparator.getOrderByValues(socialEquityLog);
2208    
2209                            for (Object value : values) {
2210                                    qPos.add(value);
2211                            }
2212                    }
2213    
2214                    List<SocialEquityLog> list = q.list();
2215    
2216                    if (list.size() == 2) {
2217                            return list.get(1);
2218                    }
2219                    else {
2220                            return null;
2221                    }
2222            }
2223    
2224            /**
2225             * Finds all the social equity logs where assetEntryId = &#63; and actionId = &#63; and actionDate = &#63; and active = &#63; and type = &#63;.
2226             *
2227             * @param assetEntryId the asset entry id to search with
2228             * @param actionId the action id to search with
2229             * @param actionDate the action date to search with
2230             * @param active the active to search with
2231             * @param type the type to search with
2232             * @return the matching social equity logs
2233             * @throws SystemException if a system exception occurred
2234             */
2235            public List<SocialEquityLog> findByAEI_AID_AD_A_T(long assetEntryId,
2236                    String actionId, int actionDate, boolean active, int type)
2237                    throws SystemException {
2238                    return findByAEI_AID_AD_A_T(assetEntryId, actionId, actionDate, active,
2239                            type, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2240            }
2241    
2242            /**
2243             * Finds a range of all the social equity logs where assetEntryId = &#63; and actionId = &#63; and actionDate = &#63; and active = &#63; and type = &#63;.
2244             *
2245             * <p>
2246             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2247             * </p>
2248             *
2249             * @param assetEntryId the asset entry id to search with
2250             * @param actionId the action id to search with
2251             * @param actionDate the action date to search with
2252             * @param active the active to search with
2253             * @param type the type to search with
2254             * @param start the lower bound of the range of social equity logs to return
2255             * @param end the upper bound of the range of social equity logs to return (not inclusive)
2256             * @return the range of matching social equity logs
2257             * @throws SystemException if a system exception occurred
2258             */
2259            public List<SocialEquityLog> findByAEI_AID_AD_A_T(long assetEntryId,
2260                    String actionId, int actionDate, boolean active, int type, int start,
2261                    int end) throws SystemException {
2262                    return findByAEI_AID_AD_A_T(assetEntryId, actionId, actionDate, active,
2263                            type, start, end, null);
2264            }
2265    
2266            /**
2267             * Finds an ordered range of all the social equity logs where assetEntryId = &#63; and actionId = &#63; and actionDate = &#63; and active = &#63; and type = &#63;.
2268             *
2269             * <p>
2270             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2271             * </p>
2272             *
2273             * @param assetEntryId the asset entry id to search with
2274             * @param actionId the action id to search with
2275             * @param actionDate the action date to search with
2276             * @param active the active to search with
2277             * @param type the type to search with
2278             * @param start the lower bound of the range of social equity logs to return
2279             * @param end the upper bound of the range of social equity logs to return (not inclusive)
2280             * @param orderByComparator the comparator to order the results by
2281             * @return the ordered range of matching social equity logs
2282             * @throws SystemException if a system exception occurred
2283             */
2284            public List<SocialEquityLog> findByAEI_AID_AD_A_T(long assetEntryId,
2285                    String actionId, int actionDate, boolean active, int type, int start,
2286                    int end, OrderByComparator orderByComparator) throws SystemException {
2287                    Object[] finderArgs = new Object[] {
2288                                    assetEntryId, actionId, actionDate, active, type,
2289                                    
2290                                    String.valueOf(start), String.valueOf(end),
2291                                    String.valueOf(orderByComparator)
2292                            };
2293    
2294                    List<SocialEquityLog> list = (List<SocialEquityLog>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_AEI_AID_AD_A_T,
2295                                    finderArgs, this);
2296    
2297                    if (list == null) {
2298                            StringBundler query = null;
2299    
2300                            if (orderByComparator != null) {
2301                                    query = new StringBundler(7 +
2302                                                    (orderByComparator.getOrderByFields().length * 3));
2303                            }
2304                            else {
2305                                    query = new StringBundler(6);
2306                            }
2307    
2308                            query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
2309    
2310                            query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ASSETENTRYID_2);
2311    
2312                            if (actionId == null) {
2313                                    query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_1);
2314                            }
2315                            else {
2316                                    if (actionId.equals(StringPool.BLANK)) {
2317                                            query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_3);
2318                                    }
2319                                    else {
2320                                            query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_2);
2321                                    }
2322                            }
2323    
2324                            query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONDATE_2);
2325    
2326                            query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIVE_2);
2327    
2328                            query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_TYPE_2);
2329    
2330                            if (orderByComparator != null) {
2331                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2332                                            orderByComparator);
2333                            }
2334    
2335                            String sql = query.toString();
2336    
2337                            Session session = null;
2338    
2339                            try {
2340                                    session = openSession();
2341    
2342                                    Query q = session.createQuery(sql);
2343    
2344                                    QueryPos qPos = QueryPos.getInstance(q);
2345    
2346                                    qPos.add(assetEntryId);
2347    
2348                                    if (actionId != null) {
2349                                            qPos.add(actionId);
2350                                    }
2351    
2352                                    qPos.add(actionDate);
2353    
2354                                    qPos.add(active);
2355    
2356                                    qPos.add(type);
2357    
2358                                    list = (List<SocialEquityLog>)QueryUtil.list(q, getDialect(),
2359                                                    start, end);
2360                            }
2361                            catch (Exception e) {
2362                                    throw processException(e);
2363                            }
2364                            finally {
2365                                    if (list == null) {
2366                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_AEI_AID_AD_A_T,
2367                                                    finderArgs);
2368                                    }
2369                                    else {
2370                                            cacheResult(list);
2371    
2372                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_AEI_AID_AD_A_T,
2373                                                    finderArgs, list);
2374                                    }
2375    
2376                                    closeSession(session);
2377                            }
2378                    }
2379    
2380                    return list;
2381            }
2382    
2383            /**
2384             * Finds the first social equity log in the ordered set where assetEntryId = &#63; and actionId = &#63; and actionDate = &#63; and active = &#63; and type = &#63;.
2385             *
2386             * <p>
2387             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2388             * </p>
2389             *
2390             * @param assetEntryId the asset entry id to search with
2391             * @param actionId the action id to search with
2392             * @param actionDate the action date to search with
2393             * @param active the active to search with
2394             * @param type the type to search with
2395             * @param orderByComparator the comparator to order the set by
2396             * @return the first matching social equity log
2397             * @throws com.liferay.portlet.social.NoSuchEquityLogException if a matching social equity log could not be found
2398             * @throws SystemException if a system exception occurred
2399             */
2400            public SocialEquityLog findByAEI_AID_AD_A_T_First(long assetEntryId,
2401                    String actionId, int actionDate, boolean active, int type,
2402                    OrderByComparator orderByComparator)
2403                    throws NoSuchEquityLogException, SystemException {
2404                    List<SocialEquityLog> list = findByAEI_AID_AD_A_T(assetEntryId,
2405                                    actionId, actionDate, active, type, 0, 1, orderByComparator);
2406    
2407                    if (list.isEmpty()) {
2408                            StringBundler msg = new StringBundler(12);
2409    
2410                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2411    
2412                            msg.append("assetEntryId=");
2413                            msg.append(assetEntryId);
2414    
2415                            msg.append(", actionId=");
2416                            msg.append(actionId);
2417    
2418                            msg.append(", actionDate=");
2419                            msg.append(actionDate);
2420    
2421                            msg.append(", active=");
2422                            msg.append(active);
2423    
2424                            msg.append(", type=");
2425                            msg.append(type);
2426    
2427                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2428    
2429                            throw new NoSuchEquityLogException(msg.toString());
2430                    }
2431                    else {
2432                            return list.get(0);
2433                    }
2434            }
2435    
2436            /**
2437             * Finds the last social equity log in the ordered set where assetEntryId = &#63; and actionId = &#63; and actionDate = &#63; and active = &#63; and type = &#63;.
2438             *
2439             * <p>
2440             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2441             * </p>
2442             *
2443             * @param assetEntryId the asset entry id to search with
2444             * @param actionId the action id to search with
2445             * @param actionDate the action date to search with
2446             * @param active the active to search with
2447             * @param type the type to search with
2448             * @param orderByComparator the comparator to order the set by
2449             * @return the last matching social equity log
2450             * @throws com.liferay.portlet.social.NoSuchEquityLogException if a matching social equity log could not be found
2451             * @throws SystemException if a system exception occurred
2452             */
2453            public SocialEquityLog findByAEI_AID_AD_A_T_Last(long assetEntryId,
2454                    String actionId, int actionDate, boolean active, int type,
2455                    OrderByComparator orderByComparator)
2456                    throws NoSuchEquityLogException, SystemException {
2457                    int count = countByAEI_AID_AD_A_T(assetEntryId, actionId, actionDate,
2458                                    active, type);
2459    
2460                    List<SocialEquityLog> list = findByAEI_AID_AD_A_T(assetEntryId,
2461                                    actionId, actionDate, active, type, count - 1, count,
2462                                    orderByComparator);
2463    
2464                    if (list.isEmpty()) {
2465                            StringBundler msg = new StringBundler(12);
2466    
2467                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2468    
2469                            msg.append("assetEntryId=");
2470                            msg.append(assetEntryId);
2471    
2472                            msg.append(", actionId=");
2473                            msg.append(actionId);
2474    
2475                            msg.append(", actionDate=");
2476                            msg.append(actionDate);
2477    
2478                            msg.append(", active=");
2479                            msg.append(active);
2480    
2481                            msg.append(", type=");
2482                            msg.append(type);
2483    
2484                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2485    
2486                            throw new NoSuchEquityLogException(msg.toString());
2487                    }
2488                    else {
2489                            return list.get(0);
2490                    }
2491            }
2492    
2493            /**
2494             * Finds the social equity logs before and after the current social equity log in the ordered set where assetEntryId = &#63; and actionId = &#63; and actionDate = &#63; and active = &#63; and type = &#63;.
2495             *
2496             * <p>
2497             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2498             * </p>
2499             *
2500             * @param equityLogId the primary key of the current social equity log
2501             * @param assetEntryId the asset entry id to search with
2502             * @param actionId the action id to search with
2503             * @param actionDate the action date to search with
2504             * @param active the active to search with
2505             * @param type the type to search with
2506             * @param orderByComparator the comparator to order the set by
2507             * @return the previous, current, and next social equity log
2508             * @throws com.liferay.portlet.social.NoSuchEquityLogException if a social equity log with the primary key could not be found
2509             * @throws SystemException if a system exception occurred
2510             */
2511            public SocialEquityLog[] findByAEI_AID_AD_A_T_PrevAndNext(
2512                    long equityLogId, long assetEntryId, String actionId, int actionDate,
2513                    boolean active, int type, OrderByComparator orderByComparator)
2514                    throws NoSuchEquityLogException, SystemException {
2515                    SocialEquityLog socialEquityLog = findByPrimaryKey(equityLogId);
2516    
2517                    Session session = null;
2518    
2519                    try {
2520                            session = openSession();
2521    
2522                            SocialEquityLog[] array = new SocialEquityLogImpl[3];
2523    
2524                            array[0] = getByAEI_AID_AD_A_T_PrevAndNext(session,
2525                                            socialEquityLog, assetEntryId, actionId, actionDate,
2526                                            active, type, orderByComparator, true);
2527    
2528                            array[1] = socialEquityLog;
2529    
2530                            array[2] = getByAEI_AID_AD_A_T_PrevAndNext(session,
2531                                            socialEquityLog, assetEntryId, actionId, actionDate,
2532                                            active, type, orderByComparator, false);
2533    
2534                            return array;
2535                    }
2536                    catch (Exception e) {
2537                            throw processException(e);
2538                    }
2539                    finally {
2540                            closeSession(session);
2541                    }
2542            }
2543    
2544            protected SocialEquityLog getByAEI_AID_AD_A_T_PrevAndNext(Session session,
2545                    SocialEquityLog socialEquityLog, long assetEntryId, String actionId,
2546                    int actionDate, boolean active, int type,
2547                    OrderByComparator orderByComparator, boolean previous) {
2548                    StringBundler query = null;
2549    
2550                    if (orderByComparator != null) {
2551                            query = new StringBundler(6 +
2552                                            (orderByComparator.getOrderByFields().length * 6));
2553                    }
2554                    else {
2555                            query = new StringBundler(3);
2556                    }
2557    
2558                    query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
2559    
2560                    query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ASSETENTRYID_2);
2561    
2562                    if (actionId == null) {
2563                            query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_1);
2564                    }
2565                    else {
2566                            if (actionId.equals(StringPool.BLANK)) {
2567                                    query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_3);
2568                            }
2569                            else {
2570                                    query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_2);
2571                            }
2572                    }
2573    
2574                    query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONDATE_2);
2575    
2576                    query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIVE_2);
2577    
2578                    query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_TYPE_2);
2579    
2580                    if (orderByComparator != null) {
2581                            String[] orderByFields = orderByComparator.getOrderByFields();
2582    
2583                            if (orderByFields.length > 0) {
2584                                    query.append(WHERE_AND);
2585                            }
2586    
2587                            for (int i = 0; i < orderByFields.length; i++) {
2588                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2589                                    query.append(orderByFields[i]);
2590    
2591                                    if ((i + 1) < orderByFields.length) {
2592                                            if (orderByComparator.isAscending() ^ previous) {
2593                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
2594                                            }
2595                                            else {
2596                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
2597                                            }
2598                                    }
2599                                    else {
2600                                            if (orderByComparator.isAscending() ^ previous) {
2601                                                    query.append(WHERE_GREATER_THAN);
2602                                            }
2603                                            else {
2604                                                    query.append(WHERE_LESSER_THAN);
2605                                            }
2606                                    }
2607                            }
2608    
2609                            query.append(ORDER_BY_CLAUSE);
2610    
2611                            for (int i = 0; i < orderByFields.length; i++) {
2612                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2613                                    query.append(orderByFields[i]);
2614    
2615                                    if ((i + 1) < orderByFields.length) {
2616                                            if (orderByComparator.isAscending() ^ previous) {
2617                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
2618                                            }
2619                                            else {
2620                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
2621                                            }
2622                                    }
2623                                    else {
2624                                            if (orderByComparator.isAscending() ^ previous) {
2625                                                    query.append(ORDER_BY_ASC);
2626                                            }
2627                                            else {
2628                                                    query.append(ORDER_BY_DESC);
2629                                            }
2630                                    }
2631                            }
2632                    }
2633    
2634                    String sql = query.toString();
2635    
2636                    Query q = session.createQuery(sql);
2637    
2638                    q.setFirstResult(0);
2639                    q.setMaxResults(2);
2640    
2641                    QueryPos qPos = QueryPos.getInstance(q);
2642    
2643                    qPos.add(assetEntryId);
2644    
2645                    if (actionId != null) {
2646                            qPos.add(actionId);
2647                    }
2648    
2649                    qPos.add(actionDate);
2650    
2651                    qPos.add(active);
2652    
2653                    qPos.add(type);
2654    
2655                    if (orderByComparator != null) {
2656                            Object[] values = orderByComparator.getOrderByValues(socialEquityLog);
2657    
2658                            for (Object value : values) {
2659                                    qPos.add(value);
2660                            }
2661                    }
2662    
2663                    List<SocialEquityLog> list = q.list();
2664    
2665                    if (list.size() == 2) {
2666                            return list.get(1);
2667                    }
2668                    else {
2669                            return null;
2670                    }
2671            }
2672    
2673            /**
2674             * Finds the social equity log where userId = &#63; and assetEntryId = &#63; and actionId = &#63; and actionDate = &#63; and active = &#63; and type = &#63; or throws a {@link com.liferay.portlet.social.NoSuchEquityLogException} if it could not be found.
2675             *
2676             * @param userId the user id to search with
2677             * @param assetEntryId the asset entry id to search with
2678             * @param actionId the action id to search with
2679             * @param actionDate the action date to search with
2680             * @param active the active to search with
2681             * @param type the type to search with
2682             * @return the matching social equity log
2683             * @throws com.liferay.portlet.social.NoSuchEquityLogException if a matching social equity log could not be found
2684             * @throws SystemException if a system exception occurred
2685             */
2686            public SocialEquityLog findByU_AEI_AID_AD_A_T(long userId,
2687                    long assetEntryId, String actionId, int actionDate, boolean active,
2688                    int type) throws NoSuchEquityLogException, SystemException {
2689                    SocialEquityLog socialEquityLog = fetchByU_AEI_AID_AD_A_T(userId,
2690                                    assetEntryId, actionId, actionDate, active, type);
2691    
2692                    if (socialEquityLog == null) {
2693                            StringBundler msg = new StringBundler(14);
2694    
2695                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2696    
2697                            msg.append("userId=");
2698                            msg.append(userId);
2699    
2700                            msg.append(", assetEntryId=");
2701                            msg.append(assetEntryId);
2702    
2703                            msg.append(", actionId=");
2704                            msg.append(actionId);
2705    
2706                            msg.append(", actionDate=");
2707                            msg.append(actionDate);
2708    
2709                            msg.append(", active=");
2710                            msg.append(active);
2711    
2712                            msg.append(", type=");
2713                            msg.append(type);
2714    
2715                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2716    
2717                            if (_log.isWarnEnabled()) {
2718                                    _log.warn(msg.toString());
2719                            }
2720    
2721                            throw new NoSuchEquityLogException(msg.toString());
2722                    }
2723    
2724                    return socialEquityLog;
2725            }
2726    
2727            /**
2728             * Finds the social equity log where userId = &#63; and assetEntryId = &#63; and actionId = &#63; and actionDate = &#63; and active = &#63; and type = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
2729             *
2730             * @param userId the user id to search with
2731             * @param assetEntryId the asset entry id to search with
2732             * @param actionId the action id to search with
2733             * @param actionDate the action date to search with
2734             * @param active the active to search with
2735             * @param type the type to search with
2736             * @return the matching social equity log, or <code>null</code> if a matching social equity log could not be found
2737             * @throws SystemException if a system exception occurred
2738             */
2739            public SocialEquityLog fetchByU_AEI_AID_AD_A_T(long userId,
2740                    long assetEntryId, String actionId, int actionDate, boolean active,
2741                    int type) throws SystemException {
2742                    return fetchByU_AEI_AID_AD_A_T(userId, assetEntryId, actionId,
2743                            actionDate, active, type, true);
2744            }
2745    
2746            /**
2747             * Finds the social equity log where userId = &#63; and assetEntryId = &#63; and actionId = &#63; and actionDate = &#63; and active = &#63; and type = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
2748             *
2749             * @param userId the user id to search with
2750             * @param assetEntryId the asset entry id to search with
2751             * @param actionId the action id to search with
2752             * @param actionDate the action date to search with
2753             * @param active the active to search with
2754             * @param type the type to search with
2755             * @return the matching social equity log, or <code>null</code> if a matching social equity log could not be found
2756             * @throws SystemException if a system exception occurred
2757             */
2758            public SocialEquityLog fetchByU_AEI_AID_AD_A_T(long userId,
2759                    long assetEntryId, String actionId, int actionDate, boolean active,
2760                    int type, boolean retrieveFromCache) throws SystemException {
2761                    Object[] finderArgs = new Object[] {
2762                                    userId, assetEntryId, actionId, actionDate, active, type
2763                            };
2764    
2765                    Object result = null;
2766    
2767                    if (retrieveFromCache) {
2768                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
2769                                            finderArgs, this);
2770                    }
2771    
2772                    if (result == null) {
2773                            StringBundler query = new StringBundler(7);
2774    
2775                            query.append(_SQL_SELECT_SOCIALEQUITYLOG_WHERE);
2776    
2777                            query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_USERID_2);
2778    
2779                            query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ASSETENTRYID_2);
2780    
2781                            if (actionId == null) {
2782                                    query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_1);
2783                            }
2784                            else {
2785                                    if (actionId.equals(StringPool.BLANK)) {
2786                                            query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_3);
2787                                    }
2788                                    else {
2789                                            query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_2);
2790                                    }
2791                            }
2792    
2793                            query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONDATE_2);
2794    
2795                            query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIVE_2);
2796    
2797                            query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_TYPE_2);
2798    
2799                            String sql = query.toString();
2800    
2801                            Session session = null;
2802    
2803                            try {
2804                                    session = openSession();
2805    
2806                                    Query q = session.createQuery(sql);
2807    
2808                                    QueryPos qPos = QueryPos.getInstance(q);
2809    
2810                                    qPos.add(userId);
2811    
2812                                    qPos.add(assetEntryId);
2813    
2814                                    if (actionId != null) {
2815                                            qPos.add(actionId);
2816                                    }
2817    
2818                                    qPos.add(actionDate);
2819    
2820                                    qPos.add(active);
2821    
2822                                    qPos.add(type);
2823    
2824                                    List<SocialEquityLog> list = q.list();
2825    
2826                                    result = list;
2827    
2828                                    SocialEquityLog socialEquityLog = null;
2829    
2830                                    if (list.isEmpty()) {
2831                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
2832                                                    finderArgs, list);
2833                                    }
2834                                    else {
2835                                            socialEquityLog = list.get(0);
2836    
2837                                            cacheResult(socialEquityLog);
2838    
2839                                            if ((socialEquityLog.getUserId() != userId) ||
2840                                                            (socialEquityLog.getAssetEntryId() != assetEntryId) ||
2841                                                            (socialEquityLog.getActionId() == null) ||
2842                                                            !socialEquityLog.getActionId().equals(actionId) ||
2843                                                            (socialEquityLog.getActionDate() != actionDate) ||
2844                                                            (socialEquityLog.getActive() != active) ||
2845                                                            (socialEquityLog.getType() != type)) {
2846                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
2847                                                            finderArgs, socialEquityLog);
2848                                            }
2849                                    }
2850    
2851                                    return socialEquityLog;
2852                            }
2853                            catch (Exception e) {
2854                                    throw processException(e);
2855                            }
2856                            finally {
2857                                    if (result == null) {
2858                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_U_AEI_AID_AD_A_T,
2859                                                    finderArgs);
2860                                    }
2861    
2862                                    closeSession(session);
2863                            }
2864                    }
2865                    else {
2866                            if (result instanceof List<?>) {
2867                                    return null;
2868                            }
2869                            else {
2870                                    return (SocialEquityLog)result;
2871                            }
2872                    }
2873            }
2874    
2875            /**
2876             * Finds all the social equity logs.
2877             *
2878             * @return the social equity logs
2879             * @throws SystemException if a system exception occurred
2880             */
2881            public List<SocialEquityLog> findAll() throws SystemException {
2882                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2883            }
2884    
2885            /**
2886             * Finds a range of all the social equity logs.
2887             *
2888             * <p>
2889             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2890             * </p>
2891             *
2892             * @param start the lower bound of the range of social equity logs to return
2893             * @param end the upper bound of the range of social equity logs to return (not inclusive)
2894             * @return the range of social equity logs
2895             * @throws SystemException if a system exception occurred
2896             */
2897            public List<SocialEquityLog> findAll(int start, int end)
2898                    throws SystemException {
2899                    return findAll(start, end, null);
2900            }
2901    
2902            /**
2903             * Finds an ordered range of all the social equity logs.
2904             *
2905             * <p>
2906             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2907             * </p>
2908             *
2909             * @param start the lower bound of the range of social equity logs to return
2910             * @param end the upper bound of the range of social equity logs to return (not inclusive)
2911             * @param orderByComparator the comparator to order the results by
2912             * @return the ordered range of social equity logs
2913             * @throws SystemException if a system exception occurred
2914             */
2915            public List<SocialEquityLog> findAll(int start, int end,
2916                    OrderByComparator orderByComparator) throws SystemException {
2917                    Object[] finderArgs = new Object[] {
2918                                    String.valueOf(start), String.valueOf(end),
2919                                    String.valueOf(orderByComparator)
2920                            };
2921    
2922                    List<SocialEquityLog> list = (List<SocialEquityLog>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2923                                    finderArgs, this);
2924    
2925                    if (list == null) {
2926                            StringBundler query = null;
2927                            String sql = null;
2928    
2929                            if (orderByComparator != null) {
2930                                    query = new StringBundler(2 +
2931                                                    (orderByComparator.getOrderByFields().length * 3));
2932    
2933                                    query.append(_SQL_SELECT_SOCIALEQUITYLOG);
2934    
2935                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2936                                            orderByComparator);
2937    
2938                                    sql = query.toString();
2939                            }
2940                            else {
2941                                    sql = _SQL_SELECT_SOCIALEQUITYLOG;
2942                            }
2943    
2944                            Session session = null;
2945    
2946                            try {
2947                                    session = openSession();
2948    
2949                                    Query q = session.createQuery(sql);
2950    
2951                                    if (orderByComparator == null) {
2952                                            list = (List<SocialEquityLog>)QueryUtil.list(q,
2953                                                            getDialect(), start, end, false);
2954    
2955                                            Collections.sort(list);
2956                                    }
2957                                    else {
2958                                            list = (List<SocialEquityLog>)QueryUtil.list(q,
2959                                                            getDialect(), start, end);
2960                                    }
2961                            }
2962                            catch (Exception e) {
2963                                    throw processException(e);
2964                            }
2965                            finally {
2966                                    if (list == null) {
2967                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL,
2968                                                    finderArgs);
2969                                    }
2970                                    else {
2971                                            cacheResult(list);
2972    
2973                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs,
2974                                                    list);
2975                                    }
2976    
2977                                    closeSession(session);
2978                            }
2979                    }
2980    
2981                    return list;
2982            }
2983    
2984            /**
2985             * Removes all the social equity logs where assetEntryId = &#63; and type = &#63; and active = &#63; from the database.
2986             *
2987             * @param assetEntryId the asset entry id to search with
2988             * @param type the type to search with
2989             * @param active the active to search with
2990             * @throws SystemException if a system exception occurred
2991             */
2992            public void removeByAEI_T_A(long assetEntryId, int type, boolean active)
2993                    throws SystemException {
2994                    for (SocialEquityLog socialEquityLog : findByAEI_T_A(assetEntryId,
2995                                    type, active)) {
2996                            remove(socialEquityLog);
2997                    }
2998            }
2999    
3000            /**
3001             * Removes all the social equity logs where userId = &#63; and actionId = &#63; and active = &#63; and type = &#63; from the database.
3002             *
3003             * @param userId the user id to search with
3004             * @param actionId the action id to search with
3005             * @param active the active to search with
3006             * @param type the type to search with
3007             * @throws SystemException if a system exception occurred
3008             */
3009            public void removeByU_AID_A_T(long userId, String actionId, boolean active,
3010                    int type) throws SystemException {
3011                    for (SocialEquityLog socialEquityLog : findByU_AID_A_T(userId,
3012                                    actionId, active, type)) {
3013                            remove(socialEquityLog);
3014                    }
3015            }
3016    
3017            /**
3018             * Removes all the social equity logs where assetEntryId = &#63; and actionId = &#63; and active = &#63; and type = &#63; from the database.
3019             *
3020             * @param assetEntryId the asset entry id to search with
3021             * @param actionId the action id to search with
3022             * @param active the active to search with
3023             * @param type the type to search with
3024             * @throws SystemException if a system exception occurred
3025             */
3026            public void removeByAEI_AID_A_T(long assetEntryId, String actionId,
3027                    boolean active, int type) throws SystemException {
3028                    for (SocialEquityLog socialEquityLog : findByAEI_AID_A_T(assetEntryId,
3029                                    actionId, active, type)) {
3030                            remove(socialEquityLog);
3031                    }
3032            }
3033    
3034            /**
3035             * Removes all the social equity logs where userId = &#63; and actionId = &#63; and actionDate = &#63; and active = &#63; and type = &#63; from the database.
3036             *
3037             * @param userId the user id to search with
3038             * @param actionId the action id to search with
3039             * @param actionDate the action date to search with
3040             * @param active the active to search with
3041             * @param type the type to search with
3042             * @throws SystemException if a system exception occurred
3043             */
3044            public void removeByU_AID_AD_A_T(long userId, String actionId,
3045                    int actionDate, boolean active, int type) throws SystemException {
3046                    for (SocialEquityLog socialEquityLog : findByU_AID_AD_A_T(userId,
3047                                    actionId, actionDate, active, type)) {
3048                            remove(socialEquityLog);
3049                    }
3050            }
3051    
3052            /**
3053             * Removes all the social equity logs where assetEntryId = &#63; and actionId = &#63; and actionDate = &#63; and active = &#63; and type = &#63; from the database.
3054             *
3055             * @param assetEntryId the asset entry id to search with
3056             * @param actionId the action id to search with
3057             * @param actionDate the action date to search with
3058             * @param active the active to search with
3059             * @param type the type to search with
3060             * @throws SystemException if a system exception occurred
3061             */
3062            public void removeByAEI_AID_AD_A_T(long assetEntryId, String actionId,
3063                    int actionDate, boolean active, int type) throws SystemException {
3064                    for (SocialEquityLog socialEquityLog : findByAEI_AID_AD_A_T(
3065                                    assetEntryId, actionId, actionDate, active, type)) {
3066                            remove(socialEquityLog);
3067                    }
3068            }
3069    
3070            /**
3071             * Removes the social equity log where userId = &#63; and assetEntryId = &#63; and actionId = &#63; and actionDate = &#63; and active = &#63; and type = &#63; from the database.
3072             *
3073             * @param userId the user id to search with
3074             * @param assetEntryId the asset entry id to search with
3075             * @param actionId the action id to search with
3076             * @param actionDate the action date to search with
3077             * @param active the active to search with
3078             * @param type the type to search with
3079             * @throws SystemException if a system exception occurred
3080             */
3081            public void removeByU_AEI_AID_AD_A_T(long userId, long assetEntryId,
3082                    String actionId, int actionDate, boolean active, int type)
3083                    throws NoSuchEquityLogException, SystemException {
3084                    SocialEquityLog socialEquityLog = findByU_AEI_AID_AD_A_T(userId,
3085                                    assetEntryId, actionId, actionDate, active, type);
3086    
3087                    remove(socialEquityLog);
3088            }
3089    
3090            /**
3091             * Removes all the social equity logs from the database.
3092             *
3093             * @throws SystemException if a system exception occurred
3094             */
3095            public void removeAll() throws SystemException {
3096                    for (SocialEquityLog socialEquityLog : findAll()) {
3097                            remove(socialEquityLog);
3098                    }
3099            }
3100    
3101            /**
3102             * Counts all the social equity logs where assetEntryId = &#63; and type = &#63; and active = &#63;.
3103             *
3104             * @param assetEntryId the asset entry id to search with
3105             * @param type the type to search with
3106             * @param active the active to search with
3107             * @return the number of matching social equity logs
3108             * @throws SystemException if a system exception occurred
3109             */
3110            public int countByAEI_T_A(long assetEntryId, int type, boolean active)
3111                    throws SystemException {
3112                    Object[] finderArgs = new Object[] { assetEntryId, type, active };
3113    
3114                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_AEI_T_A,
3115                                    finderArgs, this);
3116    
3117                    if (count == null) {
3118                            StringBundler query = new StringBundler(4);
3119    
3120                            query.append(_SQL_COUNT_SOCIALEQUITYLOG_WHERE);
3121    
3122                            query.append(_FINDER_COLUMN_AEI_T_A_ASSETENTRYID_2);
3123    
3124                            query.append(_FINDER_COLUMN_AEI_T_A_TYPE_2);
3125    
3126                            query.append(_FINDER_COLUMN_AEI_T_A_ACTIVE_2);
3127    
3128                            String sql = query.toString();
3129    
3130                            Session session = null;
3131    
3132                            try {
3133                                    session = openSession();
3134    
3135                                    Query q = session.createQuery(sql);
3136    
3137                                    QueryPos qPos = QueryPos.getInstance(q);
3138    
3139                                    qPos.add(assetEntryId);
3140    
3141                                    qPos.add(type);
3142    
3143                                    qPos.add(active);
3144    
3145                                    count = (Long)q.uniqueResult();
3146                            }
3147                            catch (Exception e) {
3148                                    throw processException(e);
3149                            }
3150                            finally {
3151                                    if (count == null) {
3152                                            count = Long.valueOf(0);
3153                                    }
3154    
3155                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_AEI_T_A,
3156                                            finderArgs, count);
3157    
3158                                    closeSession(session);
3159                            }
3160                    }
3161    
3162                    return count.intValue();
3163            }
3164    
3165            /**
3166             * Counts all the social equity logs where userId = &#63; and actionId = &#63; and active = &#63; and type = &#63;.
3167             *
3168             * @param userId the user id to search with
3169             * @param actionId the action id to search with
3170             * @param active the active to search with
3171             * @param type the type to search with
3172             * @return the number of matching social equity logs
3173             * @throws SystemException if a system exception occurred
3174             */
3175            public int countByU_AID_A_T(long userId, String actionId, boolean active,
3176                    int type) throws SystemException {
3177                    Object[] finderArgs = new Object[] { userId, actionId, active, type };
3178    
3179                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_AID_A_T,
3180                                    finderArgs, this);
3181    
3182                    if (count == null) {
3183                            StringBundler query = new StringBundler(5);
3184    
3185                            query.append(_SQL_COUNT_SOCIALEQUITYLOG_WHERE);
3186    
3187                            query.append(_FINDER_COLUMN_U_AID_A_T_USERID_2);
3188    
3189                            if (actionId == null) {
3190                                    query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_1);
3191                            }
3192                            else {
3193                                    if (actionId.equals(StringPool.BLANK)) {
3194                                            query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_3);
3195                                    }
3196                                    else {
3197                                            query.append(_FINDER_COLUMN_U_AID_A_T_ACTIONID_2);
3198                                    }
3199                            }
3200    
3201                            query.append(_FINDER_COLUMN_U_AID_A_T_ACTIVE_2);
3202    
3203                            query.append(_FINDER_COLUMN_U_AID_A_T_TYPE_2);
3204    
3205                            String sql = query.toString();
3206    
3207                            Session session = null;
3208    
3209                            try {
3210                                    session = openSession();
3211    
3212                                    Query q = session.createQuery(sql);
3213    
3214                                    QueryPos qPos = QueryPos.getInstance(q);
3215    
3216                                    qPos.add(userId);
3217    
3218                                    if (actionId != null) {
3219                                            qPos.add(actionId);
3220                                    }
3221    
3222                                    qPos.add(active);
3223    
3224                                    qPos.add(type);
3225    
3226                                    count = (Long)q.uniqueResult();
3227                            }
3228                            catch (Exception e) {
3229                                    throw processException(e);
3230                            }
3231                            finally {
3232                                    if (count == null) {
3233                                            count = Long.valueOf(0);
3234                                    }
3235    
3236                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_AID_A_T,
3237                                            finderArgs, count);
3238    
3239                                    closeSession(session);
3240                            }
3241                    }
3242    
3243                    return count.intValue();
3244            }
3245    
3246            /**
3247             * Counts all the social equity logs where assetEntryId = &#63; and actionId = &#63; and active = &#63; and type = &#63;.
3248             *
3249             * @param assetEntryId the asset entry id to search with
3250             * @param actionId the action id to search with
3251             * @param active the active to search with
3252             * @param type the type to search with
3253             * @return the number of matching social equity logs
3254             * @throws SystemException if a system exception occurred
3255             */
3256            public int countByAEI_AID_A_T(long assetEntryId, String actionId,
3257                    boolean active, int type) throws SystemException {
3258                    Object[] finderArgs = new Object[] { assetEntryId, actionId, active, type };
3259    
3260                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_AEI_AID_A_T,
3261                                    finderArgs, this);
3262    
3263                    if (count == null) {
3264                            StringBundler query = new StringBundler(5);
3265    
3266                            query.append(_SQL_COUNT_SOCIALEQUITYLOG_WHERE);
3267    
3268                            query.append(_FINDER_COLUMN_AEI_AID_A_T_ASSETENTRYID_2);
3269    
3270                            if (actionId == null) {
3271                                    query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_1);
3272                            }
3273                            else {
3274                                    if (actionId.equals(StringPool.BLANK)) {
3275                                            query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_3);
3276                                    }
3277                                    else {
3278                                            query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIONID_2);
3279                                    }
3280                            }
3281    
3282                            query.append(_FINDER_COLUMN_AEI_AID_A_T_ACTIVE_2);
3283    
3284                            query.append(_FINDER_COLUMN_AEI_AID_A_T_TYPE_2);
3285    
3286                            String sql = query.toString();
3287    
3288                            Session session = null;
3289    
3290                            try {
3291                                    session = openSession();
3292    
3293                                    Query q = session.createQuery(sql);
3294    
3295                                    QueryPos qPos = QueryPos.getInstance(q);
3296    
3297                                    qPos.add(assetEntryId);
3298    
3299                                    if (actionId != null) {
3300                                            qPos.add(actionId);
3301                                    }
3302    
3303                                    qPos.add(active);
3304    
3305                                    qPos.add(type);
3306    
3307                                    count = (Long)q.uniqueResult();
3308                            }
3309                            catch (Exception e) {
3310                                    throw processException(e);
3311                            }
3312                            finally {
3313                                    if (count == null) {
3314                                            count = Long.valueOf(0);
3315                                    }
3316    
3317                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_AEI_AID_A_T,
3318                                            finderArgs, count);
3319    
3320                                    closeSession(session);
3321                            }
3322                    }
3323    
3324                    return count.intValue();
3325            }
3326    
3327            /**
3328             * Counts all the social equity logs where userId = &#63; and actionId = &#63; and actionDate = &#63; and active = &#63; and type = &#63;.
3329             *
3330             * @param userId the user id to search with
3331             * @param actionId the action id to search with
3332             * @param actionDate the action date to search with
3333             * @param active the active to search with
3334             * @param type the type to search with
3335             * @return the number of matching social equity logs
3336             * @throws SystemException if a system exception occurred
3337             */
3338            public int countByU_AID_AD_A_T(long userId, String actionId,
3339                    int actionDate, boolean active, int type) throws SystemException {
3340                    Object[] finderArgs = new Object[] {
3341                                    userId, actionId, actionDate, active, type
3342                            };
3343    
3344                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_AID_AD_A_T,
3345                                    finderArgs, this);
3346    
3347                    if (count == null) {
3348                            StringBundler query = new StringBundler(6);
3349    
3350                            query.append(_SQL_COUNT_SOCIALEQUITYLOG_WHERE);
3351    
3352                            query.append(_FINDER_COLUMN_U_AID_AD_A_T_USERID_2);
3353    
3354                            if (actionId == null) {
3355                                    query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_1);
3356                            }
3357                            else {
3358                                    if (actionId.equals(StringPool.BLANK)) {
3359                                            query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_3);
3360                                    }
3361                                    else {
3362                                            query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_2);
3363                                    }
3364                            }
3365    
3366                            query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIONDATE_2);
3367    
3368                            query.append(_FINDER_COLUMN_U_AID_AD_A_T_ACTIVE_2);
3369    
3370                            query.append(_FINDER_COLUMN_U_AID_AD_A_T_TYPE_2);
3371    
3372                            String sql = query.toString();
3373    
3374                            Session session = null;
3375    
3376                            try {
3377                                    session = openSession();
3378    
3379                                    Query q = session.createQuery(sql);
3380    
3381                                    QueryPos qPos = QueryPos.getInstance(q);
3382    
3383                                    qPos.add(userId);
3384    
3385                                    if (actionId != null) {
3386                                            qPos.add(actionId);
3387                                    }
3388    
3389                                    qPos.add(actionDate);
3390    
3391                                    qPos.add(active);
3392    
3393                                    qPos.add(type);
3394    
3395                                    count = (Long)q.uniqueResult();
3396                            }
3397                            catch (Exception e) {
3398                                    throw processException(e);
3399                            }
3400                            finally {
3401                                    if (count == null) {
3402                                            count = Long.valueOf(0);
3403                                    }
3404    
3405                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_AID_AD_A_T,
3406                                            finderArgs, count);
3407    
3408                                    closeSession(session);
3409                            }
3410                    }
3411    
3412                    return count.intValue();
3413            }
3414    
3415            /**
3416             * Counts all the social equity logs where assetEntryId = &#63; and actionId = &#63; and actionDate = &#63; and active = &#63; and type = &#63;.
3417             *
3418             * @param assetEntryId the asset entry id to search with
3419             * @param actionId the action id to search with
3420             * @param actionDate the action date to search with
3421             * @param active the active to search with
3422             * @param type the type to search with
3423             * @return the number of matching social equity logs
3424             * @throws SystemException if a system exception occurred
3425             */
3426            public int countByAEI_AID_AD_A_T(long assetEntryId, String actionId,
3427                    int actionDate, boolean active, int type) throws SystemException {
3428                    Object[] finderArgs = new Object[] {
3429                                    assetEntryId, actionId, actionDate, active, type
3430                            };
3431    
3432                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_AEI_AID_AD_A_T,
3433                                    finderArgs, this);
3434    
3435                    if (count == null) {
3436                            StringBundler query = new StringBundler(6);
3437    
3438                            query.append(_SQL_COUNT_SOCIALEQUITYLOG_WHERE);
3439    
3440                            query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ASSETENTRYID_2);
3441    
3442                            if (actionId == null) {
3443                                    query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_1);
3444                            }
3445                            else {
3446                                    if (actionId.equals(StringPool.BLANK)) {
3447                                            query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_3);
3448                                    }
3449                                    else {
3450                                            query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_2);
3451                                    }
3452                            }
3453    
3454                            query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONDATE_2);
3455    
3456                            query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_ACTIVE_2);
3457    
3458                            query.append(_FINDER_COLUMN_AEI_AID_AD_A_T_TYPE_2);
3459    
3460                            String sql = query.toString();
3461    
3462                            Session session = null;
3463    
3464                            try {
3465                                    session = openSession();
3466    
3467                                    Query q = session.createQuery(sql);
3468    
3469                                    QueryPos qPos = QueryPos.getInstance(q);
3470    
3471                                    qPos.add(assetEntryId);
3472    
3473                                    if (actionId != null) {
3474                                            qPos.add(actionId);
3475                                    }
3476    
3477                                    qPos.add(actionDate);
3478    
3479                                    qPos.add(active);
3480    
3481                                    qPos.add(type);
3482    
3483                                    count = (Long)q.uniqueResult();
3484                            }
3485                            catch (Exception e) {
3486                                    throw processException(e);
3487                            }
3488                            finally {
3489                                    if (count == null) {
3490                                            count = Long.valueOf(0);
3491                                    }
3492    
3493                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_AEI_AID_AD_A_T,
3494                                            finderArgs, count);
3495    
3496                                    closeSession(session);
3497                            }
3498                    }
3499    
3500                    return count.intValue();
3501            }
3502    
3503            /**
3504             * Counts all the social equity logs where userId = &#63; and assetEntryId = &#63; and actionId = &#63; and actionDate = &#63; and active = &#63; and type = &#63;.
3505             *
3506             * @param userId the user id to search with
3507             * @param assetEntryId the asset entry id to search with
3508             * @param actionId the action id to search with
3509             * @param actionDate the action date to search with
3510             * @param active the active to search with
3511             * @param type the type to search with
3512             * @return the number of matching social equity logs
3513             * @throws SystemException if a system exception occurred
3514             */
3515            public int countByU_AEI_AID_AD_A_T(long userId, long assetEntryId,
3516                    String actionId, int actionDate, boolean active, int type)
3517                    throws SystemException {
3518                    Object[] finderArgs = new Object[] {
3519                                    userId, assetEntryId, actionId, actionDate, active, type
3520                            };
3521    
3522                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_AEI_AID_AD_A_T,
3523                                    finderArgs, this);
3524    
3525                    if (count == null) {
3526                            StringBundler query = new StringBundler(7);
3527    
3528                            query.append(_SQL_COUNT_SOCIALEQUITYLOG_WHERE);
3529    
3530                            query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_USERID_2);
3531    
3532                            query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ASSETENTRYID_2);
3533    
3534                            if (actionId == null) {
3535                                    query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_1);
3536                            }
3537                            else {
3538                                    if (actionId.equals(StringPool.BLANK)) {
3539                                            query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_3);
3540                                    }
3541                                    else {
3542                                            query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_2);
3543                                    }
3544                            }
3545    
3546                            query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONDATE_2);
3547    
3548                            query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIVE_2);
3549    
3550                            query.append(_FINDER_COLUMN_U_AEI_AID_AD_A_T_TYPE_2);
3551    
3552                            String sql = query.toString();
3553    
3554                            Session session = null;
3555    
3556                            try {
3557                                    session = openSession();
3558    
3559                                    Query q = session.createQuery(sql);
3560    
3561                                    QueryPos qPos = QueryPos.getInstance(q);
3562    
3563                                    qPos.add(userId);
3564    
3565                                    qPos.add(assetEntryId);
3566    
3567                                    if (actionId != null) {
3568                                            qPos.add(actionId);
3569                                    }
3570    
3571                                    qPos.add(actionDate);
3572    
3573                                    qPos.add(active);
3574    
3575                                    qPos.add(type);
3576    
3577                                    count = (Long)q.uniqueResult();
3578                            }
3579                            catch (Exception e) {
3580                                    throw processException(e);
3581                            }
3582                            finally {
3583                                    if (count == null) {
3584                                            count = Long.valueOf(0);
3585                                    }
3586    
3587                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_AEI_AID_AD_A_T,
3588                                            finderArgs, count);
3589    
3590                                    closeSession(session);
3591                            }
3592                    }
3593    
3594                    return count.intValue();
3595            }
3596    
3597            /**
3598             * Counts all the social equity logs.
3599             *
3600             * @return the number of social equity logs
3601             * @throws SystemException if a system exception occurred
3602             */
3603            public int countAll() throws SystemException {
3604                    Object[] finderArgs = new Object[0];
3605    
3606                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3607                                    finderArgs, this);
3608    
3609                    if (count == null) {
3610                            Session session = null;
3611    
3612                            try {
3613                                    session = openSession();
3614    
3615                                    Query q = session.createQuery(_SQL_COUNT_SOCIALEQUITYLOG);
3616    
3617                                    count = (Long)q.uniqueResult();
3618                            }
3619                            catch (Exception e) {
3620                                    throw processException(e);
3621                            }
3622                            finally {
3623                                    if (count == null) {
3624                                            count = Long.valueOf(0);
3625                                    }
3626    
3627                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
3628                                            count);
3629    
3630                                    closeSession(session);
3631                            }
3632                    }
3633    
3634                    return count.intValue();
3635            }
3636    
3637            /**
3638             * Initializes the social equity log persistence.
3639             */
3640            public void afterPropertiesSet() {
3641                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3642                                            com.liferay.portal.util.PropsUtil.get(
3643                                                    "value.object.listener.com.liferay.portlet.social.model.SocialEquityLog")));
3644    
3645                    if (listenerClassNames.length > 0) {
3646                            try {
3647                                    List<ModelListener<SocialEquityLog>> listenersList = new ArrayList<ModelListener<SocialEquityLog>>();
3648    
3649                                    for (String listenerClassName : listenerClassNames) {
3650                                            listenersList.add((ModelListener<SocialEquityLog>)InstanceFactory.newInstance(
3651                                                            listenerClassName));
3652                                    }
3653    
3654                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3655                            }
3656                            catch (Exception e) {
3657                                    _log.error(e);
3658                            }
3659                    }
3660            }
3661    
3662            public void destroy() {
3663                    EntityCacheUtil.removeCache(SocialEquityLogImpl.class.getName());
3664                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3665                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
3666            }
3667    
3668            @BeanReference(type = SocialActivityPersistence.class)
3669            protected SocialActivityPersistence socialActivityPersistence;
3670            @BeanReference(type = SocialEquityAssetEntryPersistence.class)
3671            protected SocialEquityAssetEntryPersistence socialEquityAssetEntryPersistence;
3672            @BeanReference(type = SocialEquityGroupSettingPersistence.class)
3673            protected SocialEquityGroupSettingPersistence socialEquityGroupSettingPersistence;
3674            @BeanReference(type = SocialEquityHistoryPersistence.class)
3675            protected SocialEquityHistoryPersistence socialEquityHistoryPersistence;
3676            @BeanReference(type = SocialEquityLogPersistence.class)
3677            protected SocialEquityLogPersistence socialEquityLogPersistence;
3678            @BeanReference(type = SocialEquitySettingPersistence.class)
3679            protected SocialEquitySettingPersistence socialEquitySettingPersistence;
3680            @BeanReference(type = SocialEquityUserPersistence.class)
3681            protected SocialEquityUserPersistence socialEquityUserPersistence;
3682            @BeanReference(type = SocialRelationPersistence.class)
3683            protected SocialRelationPersistence socialRelationPersistence;
3684            @BeanReference(type = SocialRequestPersistence.class)
3685            protected SocialRequestPersistence socialRequestPersistence;
3686            @BeanReference(type = ResourcePersistence.class)
3687            protected ResourcePersistence resourcePersistence;
3688            @BeanReference(type = UserPersistence.class)
3689            protected UserPersistence userPersistence;
3690            @BeanReference(type = AssetEntryPersistence.class)
3691            protected AssetEntryPersistence assetEntryPersistence;
3692            private static final String _SQL_SELECT_SOCIALEQUITYLOG = "SELECT socialEquityLog FROM SocialEquityLog socialEquityLog";
3693            private static final String _SQL_SELECT_SOCIALEQUITYLOG_WHERE = "SELECT socialEquityLog FROM SocialEquityLog socialEquityLog WHERE ";
3694            private static final String _SQL_COUNT_SOCIALEQUITYLOG = "SELECT COUNT(socialEquityLog) FROM SocialEquityLog socialEquityLog";
3695            private static final String _SQL_COUNT_SOCIALEQUITYLOG_WHERE = "SELECT COUNT(socialEquityLog) FROM SocialEquityLog socialEquityLog WHERE ";
3696            private static final String _FINDER_COLUMN_AEI_T_A_ASSETENTRYID_2 = "socialEquityLog.assetEntryId = ? AND ";
3697            private static final String _FINDER_COLUMN_AEI_T_A_TYPE_2 = "socialEquityLog.type = ? AND ";
3698            private static final String _FINDER_COLUMN_AEI_T_A_ACTIVE_2 = "socialEquityLog.active = ?";
3699            private static final String _FINDER_COLUMN_U_AID_A_T_USERID_2 = "socialEquityLog.userId = ? AND ";
3700            private static final String _FINDER_COLUMN_U_AID_A_T_ACTIONID_1 = "socialEquityLog.actionId IS NULL AND ";
3701            private static final String _FINDER_COLUMN_U_AID_A_T_ACTIONID_2 = "socialEquityLog.actionId = ? AND ";
3702            private static final String _FINDER_COLUMN_U_AID_A_T_ACTIONID_3 = "(socialEquityLog.actionId IS NULL OR socialEquityLog.actionId = ?) AND ";
3703            private static final String _FINDER_COLUMN_U_AID_A_T_ACTIVE_2 = "socialEquityLog.active = ? AND ";
3704            private static final String _FINDER_COLUMN_U_AID_A_T_TYPE_2 = "socialEquityLog.type = ?";
3705            private static final String _FINDER_COLUMN_AEI_AID_A_T_ASSETENTRYID_2 = "socialEquityLog.assetEntryId = ? AND ";
3706            private static final String _FINDER_COLUMN_AEI_AID_A_T_ACTIONID_1 = "socialEquityLog.actionId IS NULL AND ";
3707            private static final String _FINDER_COLUMN_AEI_AID_A_T_ACTIONID_2 = "socialEquityLog.actionId = ? AND ";
3708            private static final String _FINDER_COLUMN_AEI_AID_A_T_ACTIONID_3 = "(socialEquityLog.actionId IS NULL OR socialEquityLog.actionId = ?) AND ";
3709            private static final String _FINDER_COLUMN_AEI_AID_A_T_ACTIVE_2 = "socialEquityLog.active = ? AND ";
3710            private static final String _FINDER_COLUMN_AEI_AID_A_T_TYPE_2 = "socialEquityLog.type = ?";
3711            private static final String _FINDER_COLUMN_U_AID_AD_A_T_USERID_2 = "socialEquityLog.userId = ? AND ";
3712            private static final String _FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_1 = "socialEquityLog.actionId IS NULL AND ";
3713            private static final String _FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_2 = "socialEquityLog.actionId = ? AND ";
3714            private static final String _FINDER_COLUMN_U_AID_AD_A_T_ACTIONID_3 = "(socialEquityLog.actionId IS NULL OR socialEquityLog.actionId = ?) AND ";
3715            private static final String _FINDER_COLUMN_U_AID_AD_A_T_ACTIONDATE_2 = "socialEquityLog.actionDate = ? AND ";
3716            private static final String _FINDER_COLUMN_U_AID_AD_A_T_ACTIVE_2 = "socialEquityLog.active = ? AND ";
3717            private static final String _FINDER_COLUMN_U_AID_AD_A_T_TYPE_2 = "socialEquityLog.type = ?";
3718            private static final String _FINDER_COLUMN_AEI_AID_AD_A_T_ASSETENTRYID_2 = "socialEquityLog.assetEntryId = ? AND ";
3719            private static final String _FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_1 = "socialEquityLog.actionId IS NULL AND ";
3720            private static final String _FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_2 = "socialEquityLog.actionId = ? AND ";
3721            private static final String _FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONID_3 = "(socialEquityLog.actionId IS NULL OR socialEquityLog.actionId = ?) AND ";
3722            private static final String _FINDER_COLUMN_AEI_AID_AD_A_T_ACTIONDATE_2 = "socialEquityLog.actionDate = ? AND ";
3723            private static final String _FINDER_COLUMN_AEI_AID_AD_A_T_ACTIVE_2 = "socialEquityLog.active = ? AND ";
3724            private static final String _FINDER_COLUMN_AEI_AID_AD_A_T_TYPE_2 = "socialEquityLog.type = ?";
3725            private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_USERID_2 = "socialEquityLog.userId = ? AND ";
3726            private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_ASSETENTRYID_2 = "socialEquityLog.assetEntryId = ? AND ";
3727            private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_1 = "socialEquityLog.actionId IS NULL AND ";
3728            private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_2 = "socialEquityLog.actionId = ? AND ";
3729            private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONID_3 = "(socialEquityLog.actionId IS NULL OR socialEquityLog.actionId = ?) AND ";
3730            private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIONDATE_2 = "socialEquityLog.actionDate = ? AND ";
3731            private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_ACTIVE_2 = "socialEquityLog.active = ? AND ";
3732            private static final String _FINDER_COLUMN_U_AEI_AID_AD_A_T_TYPE_2 = "socialEquityLog.type = ?";
3733            private static final String _ORDER_BY_ENTITY_ALIAS = "socialEquityLog.";
3734            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No SocialEquityLog exists with the primary key ";
3735            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No SocialEquityLog exists with the key {";
3736            private static Log _log = LogFactoryUtil.getLog(SocialEquityLogPersistenceImpl.class);
3737    }