001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.asset.service.persistence;
016    
017    import com.liferay.portal.NoSuchModelException;
018    import com.liferay.portal.kernel.bean.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.model.CacheModel;
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.NoSuchTagStatsException;
044    import com.liferay.portlet.asset.model.AssetTagStats;
045    import com.liferay.portlet.asset.model.impl.AssetTagStatsImpl;
046    import com.liferay.portlet.asset.model.impl.AssetTagStatsModelImpl;
047    
048    import java.io.Serializable;
049    
050    import java.util.ArrayList;
051    import java.util.Collections;
052    import java.util.List;
053    
054    /**
055     * The persistence implementation for the asset tag stats service.
056     *
057     * <p>
058     * Caching information and settings can be found in <code>portal.properties</code>
059     * </p>
060     *
061     * @author Brian Wing Shun Chan
062     * @see AssetTagStatsPersistence
063     * @see AssetTagStatsUtil
064     * @generated
065     */
066    public class AssetTagStatsPersistenceImpl extends BasePersistenceImpl<AssetTagStats>
067            implements AssetTagStatsPersistence {
068            /*
069             * NOTE FOR DEVELOPERS:
070             *
071             * Never modify or reference this class directly. Always use {@link AssetTagStatsUtil} to access the asset tag stats persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
072             */
073            public static final String FINDER_CLASS_NAME_ENTITY = AssetTagStatsImpl.class.getName();
074            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
075                    ".List1";
076            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
077                    ".List2";
078            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_TAGID = new FinderPath(AssetTagStatsModelImpl.ENTITY_CACHE_ENABLED,
079                            AssetTagStatsModelImpl.FINDER_CACHE_ENABLED,
080                            AssetTagStatsImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
081                            "findByTagId",
082                            new String[] {
083                                    Long.class.getName(),
084                                    
085                            "java.lang.Integer", "java.lang.Integer",
086                                    "com.liferay.portal.kernel.util.OrderByComparator"
087                            });
088            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TAGID = new FinderPath(AssetTagStatsModelImpl.ENTITY_CACHE_ENABLED,
089                            AssetTagStatsModelImpl.FINDER_CACHE_ENABLED,
090                            AssetTagStatsImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
091                            "findByTagId", new String[] { Long.class.getName() },
092                            AssetTagStatsModelImpl.TAGID_COLUMN_BITMASK);
093            public static final FinderPath FINDER_PATH_COUNT_BY_TAGID = new FinderPath(AssetTagStatsModelImpl.ENTITY_CACHE_ENABLED,
094                            AssetTagStatsModelImpl.FINDER_CACHE_ENABLED, Long.class,
095                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByTagId",
096                            new String[] { Long.class.getName() });
097            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_CLASSNAMEID =
098                    new FinderPath(AssetTagStatsModelImpl.ENTITY_CACHE_ENABLED,
099                            AssetTagStatsModelImpl.FINDER_CACHE_ENABLED,
100                            AssetTagStatsImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
101                            "findByClassNameId",
102                            new String[] {
103                                    Long.class.getName(),
104                                    
105                            "java.lang.Integer", "java.lang.Integer",
106                                    "com.liferay.portal.kernel.util.OrderByComparator"
107                            });
108            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID =
109                    new FinderPath(AssetTagStatsModelImpl.ENTITY_CACHE_ENABLED,
110                            AssetTagStatsModelImpl.FINDER_CACHE_ENABLED,
111                            AssetTagStatsImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
112                            "findByClassNameId", new String[] { Long.class.getName() },
113                            AssetTagStatsModelImpl.CLASSNAMEID_COLUMN_BITMASK);
114            public static final FinderPath FINDER_PATH_COUNT_BY_CLASSNAMEID = new FinderPath(AssetTagStatsModelImpl.ENTITY_CACHE_ENABLED,
115                            AssetTagStatsModelImpl.FINDER_CACHE_ENABLED, Long.class,
116                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByClassNameId",
117                            new String[] { Long.class.getName() });
118            public static final FinderPath FINDER_PATH_FETCH_BY_T_C = new FinderPath(AssetTagStatsModelImpl.ENTITY_CACHE_ENABLED,
119                            AssetTagStatsModelImpl.FINDER_CACHE_ENABLED,
120                            AssetTagStatsImpl.class, FINDER_CLASS_NAME_ENTITY, "fetchByT_C",
121                            new String[] { Long.class.getName(), Long.class.getName() },
122                            AssetTagStatsModelImpl.TAGID_COLUMN_BITMASK |
123                            AssetTagStatsModelImpl.CLASSNAMEID_COLUMN_BITMASK);
124            public static final FinderPath FINDER_PATH_COUNT_BY_T_C = new FinderPath(AssetTagStatsModelImpl.ENTITY_CACHE_ENABLED,
125                            AssetTagStatsModelImpl.FINDER_CACHE_ENABLED, Long.class,
126                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByT_C",
127                            new String[] { Long.class.getName(), Long.class.getName() });
128            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(AssetTagStatsModelImpl.ENTITY_CACHE_ENABLED,
129                            AssetTagStatsModelImpl.FINDER_CACHE_ENABLED,
130                            AssetTagStatsImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
131                            "findAll", new String[0]);
132            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(AssetTagStatsModelImpl.ENTITY_CACHE_ENABLED,
133                            AssetTagStatsModelImpl.FINDER_CACHE_ENABLED,
134                            AssetTagStatsImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
135                            "findAll", new String[0]);
136            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(AssetTagStatsModelImpl.ENTITY_CACHE_ENABLED,
137                            AssetTagStatsModelImpl.FINDER_CACHE_ENABLED, Long.class,
138                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
139    
140            /**
141             * Caches the asset tag stats in the entity cache if it is enabled.
142             *
143             * @param assetTagStats the asset tag stats
144             */
145            public void cacheResult(AssetTagStats assetTagStats) {
146                    EntityCacheUtil.putResult(AssetTagStatsModelImpl.ENTITY_CACHE_ENABLED,
147                            AssetTagStatsImpl.class, assetTagStats.getPrimaryKey(),
148                            assetTagStats);
149    
150                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_C,
151                            new Object[] {
152                                    Long.valueOf(assetTagStats.getTagId()),
153                                    Long.valueOf(assetTagStats.getClassNameId())
154                            }, assetTagStats);
155    
156                    assetTagStats.resetOriginalValues();
157            }
158    
159            /**
160             * Caches the asset tag statses in the entity cache if it is enabled.
161             *
162             * @param assetTagStatses the asset tag statses
163             */
164            public void cacheResult(List<AssetTagStats> assetTagStatses) {
165                    for (AssetTagStats assetTagStats : assetTagStatses) {
166                            if (EntityCacheUtil.getResult(
167                                                    AssetTagStatsModelImpl.ENTITY_CACHE_ENABLED,
168                                                    AssetTagStatsImpl.class, assetTagStats.getPrimaryKey()) == null) {
169                                    cacheResult(assetTagStats);
170                            }
171                            else {
172                                    assetTagStats.resetOriginalValues();
173                            }
174                    }
175            }
176    
177            /**
178             * Clears the cache for all asset tag statses.
179             *
180             * <p>
181             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
182             * </p>
183             */
184            @Override
185            public void clearCache() {
186                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
187                            CacheRegistryUtil.clear(AssetTagStatsImpl.class.getName());
188                    }
189    
190                    EntityCacheUtil.clearCache(AssetTagStatsImpl.class.getName());
191    
192                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
193                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
194                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
195            }
196    
197            /**
198             * Clears the cache for the asset tag stats.
199             *
200             * <p>
201             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
202             * </p>
203             */
204            @Override
205            public void clearCache(AssetTagStats assetTagStats) {
206                    EntityCacheUtil.removeResult(AssetTagStatsModelImpl.ENTITY_CACHE_ENABLED,
207                            AssetTagStatsImpl.class, assetTagStats.getPrimaryKey());
208    
209                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
210                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
211    
212                    clearUniqueFindersCache(assetTagStats);
213            }
214    
215            @Override
216            public void clearCache(List<AssetTagStats> assetTagStatses) {
217                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
218                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
219    
220                    for (AssetTagStats assetTagStats : assetTagStatses) {
221                            EntityCacheUtil.removeResult(AssetTagStatsModelImpl.ENTITY_CACHE_ENABLED,
222                                    AssetTagStatsImpl.class, assetTagStats.getPrimaryKey());
223    
224                            clearUniqueFindersCache(assetTagStats);
225                    }
226            }
227    
228            protected void clearUniqueFindersCache(AssetTagStats assetTagStats) {
229                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_T_C,
230                            new Object[] {
231                                    Long.valueOf(assetTagStats.getTagId()),
232                                    Long.valueOf(assetTagStats.getClassNameId())
233                            });
234            }
235    
236            /**
237             * Creates a new asset tag stats with the primary key. Does not add the asset tag stats to the database.
238             *
239             * @param tagStatsId the primary key for the new asset tag stats
240             * @return the new asset tag stats
241             */
242            public AssetTagStats create(long tagStatsId) {
243                    AssetTagStats assetTagStats = new AssetTagStatsImpl();
244    
245                    assetTagStats.setNew(true);
246                    assetTagStats.setPrimaryKey(tagStatsId);
247    
248                    return assetTagStats;
249            }
250    
251            /**
252             * Removes the asset tag stats with the primary key from the database. Also notifies the appropriate model listeners.
253             *
254             * @param tagStatsId the primary key of the asset tag stats
255             * @return the asset tag stats that was removed
256             * @throws com.liferay.portlet.asset.NoSuchTagStatsException if a asset tag stats with the primary key could not be found
257             * @throws SystemException if a system exception occurred
258             */
259            public AssetTagStats remove(long tagStatsId)
260                    throws NoSuchTagStatsException, SystemException {
261                    return remove(Long.valueOf(tagStatsId));
262            }
263    
264            /**
265             * Removes the asset tag stats with the primary key from the database. Also notifies the appropriate model listeners.
266             *
267             * @param primaryKey the primary key of the asset tag stats
268             * @return the asset tag stats that was removed
269             * @throws com.liferay.portlet.asset.NoSuchTagStatsException if a asset tag stats with the primary key could not be found
270             * @throws SystemException if a system exception occurred
271             */
272            @Override
273            public AssetTagStats remove(Serializable primaryKey)
274                    throws NoSuchTagStatsException, SystemException {
275                    Session session = null;
276    
277                    try {
278                            session = openSession();
279    
280                            AssetTagStats assetTagStats = (AssetTagStats)session.get(AssetTagStatsImpl.class,
281                                            primaryKey);
282    
283                            if (assetTagStats == null) {
284                                    if (_log.isWarnEnabled()) {
285                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
286                                    }
287    
288                                    throw new NoSuchTagStatsException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
289                                            primaryKey);
290                            }
291    
292                            return remove(assetTagStats);
293                    }
294                    catch (NoSuchTagStatsException nsee) {
295                            throw nsee;
296                    }
297                    catch (Exception e) {
298                            throw processException(e);
299                    }
300                    finally {
301                            closeSession(session);
302                    }
303            }
304    
305            @Override
306            protected AssetTagStats removeImpl(AssetTagStats assetTagStats)
307                    throws SystemException {
308                    assetTagStats = toUnwrappedModel(assetTagStats);
309    
310                    Session session = null;
311    
312                    try {
313                            session = openSession();
314    
315                            BatchSessionUtil.delete(session, assetTagStats);
316                    }
317                    catch (Exception e) {
318                            throw processException(e);
319                    }
320                    finally {
321                            closeSession(session);
322                    }
323    
324                    clearCache(assetTagStats);
325    
326                    return assetTagStats;
327            }
328    
329            @Override
330            public AssetTagStats updateImpl(
331                    com.liferay.portlet.asset.model.AssetTagStats assetTagStats,
332                    boolean merge) throws SystemException {
333                    assetTagStats = toUnwrappedModel(assetTagStats);
334    
335                    boolean isNew = assetTagStats.isNew();
336    
337                    AssetTagStatsModelImpl assetTagStatsModelImpl = (AssetTagStatsModelImpl)assetTagStats;
338    
339                    Session session = null;
340    
341                    try {
342                            session = openSession();
343    
344                            BatchSessionUtil.update(session, assetTagStats, merge);
345    
346                            assetTagStats.setNew(false);
347                    }
348                    catch (Exception e) {
349                            throw processException(e);
350                    }
351                    finally {
352                            closeSession(session);
353                    }
354    
355                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
356    
357                    if (isNew || !AssetTagStatsModelImpl.COLUMN_BITMASK_ENABLED) {
358                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
359                    }
360                    else {
361                            if ((assetTagStatsModelImpl.getColumnBitmask() &
362                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TAGID.getColumnBitmask()) != 0) {
363                                    Object[] args = new Object[] {
364                                                    Long.valueOf(assetTagStatsModelImpl.getOriginalTagId())
365                                            };
366    
367                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TAGID, args);
368                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TAGID,
369                                            args);
370    
371                                    args = new Object[] {
372                                                    Long.valueOf(assetTagStatsModelImpl.getTagId())
373                                            };
374    
375                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TAGID, args);
376                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TAGID,
377                                            args);
378                            }
379    
380                            if ((assetTagStatsModelImpl.getColumnBitmask() &
381                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID.getColumnBitmask()) != 0) {
382                                    Object[] args = new Object[] {
383                                                    Long.valueOf(assetTagStatsModelImpl.getOriginalClassNameId())
384                                            };
385    
386                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_CLASSNAMEID,
387                                            args);
388                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID,
389                                            args);
390    
391                                    args = new Object[] {
392                                                    Long.valueOf(assetTagStatsModelImpl.getClassNameId())
393                                            };
394    
395                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_CLASSNAMEID,
396                                            args);
397                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID,
398                                            args);
399                            }
400                    }
401    
402                    EntityCacheUtil.putResult(AssetTagStatsModelImpl.ENTITY_CACHE_ENABLED,
403                            AssetTagStatsImpl.class, assetTagStats.getPrimaryKey(),
404                            assetTagStats);
405    
406                    if (isNew) {
407                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_C,
408                                    new Object[] {
409                                            Long.valueOf(assetTagStats.getTagId()),
410                                            Long.valueOf(assetTagStats.getClassNameId())
411                                    }, assetTagStats);
412                    }
413                    else {
414                            if ((assetTagStatsModelImpl.getColumnBitmask() &
415                                            FINDER_PATH_FETCH_BY_T_C.getColumnBitmask()) != 0) {
416                                    Object[] args = new Object[] {
417                                                    Long.valueOf(assetTagStatsModelImpl.getOriginalTagId()),
418                                                    Long.valueOf(assetTagStatsModelImpl.getOriginalClassNameId())
419                                            };
420    
421                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_T_C, args);
422                                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_T_C, args);
423    
424                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_C,
425                                            new Object[] {
426                                                    Long.valueOf(assetTagStats.getTagId()),
427                                                    Long.valueOf(assetTagStats.getClassNameId())
428                                            }, assetTagStats);
429                            }
430                    }
431    
432                    return assetTagStats;
433            }
434    
435            protected AssetTagStats toUnwrappedModel(AssetTagStats assetTagStats) {
436                    if (assetTagStats instanceof AssetTagStatsImpl) {
437                            return assetTagStats;
438                    }
439    
440                    AssetTagStatsImpl assetTagStatsImpl = new AssetTagStatsImpl();
441    
442                    assetTagStatsImpl.setNew(assetTagStats.isNew());
443                    assetTagStatsImpl.setPrimaryKey(assetTagStats.getPrimaryKey());
444    
445                    assetTagStatsImpl.setTagStatsId(assetTagStats.getTagStatsId());
446                    assetTagStatsImpl.setTagId(assetTagStats.getTagId());
447                    assetTagStatsImpl.setClassNameId(assetTagStats.getClassNameId());
448                    assetTagStatsImpl.setAssetCount(assetTagStats.getAssetCount());
449    
450                    return assetTagStatsImpl;
451            }
452    
453            /**
454             * Returns the asset tag stats with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
455             *
456             * @param primaryKey the primary key of the asset tag stats
457             * @return the asset tag stats
458             * @throws com.liferay.portal.NoSuchModelException if a asset tag stats with the primary key could not be found
459             * @throws SystemException if a system exception occurred
460             */
461            @Override
462            public AssetTagStats findByPrimaryKey(Serializable primaryKey)
463                    throws NoSuchModelException, SystemException {
464                    return findByPrimaryKey(((Long)primaryKey).longValue());
465            }
466    
467            /**
468             * Returns the asset tag stats with the primary key or throws a {@link com.liferay.portlet.asset.NoSuchTagStatsException} if it could not be found.
469             *
470             * @param tagStatsId the primary key of the asset tag stats
471             * @return the asset tag stats
472             * @throws com.liferay.portlet.asset.NoSuchTagStatsException if a asset tag stats with the primary key could not be found
473             * @throws SystemException if a system exception occurred
474             */
475            public AssetTagStats findByPrimaryKey(long tagStatsId)
476                    throws NoSuchTagStatsException, SystemException {
477                    AssetTagStats assetTagStats = fetchByPrimaryKey(tagStatsId);
478    
479                    if (assetTagStats == null) {
480                            if (_log.isWarnEnabled()) {
481                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + tagStatsId);
482                            }
483    
484                            throw new NoSuchTagStatsException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
485                                    tagStatsId);
486                    }
487    
488                    return assetTagStats;
489            }
490    
491            /**
492             * Returns the asset tag stats with the primary key or returns <code>null</code> if it could not be found.
493             *
494             * @param primaryKey the primary key of the asset tag stats
495             * @return the asset tag stats, or <code>null</code> if a asset tag stats with the primary key could not be found
496             * @throws SystemException if a system exception occurred
497             */
498            @Override
499            public AssetTagStats fetchByPrimaryKey(Serializable primaryKey)
500                    throws SystemException {
501                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
502            }
503    
504            /**
505             * Returns the asset tag stats with the primary key or returns <code>null</code> if it could not be found.
506             *
507             * @param tagStatsId the primary key of the asset tag stats
508             * @return the asset tag stats, or <code>null</code> if a asset tag stats with the primary key could not be found
509             * @throws SystemException if a system exception occurred
510             */
511            public AssetTagStats fetchByPrimaryKey(long tagStatsId)
512                    throws SystemException {
513                    AssetTagStats assetTagStats = (AssetTagStats)EntityCacheUtil.getResult(AssetTagStatsModelImpl.ENTITY_CACHE_ENABLED,
514                                    AssetTagStatsImpl.class, tagStatsId);
515    
516                    if (assetTagStats == _nullAssetTagStats) {
517                            return null;
518                    }
519    
520                    if (assetTagStats == null) {
521                            Session session = null;
522    
523                            boolean hasException = false;
524    
525                            try {
526                                    session = openSession();
527    
528                                    assetTagStats = (AssetTagStats)session.get(AssetTagStatsImpl.class,
529                                                    Long.valueOf(tagStatsId));
530                            }
531                            catch (Exception e) {
532                                    hasException = true;
533    
534                                    throw processException(e);
535                            }
536                            finally {
537                                    if (assetTagStats != null) {
538                                            cacheResult(assetTagStats);
539                                    }
540                                    else if (!hasException) {
541                                            EntityCacheUtil.putResult(AssetTagStatsModelImpl.ENTITY_CACHE_ENABLED,
542                                                    AssetTagStatsImpl.class, tagStatsId, _nullAssetTagStats);
543                                    }
544    
545                                    closeSession(session);
546                            }
547                    }
548    
549                    return assetTagStats;
550            }
551    
552            /**
553             * Returns all the asset tag statses where tagId = &#63;.
554             *
555             * @param tagId the tag ID
556             * @return the matching asset tag statses
557             * @throws SystemException if a system exception occurred
558             */
559            public List<AssetTagStats> findByTagId(long tagId)
560                    throws SystemException {
561                    return findByTagId(tagId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
562            }
563    
564            /**
565             * Returns a range of all the asset tag statses where tagId = &#63;.
566             *
567             * <p>
568             * 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.
569             * </p>
570             *
571             * @param tagId the tag ID
572             * @param start the lower bound of the range of asset tag statses
573             * @param end the upper bound of the range of asset tag statses (not inclusive)
574             * @return the range of matching asset tag statses
575             * @throws SystemException if a system exception occurred
576             */
577            public List<AssetTagStats> findByTagId(long tagId, int start, int end)
578                    throws SystemException {
579                    return findByTagId(tagId, start, end, null);
580            }
581    
582            /**
583             * Returns an ordered range of all the asset tag statses where tagId = &#63;.
584             *
585             * <p>
586             * 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.
587             * </p>
588             *
589             * @param tagId the tag ID
590             * @param start the lower bound of the range of asset tag statses
591             * @param end the upper bound of the range of asset tag statses (not inclusive)
592             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
593             * @return the ordered range of matching asset tag statses
594             * @throws SystemException if a system exception occurred
595             */
596            public List<AssetTagStats> findByTagId(long tagId, int start, int end,
597                    OrderByComparator orderByComparator) throws SystemException {
598                    FinderPath finderPath = null;
599                    Object[] finderArgs = null;
600    
601                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
602                                    (orderByComparator == null)) {
603                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TAGID;
604                            finderArgs = new Object[] { tagId };
605                    }
606                    else {
607                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_TAGID;
608                            finderArgs = new Object[] { tagId, start, end, orderByComparator };
609                    }
610    
611                    List<AssetTagStats> list = (List<AssetTagStats>)FinderCacheUtil.getResult(finderPath,
612                                    finderArgs, this);
613    
614                    if ((list != null) && !list.isEmpty()) {
615                            for (AssetTagStats assetTagStats : list) {
616                                    if ((tagId != assetTagStats.getTagId())) {
617                                            list = null;
618    
619                                            break;
620                                    }
621                            }
622                    }
623    
624                    if (list == null) {
625                            StringBundler query = null;
626    
627                            if (orderByComparator != null) {
628                                    query = new StringBundler(3 +
629                                                    (orderByComparator.getOrderByFields().length * 3));
630                            }
631                            else {
632                                    query = new StringBundler(3);
633                            }
634    
635                            query.append(_SQL_SELECT_ASSETTAGSTATS_WHERE);
636    
637                            query.append(_FINDER_COLUMN_TAGID_TAGID_2);
638    
639                            if (orderByComparator != null) {
640                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
641                                            orderByComparator);
642                            }
643    
644                            else {
645                                    query.append(AssetTagStatsModelImpl.ORDER_BY_JPQL);
646                            }
647    
648                            String sql = query.toString();
649    
650                            Session session = null;
651    
652                            try {
653                                    session = openSession();
654    
655                                    Query q = session.createQuery(sql);
656    
657                                    QueryPos qPos = QueryPos.getInstance(q);
658    
659                                    qPos.add(tagId);
660    
661                                    list = (List<AssetTagStats>)QueryUtil.list(q, getDialect(),
662                                                    start, end);
663                            }
664                            catch (Exception e) {
665                                    throw processException(e);
666                            }
667                            finally {
668                                    if (list == null) {
669                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
670                                    }
671                                    else {
672                                            cacheResult(list);
673    
674                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
675                                    }
676    
677                                    closeSession(session);
678                            }
679                    }
680    
681                    return list;
682            }
683    
684            /**
685             * Returns the first asset tag stats in the ordered set where tagId = &#63;.
686             *
687             * <p>
688             * 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.
689             * </p>
690             *
691             * @param tagId the tag ID
692             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
693             * @return the first matching asset tag stats
694             * @throws com.liferay.portlet.asset.NoSuchTagStatsException if a matching asset tag stats could not be found
695             * @throws SystemException if a system exception occurred
696             */
697            public AssetTagStats findByTagId_First(long tagId,
698                    OrderByComparator orderByComparator)
699                    throws NoSuchTagStatsException, SystemException {
700                    List<AssetTagStats> list = findByTagId(tagId, 0, 1, orderByComparator);
701    
702                    if (list.isEmpty()) {
703                            StringBundler msg = new StringBundler(4);
704    
705                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
706    
707                            msg.append("tagId=");
708                            msg.append(tagId);
709    
710                            msg.append(StringPool.CLOSE_CURLY_BRACE);
711    
712                            throw new NoSuchTagStatsException(msg.toString());
713                    }
714                    else {
715                            return list.get(0);
716                    }
717            }
718    
719            /**
720             * Returns the last asset tag stats in the ordered set where tagId = &#63;.
721             *
722             * <p>
723             * 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.
724             * </p>
725             *
726             * @param tagId the tag ID
727             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
728             * @return the last matching asset tag stats
729             * @throws com.liferay.portlet.asset.NoSuchTagStatsException if a matching asset tag stats could not be found
730             * @throws SystemException if a system exception occurred
731             */
732            public AssetTagStats findByTagId_Last(long tagId,
733                    OrderByComparator orderByComparator)
734                    throws NoSuchTagStatsException, SystemException {
735                    int count = countByTagId(tagId);
736    
737                    List<AssetTagStats> list = findByTagId(tagId, count - 1, count,
738                                    orderByComparator);
739    
740                    if (list.isEmpty()) {
741                            StringBundler msg = new StringBundler(4);
742    
743                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
744    
745                            msg.append("tagId=");
746                            msg.append(tagId);
747    
748                            msg.append(StringPool.CLOSE_CURLY_BRACE);
749    
750                            throw new NoSuchTagStatsException(msg.toString());
751                    }
752                    else {
753                            return list.get(0);
754                    }
755            }
756    
757            /**
758             * Returns the asset tag statses before and after the current asset tag stats in the ordered set where tagId = &#63;.
759             *
760             * <p>
761             * 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.
762             * </p>
763             *
764             * @param tagStatsId the primary key of the current asset tag stats
765             * @param tagId the tag ID
766             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
767             * @return the previous, current, and next asset tag stats
768             * @throws com.liferay.portlet.asset.NoSuchTagStatsException if a asset tag stats with the primary key could not be found
769             * @throws SystemException if a system exception occurred
770             */
771            public AssetTagStats[] findByTagId_PrevAndNext(long tagStatsId, long tagId,
772                    OrderByComparator orderByComparator)
773                    throws NoSuchTagStatsException, SystemException {
774                    AssetTagStats assetTagStats = findByPrimaryKey(tagStatsId);
775    
776                    Session session = null;
777    
778                    try {
779                            session = openSession();
780    
781                            AssetTagStats[] array = new AssetTagStatsImpl[3];
782    
783                            array[0] = getByTagId_PrevAndNext(session, assetTagStats, tagId,
784                                            orderByComparator, true);
785    
786                            array[1] = assetTagStats;
787    
788                            array[2] = getByTagId_PrevAndNext(session, assetTagStats, tagId,
789                                            orderByComparator, false);
790    
791                            return array;
792                    }
793                    catch (Exception e) {
794                            throw processException(e);
795                    }
796                    finally {
797                            closeSession(session);
798                    }
799            }
800    
801            protected AssetTagStats getByTagId_PrevAndNext(Session session,
802                    AssetTagStats assetTagStats, long tagId,
803                    OrderByComparator orderByComparator, boolean previous) {
804                    StringBundler query = null;
805    
806                    if (orderByComparator != null) {
807                            query = new StringBundler(6 +
808                                            (orderByComparator.getOrderByFields().length * 6));
809                    }
810                    else {
811                            query = new StringBundler(3);
812                    }
813    
814                    query.append(_SQL_SELECT_ASSETTAGSTATS_WHERE);
815    
816                    query.append(_FINDER_COLUMN_TAGID_TAGID_2);
817    
818                    if (orderByComparator != null) {
819                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
820    
821                            if (orderByConditionFields.length > 0) {
822                                    query.append(WHERE_AND);
823                            }
824    
825                            for (int i = 0; i < orderByConditionFields.length; i++) {
826                                    query.append(_ORDER_BY_ENTITY_ALIAS);
827                                    query.append(orderByConditionFields[i]);
828    
829                                    if ((i + 1) < orderByConditionFields.length) {
830                                            if (orderByComparator.isAscending() ^ previous) {
831                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
832                                            }
833                                            else {
834                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
835                                            }
836                                    }
837                                    else {
838                                            if (orderByComparator.isAscending() ^ previous) {
839                                                    query.append(WHERE_GREATER_THAN);
840                                            }
841                                            else {
842                                                    query.append(WHERE_LESSER_THAN);
843                                            }
844                                    }
845                            }
846    
847                            query.append(ORDER_BY_CLAUSE);
848    
849                            String[] orderByFields = orderByComparator.getOrderByFields();
850    
851                            for (int i = 0; i < orderByFields.length; i++) {
852                                    query.append(_ORDER_BY_ENTITY_ALIAS);
853                                    query.append(orderByFields[i]);
854    
855                                    if ((i + 1) < orderByFields.length) {
856                                            if (orderByComparator.isAscending() ^ previous) {
857                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
858                                            }
859                                            else {
860                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
861                                            }
862                                    }
863                                    else {
864                                            if (orderByComparator.isAscending() ^ previous) {
865                                                    query.append(ORDER_BY_ASC);
866                                            }
867                                            else {
868                                                    query.append(ORDER_BY_DESC);
869                                            }
870                                    }
871                            }
872                    }
873    
874                    else {
875                            query.append(AssetTagStatsModelImpl.ORDER_BY_JPQL);
876                    }
877    
878                    String sql = query.toString();
879    
880                    Query q = session.createQuery(sql);
881    
882                    q.setFirstResult(0);
883                    q.setMaxResults(2);
884    
885                    QueryPos qPos = QueryPos.getInstance(q);
886    
887                    qPos.add(tagId);
888    
889                    if (orderByComparator != null) {
890                            Object[] values = orderByComparator.getOrderByConditionValues(assetTagStats);
891    
892                            for (Object value : values) {
893                                    qPos.add(value);
894                            }
895                    }
896    
897                    List<AssetTagStats> list = q.list();
898    
899                    if (list.size() == 2) {
900                            return list.get(1);
901                    }
902                    else {
903                            return null;
904                    }
905            }
906    
907            /**
908             * Returns all the asset tag statses where classNameId = &#63;.
909             *
910             * @param classNameId the class name ID
911             * @return the matching asset tag statses
912             * @throws SystemException if a system exception occurred
913             */
914            public List<AssetTagStats> findByClassNameId(long classNameId)
915                    throws SystemException {
916                    return findByClassNameId(classNameId, QueryUtil.ALL_POS,
917                            QueryUtil.ALL_POS, null);
918            }
919    
920            /**
921             * Returns a range of all the asset tag statses where classNameId = &#63;.
922             *
923             * <p>
924             * 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.
925             * </p>
926             *
927             * @param classNameId the class name ID
928             * @param start the lower bound of the range of asset tag statses
929             * @param end the upper bound of the range of asset tag statses (not inclusive)
930             * @return the range of matching asset tag statses
931             * @throws SystemException if a system exception occurred
932             */
933            public List<AssetTagStats> findByClassNameId(long classNameId, int start,
934                    int end) throws SystemException {
935                    return findByClassNameId(classNameId, start, end, null);
936            }
937    
938            /**
939             * Returns an ordered range of all the asset tag statses where classNameId = &#63;.
940             *
941             * <p>
942             * 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.
943             * </p>
944             *
945             * @param classNameId the class name ID
946             * @param start the lower bound of the range of asset tag statses
947             * @param end the upper bound of the range of asset tag statses (not inclusive)
948             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
949             * @return the ordered range of matching asset tag statses
950             * @throws SystemException if a system exception occurred
951             */
952            public List<AssetTagStats> findByClassNameId(long classNameId, int start,
953                    int end, OrderByComparator orderByComparator) throws SystemException {
954                    FinderPath finderPath = null;
955                    Object[] finderArgs = null;
956    
957                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
958                                    (orderByComparator == null)) {
959                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID;
960                            finderArgs = new Object[] { classNameId };
961                    }
962                    else {
963                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_CLASSNAMEID;
964                            finderArgs = new Object[] { classNameId, start, end, orderByComparator };
965                    }
966    
967                    List<AssetTagStats> list = (List<AssetTagStats>)FinderCacheUtil.getResult(finderPath,
968                                    finderArgs, this);
969    
970                    if ((list != null) && !list.isEmpty()) {
971                            for (AssetTagStats assetTagStats : list) {
972                                    if ((classNameId != assetTagStats.getClassNameId())) {
973                                            list = null;
974    
975                                            break;
976                                    }
977                            }
978                    }
979    
980                    if (list == null) {
981                            StringBundler query = null;
982    
983                            if (orderByComparator != null) {
984                                    query = new StringBundler(3 +
985                                                    (orderByComparator.getOrderByFields().length * 3));
986                            }
987                            else {
988                                    query = new StringBundler(3);
989                            }
990    
991                            query.append(_SQL_SELECT_ASSETTAGSTATS_WHERE);
992    
993                            query.append(_FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2);
994    
995                            if (orderByComparator != null) {
996                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
997                                            orderByComparator);
998                            }
999    
1000                            else {
1001                                    query.append(AssetTagStatsModelImpl.ORDER_BY_JPQL);
1002                            }
1003    
1004                            String sql = query.toString();
1005    
1006                            Session session = null;
1007    
1008                            try {
1009                                    session = openSession();
1010    
1011                                    Query q = session.createQuery(sql);
1012    
1013                                    QueryPos qPos = QueryPos.getInstance(q);
1014    
1015                                    qPos.add(classNameId);
1016    
1017                                    list = (List<AssetTagStats>)QueryUtil.list(q, getDialect(),
1018                                                    start, end);
1019                            }
1020                            catch (Exception e) {
1021                                    throw processException(e);
1022                            }
1023                            finally {
1024                                    if (list == null) {
1025                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1026                                    }
1027                                    else {
1028                                            cacheResult(list);
1029    
1030                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1031                                    }
1032    
1033                                    closeSession(session);
1034                            }
1035                    }
1036    
1037                    return list;
1038            }
1039    
1040            /**
1041             * Returns the first asset tag stats in the ordered set where classNameId = &#63;.
1042             *
1043             * <p>
1044             * 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.
1045             * </p>
1046             *
1047             * @param classNameId the class name ID
1048             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1049             * @return the first matching asset tag stats
1050             * @throws com.liferay.portlet.asset.NoSuchTagStatsException if a matching asset tag stats could not be found
1051             * @throws SystemException if a system exception occurred
1052             */
1053            public AssetTagStats findByClassNameId_First(long classNameId,
1054                    OrderByComparator orderByComparator)
1055                    throws NoSuchTagStatsException, SystemException {
1056                    List<AssetTagStats> list = findByClassNameId(classNameId, 0, 1,
1057                                    orderByComparator);
1058    
1059                    if (list.isEmpty()) {
1060                            StringBundler msg = new StringBundler(4);
1061    
1062                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1063    
1064                            msg.append("classNameId=");
1065                            msg.append(classNameId);
1066    
1067                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1068    
1069                            throw new NoSuchTagStatsException(msg.toString());
1070                    }
1071                    else {
1072                            return list.get(0);
1073                    }
1074            }
1075    
1076            /**
1077             * Returns the last asset tag stats in the ordered set where classNameId = &#63;.
1078             *
1079             * <p>
1080             * 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.
1081             * </p>
1082             *
1083             * @param classNameId the class name ID
1084             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1085             * @return the last matching asset tag stats
1086             * @throws com.liferay.portlet.asset.NoSuchTagStatsException if a matching asset tag stats could not be found
1087             * @throws SystemException if a system exception occurred
1088             */
1089            public AssetTagStats findByClassNameId_Last(long classNameId,
1090                    OrderByComparator orderByComparator)
1091                    throws NoSuchTagStatsException, SystemException {
1092                    int count = countByClassNameId(classNameId);
1093    
1094                    List<AssetTagStats> list = findByClassNameId(classNameId, count - 1,
1095                                    count, orderByComparator);
1096    
1097                    if (list.isEmpty()) {
1098                            StringBundler msg = new StringBundler(4);
1099    
1100                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1101    
1102                            msg.append("classNameId=");
1103                            msg.append(classNameId);
1104    
1105                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1106    
1107                            throw new NoSuchTagStatsException(msg.toString());
1108                    }
1109                    else {
1110                            return list.get(0);
1111                    }
1112            }
1113    
1114            /**
1115             * Returns the asset tag statses before and after the current asset tag stats in the ordered set where classNameId = &#63;.
1116             *
1117             * <p>
1118             * 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.
1119             * </p>
1120             *
1121             * @param tagStatsId the primary key of the current asset tag stats
1122             * @param classNameId the class name ID
1123             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1124             * @return the previous, current, and next asset tag stats
1125             * @throws com.liferay.portlet.asset.NoSuchTagStatsException if a asset tag stats with the primary key could not be found
1126             * @throws SystemException if a system exception occurred
1127             */
1128            public AssetTagStats[] findByClassNameId_PrevAndNext(long tagStatsId,
1129                    long classNameId, OrderByComparator orderByComparator)
1130                    throws NoSuchTagStatsException, SystemException {
1131                    AssetTagStats assetTagStats = findByPrimaryKey(tagStatsId);
1132    
1133                    Session session = null;
1134    
1135                    try {
1136                            session = openSession();
1137    
1138                            AssetTagStats[] array = new AssetTagStatsImpl[3];
1139    
1140                            array[0] = getByClassNameId_PrevAndNext(session, assetTagStats,
1141                                            classNameId, orderByComparator, true);
1142    
1143                            array[1] = assetTagStats;
1144    
1145                            array[2] = getByClassNameId_PrevAndNext(session, assetTagStats,
1146                                            classNameId, orderByComparator, false);
1147    
1148                            return array;
1149                    }
1150                    catch (Exception e) {
1151                            throw processException(e);
1152                    }
1153                    finally {
1154                            closeSession(session);
1155                    }
1156            }
1157    
1158            protected AssetTagStats getByClassNameId_PrevAndNext(Session session,
1159                    AssetTagStats assetTagStats, long classNameId,
1160                    OrderByComparator orderByComparator, boolean previous) {
1161                    StringBundler query = null;
1162    
1163                    if (orderByComparator != null) {
1164                            query = new StringBundler(6 +
1165                                            (orderByComparator.getOrderByFields().length * 6));
1166                    }
1167                    else {
1168                            query = new StringBundler(3);
1169                    }
1170    
1171                    query.append(_SQL_SELECT_ASSETTAGSTATS_WHERE);
1172    
1173                    query.append(_FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2);
1174    
1175                    if (orderByComparator != null) {
1176                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1177    
1178                            if (orderByConditionFields.length > 0) {
1179                                    query.append(WHERE_AND);
1180                            }
1181    
1182                            for (int i = 0; i < orderByConditionFields.length; i++) {
1183                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1184                                    query.append(orderByConditionFields[i]);
1185    
1186                                    if ((i + 1) < orderByConditionFields.length) {
1187                                            if (orderByComparator.isAscending() ^ previous) {
1188                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1189                                            }
1190                                            else {
1191                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1192                                            }
1193                                    }
1194                                    else {
1195                                            if (orderByComparator.isAscending() ^ previous) {
1196                                                    query.append(WHERE_GREATER_THAN);
1197                                            }
1198                                            else {
1199                                                    query.append(WHERE_LESSER_THAN);
1200                                            }
1201                                    }
1202                            }
1203    
1204                            query.append(ORDER_BY_CLAUSE);
1205    
1206                            String[] orderByFields = orderByComparator.getOrderByFields();
1207    
1208                            for (int i = 0; i < orderByFields.length; i++) {
1209                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1210                                    query.append(orderByFields[i]);
1211    
1212                                    if ((i + 1) < orderByFields.length) {
1213                                            if (orderByComparator.isAscending() ^ previous) {
1214                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1215                                            }
1216                                            else {
1217                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1218                                            }
1219                                    }
1220                                    else {
1221                                            if (orderByComparator.isAscending() ^ previous) {
1222                                                    query.append(ORDER_BY_ASC);
1223                                            }
1224                                            else {
1225                                                    query.append(ORDER_BY_DESC);
1226                                            }
1227                                    }
1228                            }
1229                    }
1230    
1231                    else {
1232                            query.append(AssetTagStatsModelImpl.ORDER_BY_JPQL);
1233                    }
1234    
1235                    String sql = query.toString();
1236    
1237                    Query q = session.createQuery(sql);
1238    
1239                    q.setFirstResult(0);
1240                    q.setMaxResults(2);
1241    
1242                    QueryPos qPos = QueryPos.getInstance(q);
1243    
1244                    qPos.add(classNameId);
1245    
1246                    if (orderByComparator != null) {
1247                            Object[] values = orderByComparator.getOrderByConditionValues(assetTagStats);
1248    
1249                            for (Object value : values) {
1250                                    qPos.add(value);
1251                            }
1252                    }
1253    
1254                    List<AssetTagStats> list = q.list();
1255    
1256                    if (list.size() == 2) {
1257                            return list.get(1);
1258                    }
1259                    else {
1260                            return null;
1261                    }
1262            }
1263    
1264            /**
1265             * Returns the asset tag stats where tagId = &#63; and classNameId = &#63; or throws a {@link com.liferay.portlet.asset.NoSuchTagStatsException} if it could not be found.
1266             *
1267             * @param tagId the tag ID
1268             * @param classNameId the class name ID
1269             * @return the matching asset tag stats
1270             * @throws com.liferay.portlet.asset.NoSuchTagStatsException if a matching asset tag stats could not be found
1271             * @throws SystemException if a system exception occurred
1272             */
1273            public AssetTagStats findByT_C(long tagId, long classNameId)
1274                    throws NoSuchTagStatsException, SystemException {
1275                    AssetTagStats assetTagStats = fetchByT_C(tagId, classNameId);
1276    
1277                    if (assetTagStats == null) {
1278                            StringBundler msg = new StringBundler(6);
1279    
1280                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1281    
1282                            msg.append("tagId=");
1283                            msg.append(tagId);
1284    
1285                            msg.append(", classNameId=");
1286                            msg.append(classNameId);
1287    
1288                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1289    
1290                            if (_log.isWarnEnabled()) {
1291                                    _log.warn(msg.toString());
1292                            }
1293    
1294                            throw new NoSuchTagStatsException(msg.toString());
1295                    }
1296    
1297                    return assetTagStats;
1298            }
1299    
1300            /**
1301             * Returns the asset tag stats where tagId = &#63; and classNameId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
1302             *
1303             * @param tagId the tag ID
1304             * @param classNameId the class name ID
1305             * @return the matching asset tag stats, or <code>null</code> if a matching asset tag stats could not be found
1306             * @throws SystemException if a system exception occurred
1307             */
1308            public AssetTagStats fetchByT_C(long tagId, long classNameId)
1309                    throws SystemException {
1310                    return fetchByT_C(tagId, classNameId, true);
1311            }
1312    
1313            /**
1314             * Returns the asset tag stats where tagId = &#63; and classNameId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
1315             *
1316             * @param tagId the tag ID
1317             * @param classNameId the class name ID
1318             * @param retrieveFromCache whether to use the finder cache
1319             * @return the matching asset tag stats, or <code>null</code> if a matching asset tag stats could not be found
1320             * @throws SystemException if a system exception occurred
1321             */
1322            public AssetTagStats fetchByT_C(long tagId, long classNameId,
1323                    boolean retrieveFromCache) throws SystemException {
1324                    Object[] finderArgs = new Object[] { tagId, classNameId };
1325    
1326                    Object result = null;
1327    
1328                    if (retrieveFromCache) {
1329                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_T_C,
1330                                            finderArgs, this);
1331                    }
1332    
1333                    if (result instanceof AssetTagStats) {
1334                            AssetTagStats assetTagStats = (AssetTagStats)result;
1335    
1336                            if ((tagId != assetTagStats.getTagId()) ||
1337                                            (classNameId != assetTagStats.getClassNameId())) {
1338                                    result = null;
1339                            }
1340                    }
1341    
1342                    if (result == null) {
1343                            StringBundler query = new StringBundler(4);
1344    
1345                            query.append(_SQL_SELECT_ASSETTAGSTATS_WHERE);
1346    
1347                            query.append(_FINDER_COLUMN_T_C_TAGID_2);
1348    
1349                            query.append(_FINDER_COLUMN_T_C_CLASSNAMEID_2);
1350    
1351                            query.append(AssetTagStatsModelImpl.ORDER_BY_JPQL);
1352    
1353                            String sql = query.toString();
1354    
1355                            Session session = null;
1356    
1357                            try {
1358                                    session = openSession();
1359    
1360                                    Query q = session.createQuery(sql);
1361    
1362                                    QueryPos qPos = QueryPos.getInstance(q);
1363    
1364                                    qPos.add(tagId);
1365    
1366                                    qPos.add(classNameId);
1367    
1368                                    List<AssetTagStats> list = q.list();
1369    
1370                                    result = list;
1371    
1372                                    AssetTagStats assetTagStats = null;
1373    
1374                                    if (list.isEmpty()) {
1375                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_C,
1376                                                    finderArgs, list);
1377                                    }
1378                                    else {
1379                                            assetTagStats = list.get(0);
1380    
1381                                            cacheResult(assetTagStats);
1382    
1383                                            if ((assetTagStats.getTagId() != tagId) ||
1384                                                            (assetTagStats.getClassNameId() != classNameId)) {
1385                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_C,
1386                                                            finderArgs, assetTagStats);
1387                                            }
1388                                    }
1389    
1390                                    return assetTagStats;
1391                            }
1392                            catch (Exception e) {
1393                                    throw processException(e);
1394                            }
1395                            finally {
1396                                    if (result == null) {
1397                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_T_C,
1398                                                    finderArgs);
1399                                    }
1400    
1401                                    closeSession(session);
1402                            }
1403                    }
1404                    else {
1405                            if (result instanceof List<?>) {
1406                                    return null;
1407                            }
1408                            else {
1409                                    return (AssetTagStats)result;
1410                            }
1411                    }
1412            }
1413    
1414            /**
1415             * Returns all the asset tag statses.
1416             *
1417             * @return the asset tag statses
1418             * @throws SystemException if a system exception occurred
1419             */
1420            public List<AssetTagStats> findAll() throws SystemException {
1421                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1422            }
1423    
1424            /**
1425             * Returns a range of all the asset tag statses.
1426             *
1427             * <p>
1428             * 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.
1429             * </p>
1430             *
1431             * @param start the lower bound of the range of asset tag statses
1432             * @param end the upper bound of the range of asset tag statses (not inclusive)
1433             * @return the range of asset tag statses
1434             * @throws SystemException if a system exception occurred
1435             */
1436            public List<AssetTagStats> findAll(int start, int end)
1437                    throws SystemException {
1438                    return findAll(start, end, null);
1439            }
1440    
1441            /**
1442             * Returns an ordered range of all the asset tag statses.
1443             *
1444             * <p>
1445             * 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.
1446             * </p>
1447             *
1448             * @param start the lower bound of the range of asset tag statses
1449             * @param end the upper bound of the range of asset tag statses (not inclusive)
1450             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1451             * @return the ordered range of asset tag statses
1452             * @throws SystemException if a system exception occurred
1453             */
1454            public List<AssetTagStats> findAll(int start, int end,
1455                    OrderByComparator orderByComparator) throws SystemException {
1456                    FinderPath finderPath = null;
1457                    Object[] finderArgs = new Object[] { start, end, orderByComparator };
1458    
1459                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1460                                    (orderByComparator == null)) {
1461                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1462                            finderArgs = FINDER_ARGS_EMPTY;
1463                    }
1464                    else {
1465                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1466                            finderArgs = new Object[] { start, end, orderByComparator };
1467                    }
1468    
1469                    List<AssetTagStats> list = (List<AssetTagStats>)FinderCacheUtil.getResult(finderPath,
1470                                    finderArgs, this);
1471    
1472                    if (list == null) {
1473                            StringBundler query = null;
1474                            String sql = null;
1475    
1476                            if (orderByComparator != null) {
1477                                    query = new StringBundler(2 +
1478                                                    (orderByComparator.getOrderByFields().length * 3));
1479    
1480                                    query.append(_SQL_SELECT_ASSETTAGSTATS);
1481    
1482                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1483                                            orderByComparator);
1484    
1485                                    sql = query.toString();
1486                            }
1487                            else {
1488                                    sql = _SQL_SELECT_ASSETTAGSTATS.concat(AssetTagStatsModelImpl.ORDER_BY_JPQL);
1489                            }
1490    
1491                            Session session = null;
1492    
1493                            try {
1494                                    session = openSession();
1495    
1496                                    Query q = session.createQuery(sql);
1497    
1498                                    if (orderByComparator == null) {
1499                                            list = (List<AssetTagStats>)QueryUtil.list(q, getDialect(),
1500                                                            start, end, false);
1501    
1502                                            Collections.sort(list);
1503                                    }
1504                                    else {
1505                                            list = (List<AssetTagStats>)QueryUtil.list(q, getDialect(),
1506                                                            start, end);
1507                                    }
1508                            }
1509                            catch (Exception e) {
1510                                    throw processException(e);
1511                            }
1512                            finally {
1513                                    if (list == null) {
1514                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1515                                    }
1516                                    else {
1517                                            cacheResult(list);
1518    
1519                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1520                                    }
1521    
1522                                    closeSession(session);
1523                            }
1524                    }
1525    
1526                    return list;
1527            }
1528    
1529            /**
1530             * Removes all the asset tag statses where tagId = &#63; from the database.
1531             *
1532             * @param tagId the tag ID
1533             * @throws SystemException if a system exception occurred
1534             */
1535            public void removeByTagId(long tagId) throws SystemException {
1536                    for (AssetTagStats assetTagStats : findByTagId(tagId)) {
1537                            remove(assetTagStats);
1538                    }
1539            }
1540    
1541            /**
1542             * Removes all the asset tag statses where classNameId = &#63; from the database.
1543             *
1544             * @param classNameId the class name ID
1545             * @throws SystemException if a system exception occurred
1546             */
1547            public void removeByClassNameId(long classNameId) throws SystemException {
1548                    for (AssetTagStats assetTagStats : findByClassNameId(classNameId)) {
1549                            remove(assetTagStats);
1550                    }
1551            }
1552    
1553            /**
1554             * Removes the asset tag stats where tagId = &#63; and classNameId = &#63; from the database.
1555             *
1556             * @param tagId the tag ID
1557             * @param classNameId the class name ID
1558             * @throws SystemException if a system exception occurred
1559             */
1560            public void removeByT_C(long tagId, long classNameId)
1561                    throws NoSuchTagStatsException, SystemException {
1562                    AssetTagStats assetTagStats = findByT_C(tagId, classNameId);
1563    
1564                    remove(assetTagStats);
1565            }
1566    
1567            /**
1568             * Removes all the asset tag statses from the database.
1569             *
1570             * @throws SystemException if a system exception occurred
1571             */
1572            public void removeAll() throws SystemException {
1573                    for (AssetTagStats assetTagStats : findAll()) {
1574                            remove(assetTagStats);
1575                    }
1576            }
1577    
1578            /**
1579             * Returns the number of asset tag statses where tagId = &#63;.
1580             *
1581             * @param tagId the tag ID
1582             * @return the number of matching asset tag statses
1583             * @throws SystemException if a system exception occurred
1584             */
1585            public int countByTagId(long tagId) throws SystemException {
1586                    Object[] finderArgs = new Object[] { tagId };
1587    
1588                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_TAGID,
1589                                    finderArgs, this);
1590    
1591                    if (count == null) {
1592                            StringBundler query = new StringBundler(2);
1593    
1594                            query.append(_SQL_COUNT_ASSETTAGSTATS_WHERE);
1595    
1596                            query.append(_FINDER_COLUMN_TAGID_TAGID_2);
1597    
1598                            String sql = query.toString();
1599    
1600                            Session session = null;
1601    
1602                            try {
1603                                    session = openSession();
1604    
1605                                    Query q = session.createQuery(sql);
1606    
1607                                    QueryPos qPos = QueryPos.getInstance(q);
1608    
1609                                    qPos.add(tagId);
1610    
1611                                    count = (Long)q.uniqueResult();
1612                            }
1613                            catch (Exception e) {
1614                                    throw processException(e);
1615                            }
1616                            finally {
1617                                    if (count == null) {
1618                                            count = Long.valueOf(0);
1619                                    }
1620    
1621                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TAGID,
1622                                            finderArgs, count);
1623    
1624                                    closeSession(session);
1625                            }
1626                    }
1627    
1628                    return count.intValue();
1629            }
1630    
1631            /**
1632             * Returns the number of asset tag statses where classNameId = &#63;.
1633             *
1634             * @param classNameId the class name ID
1635             * @return the number of matching asset tag statses
1636             * @throws SystemException if a system exception occurred
1637             */
1638            public int countByClassNameId(long classNameId) throws SystemException {
1639                    Object[] finderArgs = new Object[] { classNameId };
1640    
1641                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_CLASSNAMEID,
1642                                    finderArgs, this);
1643    
1644                    if (count == null) {
1645                            StringBundler query = new StringBundler(2);
1646    
1647                            query.append(_SQL_COUNT_ASSETTAGSTATS_WHERE);
1648    
1649                            query.append(_FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2);
1650    
1651                            String sql = query.toString();
1652    
1653                            Session session = null;
1654    
1655                            try {
1656                                    session = openSession();
1657    
1658                                    Query q = session.createQuery(sql);
1659    
1660                                    QueryPos qPos = QueryPos.getInstance(q);
1661    
1662                                    qPos.add(classNameId);
1663    
1664                                    count = (Long)q.uniqueResult();
1665                            }
1666                            catch (Exception e) {
1667                                    throw processException(e);
1668                            }
1669                            finally {
1670                                    if (count == null) {
1671                                            count = Long.valueOf(0);
1672                                    }
1673    
1674                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_CLASSNAMEID,
1675                                            finderArgs, count);
1676    
1677                                    closeSession(session);
1678                            }
1679                    }
1680    
1681                    return count.intValue();
1682            }
1683    
1684            /**
1685             * Returns the number of asset tag statses where tagId = &#63; and classNameId = &#63;.
1686             *
1687             * @param tagId the tag ID
1688             * @param classNameId the class name ID
1689             * @return the number of matching asset tag statses
1690             * @throws SystemException if a system exception occurred
1691             */
1692            public int countByT_C(long tagId, long classNameId)
1693                    throws SystemException {
1694                    Object[] finderArgs = new Object[] { tagId, classNameId };
1695    
1696                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_T_C,
1697                                    finderArgs, this);
1698    
1699                    if (count == null) {
1700                            StringBundler query = new StringBundler(3);
1701    
1702                            query.append(_SQL_COUNT_ASSETTAGSTATS_WHERE);
1703    
1704                            query.append(_FINDER_COLUMN_T_C_TAGID_2);
1705    
1706                            query.append(_FINDER_COLUMN_T_C_CLASSNAMEID_2);
1707    
1708                            String sql = query.toString();
1709    
1710                            Session session = null;
1711    
1712                            try {
1713                                    session = openSession();
1714    
1715                                    Query q = session.createQuery(sql);
1716    
1717                                    QueryPos qPos = QueryPos.getInstance(q);
1718    
1719                                    qPos.add(tagId);
1720    
1721                                    qPos.add(classNameId);
1722    
1723                                    count = (Long)q.uniqueResult();
1724                            }
1725                            catch (Exception e) {
1726                                    throw processException(e);
1727                            }
1728                            finally {
1729                                    if (count == null) {
1730                                            count = Long.valueOf(0);
1731                                    }
1732    
1733                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_T_C, finderArgs,
1734                                            count);
1735    
1736                                    closeSession(session);
1737                            }
1738                    }
1739    
1740                    return count.intValue();
1741            }
1742    
1743            /**
1744             * Returns the number of asset tag statses.
1745             *
1746             * @return the number of asset tag statses
1747             * @throws SystemException if a system exception occurred
1748             */
1749            public int countAll() throws SystemException {
1750                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1751                                    FINDER_ARGS_EMPTY, this);
1752    
1753                    if (count == null) {
1754                            Session session = null;
1755    
1756                            try {
1757                                    session = openSession();
1758    
1759                                    Query q = session.createQuery(_SQL_COUNT_ASSETTAGSTATS);
1760    
1761                                    count = (Long)q.uniqueResult();
1762                            }
1763                            catch (Exception e) {
1764                                    throw processException(e);
1765                            }
1766                            finally {
1767                                    if (count == null) {
1768                                            count = Long.valueOf(0);
1769                                    }
1770    
1771                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1772                                            FINDER_ARGS_EMPTY, count);
1773    
1774                                    closeSession(session);
1775                            }
1776                    }
1777    
1778                    return count.intValue();
1779            }
1780    
1781            /**
1782             * Initializes the asset tag stats persistence.
1783             */
1784            public void afterPropertiesSet() {
1785                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1786                                            com.liferay.portal.util.PropsUtil.get(
1787                                                    "value.object.listener.com.liferay.portlet.asset.model.AssetTagStats")));
1788    
1789                    if (listenerClassNames.length > 0) {
1790                            try {
1791                                    List<ModelListener<AssetTagStats>> listenersList = new ArrayList<ModelListener<AssetTagStats>>();
1792    
1793                                    for (String listenerClassName : listenerClassNames) {
1794                                            listenersList.add((ModelListener<AssetTagStats>)InstanceFactory.newInstance(
1795                                                            listenerClassName));
1796                                    }
1797    
1798                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1799                            }
1800                            catch (Exception e) {
1801                                    _log.error(e);
1802                            }
1803                    }
1804            }
1805    
1806            public void destroy() {
1807                    EntityCacheUtil.removeCache(AssetTagStatsImpl.class.getName());
1808                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1809                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1810            }
1811    
1812            @BeanReference(type = AssetCategoryPersistence.class)
1813            protected AssetCategoryPersistence assetCategoryPersistence;
1814            @BeanReference(type = AssetCategoryPropertyPersistence.class)
1815            protected AssetCategoryPropertyPersistence assetCategoryPropertyPersistence;
1816            @BeanReference(type = AssetEntryPersistence.class)
1817            protected AssetEntryPersistence assetEntryPersistence;
1818            @BeanReference(type = AssetLinkPersistence.class)
1819            protected AssetLinkPersistence assetLinkPersistence;
1820            @BeanReference(type = AssetTagPersistence.class)
1821            protected AssetTagPersistence assetTagPersistence;
1822            @BeanReference(type = AssetTagPropertyPersistence.class)
1823            protected AssetTagPropertyPersistence assetTagPropertyPersistence;
1824            @BeanReference(type = AssetTagStatsPersistence.class)
1825            protected AssetTagStatsPersistence assetTagStatsPersistence;
1826            @BeanReference(type = AssetVocabularyPersistence.class)
1827            protected AssetVocabularyPersistence assetVocabularyPersistence;
1828            @BeanReference(type = ResourcePersistence.class)
1829            protected ResourcePersistence resourcePersistence;
1830            @BeanReference(type = UserPersistence.class)
1831            protected UserPersistence userPersistence;
1832            private static final String _SQL_SELECT_ASSETTAGSTATS = "SELECT assetTagStats FROM AssetTagStats assetTagStats";
1833            private static final String _SQL_SELECT_ASSETTAGSTATS_WHERE = "SELECT assetTagStats FROM AssetTagStats assetTagStats WHERE ";
1834            private static final String _SQL_COUNT_ASSETTAGSTATS = "SELECT COUNT(assetTagStats) FROM AssetTagStats assetTagStats";
1835            private static final String _SQL_COUNT_ASSETTAGSTATS_WHERE = "SELECT COUNT(assetTagStats) FROM AssetTagStats assetTagStats WHERE ";
1836            private static final String _FINDER_COLUMN_TAGID_TAGID_2 = "assetTagStats.tagId = ?";
1837            private static final String _FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2 = "assetTagStats.classNameId = ?";
1838            private static final String _FINDER_COLUMN_T_C_TAGID_2 = "assetTagStats.tagId = ? AND ";
1839            private static final String _FINDER_COLUMN_T_C_CLASSNAMEID_2 = "assetTagStats.classNameId = ?";
1840            private static final String _ORDER_BY_ENTITY_ALIAS = "assetTagStats.";
1841            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No AssetTagStats exists with the primary key ";
1842            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No AssetTagStats exists with the key {";
1843            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1844            private static Log _log = LogFactoryUtil.getLog(AssetTagStatsPersistenceImpl.class);
1845            private static AssetTagStats _nullAssetTagStats = new AssetTagStatsImpl() {
1846                            @Override
1847                            public Object clone() {
1848                                    return this;
1849                            }
1850    
1851                            @Override
1852                            public CacheModel<AssetTagStats> toCacheModel() {
1853                                    return _nullAssetTagStatsCacheModel;
1854                            }
1855                    };
1856    
1857            private static CacheModel<AssetTagStats> _nullAssetTagStatsCacheModel = new CacheModel<AssetTagStats>() {
1858                            public AssetTagStats toEntityModel() {
1859                                    return _nullAssetTagStats;
1860                            }
1861                    };
1862    }