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