001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.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    
361                    else {
362                            if ((assetTagStatsModelImpl.getColumnBitmask() &
363                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TAGID.getColumnBitmask()) != 0) {
364                                    Object[] args = new Object[] {
365                                                    Long.valueOf(assetTagStatsModelImpl.getOriginalTagId())
366                                            };
367    
368                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TAGID, args);
369                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TAGID,
370                                            args);
371    
372                                    args = new Object[] {
373                                                    Long.valueOf(assetTagStatsModelImpl.getTagId())
374                                            };
375    
376                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TAGID, args);
377                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TAGID,
378                                            args);
379                            }
380    
381                            if ((assetTagStatsModelImpl.getColumnBitmask() &
382                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID.getColumnBitmask()) != 0) {
383                                    Object[] args = new Object[] {
384                                                    Long.valueOf(assetTagStatsModelImpl.getOriginalClassNameId())
385                                            };
386    
387                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_CLASSNAMEID,
388                                            args);
389                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID,
390                                            args);
391    
392                                    args = new Object[] {
393                                                    Long.valueOf(assetTagStatsModelImpl.getClassNameId())
394                                            };
395    
396                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_CLASSNAMEID,
397                                            args);
398                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID,
399                                            args);
400                            }
401                    }
402    
403                    EntityCacheUtil.putResult(AssetTagStatsModelImpl.ENTITY_CACHE_ENABLED,
404                            AssetTagStatsImpl.class, assetTagStats.getPrimaryKey(),
405                            assetTagStats);
406    
407                    if (isNew) {
408                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_C,
409                                    new Object[] {
410                                            Long.valueOf(assetTagStats.getTagId()),
411                                            Long.valueOf(assetTagStats.getClassNameId())
412                                    }, assetTagStats);
413                    }
414                    else {
415                            if ((assetTagStatsModelImpl.getColumnBitmask() &
416                                            FINDER_PATH_FETCH_BY_T_C.getColumnBitmask()) != 0) {
417                                    Object[] args = new Object[] {
418                                                    Long.valueOf(assetTagStatsModelImpl.getOriginalTagId()),
419                                                    Long.valueOf(assetTagStatsModelImpl.getOriginalClassNameId())
420                                            };
421    
422                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_T_C, args);
423    
424                                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_T_C, args);
425    
426                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_C,
427                                            new Object[] {
428                                                    Long.valueOf(assetTagStats.getTagId()),
429                                                    Long.valueOf(assetTagStats.getClassNameId())
430                                            }, assetTagStats);
431                            }
432                    }
433    
434                    return assetTagStats;
435            }
436    
437            protected AssetTagStats toUnwrappedModel(AssetTagStats assetTagStats) {
438                    if (assetTagStats instanceof AssetTagStatsImpl) {
439                            return assetTagStats;
440                    }
441    
442                    AssetTagStatsImpl assetTagStatsImpl = new AssetTagStatsImpl();
443    
444                    assetTagStatsImpl.setNew(assetTagStats.isNew());
445                    assetTagStatsImpl.setPrimaryKey(assetTagStats.getPrimaryKey());
446    
447                    assetTagStatsImpl.setTagStatsId(assetTagStats.getTagStatsId());
448                    assetTagStatsImpl.setTagId(assetTagStats.getTagId());
449                    assetTagStatsImpl.setClassNameId(assetTagStats.getClassNameId());
450                    assetTagStatsImpl.setAssetCount(assetTagStats.getAssetCount());
451    
452                    return assetTagStatsImpl;
453            }
454    
455            /**
456             * Returns the asset tag stats with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
457             *
458             * @param primaryKey the primary key of the asset tag stats
459             * @return the asset tag stats
460             * @throws com.liferay.portal.NoSuchModelException if a asset tag stats with the primary key could not be found
461             * @throws SystemException if a system exception occurred
462             */
463            @Override
464            public AssetTagStats findByPrimaryKey(Serializable primaryKey)
465                    throws NoSuchModelException, SystemException {
466                    return findByPrimaryKey(((Long)primaryKey).longValue());
467            }
468    
469            /**
470             * Returns the asset tag stats with the primary key or throws a {@link com.liferay.portlet.asset.NoSuchTagStatsException} if it could not be found.
471             *
472             * @param tagStatsId the primary key of the asset tag stats
473             * @return the asset tag stats
474             * @throws com.liferay.portlet.asset.NoSuchTagStatsException if a asset tag stats with the primary key could not be found
475             * @throws SystemException if a system exception occurred
476             */
477            public AssetTagStats findByPrimaryKey(long tagStatsId)
478                    throws NoSuchTagStatsException, SystemException {
479                    AssetTagStats assetTagStats = fetchByPrimaryKey(tagStatsId);
480    
481                    if (assetTagStats == null) {
482                            if (_log.isWarnEnabled()) {
483                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + tagStatsId);
484                            }
485    
486                            throw new NoSuchTagStatsException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
487                                    tagStatsId);
488                    }
489    
490                    return assetTagStats;
491            }
492    
493            /**
494             * Returns the asset tag stats with the primary key or returns <code>null</code> if it could not be found.
495             *
496             * @param primaryKey the primary key of the asset tag stats
497             * @return the asset tag stats, or <code>null</code> if a asset tag stats with the primary key could not be found
498             * @throws SystemException if a system exception occurred
499             */
500            @Override
501            public AssetTagStats fetchByPrimaryKey(Serializable primaryKey)
502                    throws SystemException {
503                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
504            }
505    
506            /**
507             * Returns the asset tag stats with the primary key or returns <code>null</code> if it could not be found.
508             *
509             * @param tagStatsId the primary key of the asset tag stats
510             * @return the asset tag stats, or <code>null</code> if a asset tag stats with the primary key could not be found
511             * @throws SystemException if a system exception occurred
512             */
513            public AssetTagStats fetchByPrimaryKey(long tagStatsId)
514                    throws SystemException {
515                    AssetTagStats assetTagStats = (AssetTagStats)EntityCacheUtil.getResult(AssetTagStatsModelImpl.ENTITY_CACHE_ENABLED,
516                                    AssetTagStatsImpl.class, tagStatsId);
517    
518                    if (assetTagStats == _nullAssetTagStats) {
519                            return null;
520                    }
521    
522                    if (assetTagStats == null) {
523                            Session session = null;
524    
525                            boolean hasException = false;
526    
527                            try {
528                                    session = openSession();
529    
530                                    assetTagStats = (AssetTagStats)session.get(AssetTagStatsImpl.class,
531                                                    Long.valueOf(tagStatsId));
532                            }
533                            catch (Exception e) {
534                                    hasException = true;
535    
536                                    throw processException(e);
537                            }
538                            finally {
539                                    if (assetTagStats != null) {
540                                            cacheResult(assetTagStats);
541                                    }
542                                    else if (!hasException) {
543                                            EntityCacheUtil.putResult(AssetTagStatsModelImpl.ENTITY_CACHE_ENABLED,
544                                                    AssetTagStatsImpl.class, tagStatsId, _nullAssetTagStats);
545                                    }
546    
547                                    closeSession(session);
548                            }
549                    }
550    
551                    return assetTagStats;
552            }
553    
554            /**
555             * Returns all the asset tag statses where tagId = &#63;.
556             *
557             * @param tagId the tag ID
558             * @return the matching asset tag statses
559             * @throws SystemException if a system exception occurred
560             */
561            public List<AssetTagStats> findByTagId(long tagId)
562                    throws SystemException {
563                    return findByTagId(tagId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
564            }
565    
566            /**
567             * Returns a range of all the asset tag statses where tagId = &#63;.
568             *
569             * <p>
570             * 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.
571             * </p>
572             *
573             * @param tagId the tag ID
574             * @param start the lower bound of the range of asset tag statses
575             * @param end the upper bound of the range of asset tag statses (not inclusive)
576             * @return the range of matching asset tag statses
577             * @throws SystemException if a system exception occurred
578             */
579            public List<AssetTagStats> findByTagId(long tagId, int start, int end)
580                    throws SystemException {
581                    return findByTagId(tagId, start, end, null);
582            }
583    
584            /**
585             * Returns an ordered range of all the asset tag statses where tagId = &#63;.
586             *
587             * <p>
588             * 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.
589             * </p>
590             *
591             * @param tagId the tag ID
592             * @param start the lower bound of the range of asset tag statses
593             * @param end the upper bound of the range of asset tag statses (not inclusive)
594             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
595             * @return the ordered range of matching asset tag statses
596             * @throws SystemException if a system exception occurred
597             */
598            public List<AssetTagStats> findByTagId(long tagId, int start, int end,
599                    OrderByComparator orderByComparator) throws SystemException {
600                    FinderPath finderPath = null;
601                    Object[] finderArgs = null;
602    
603                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
604                                    (orderByComparator == null)) {
605                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TAGID;
606                            finderArgs = new Object[] { tagId };
607                    }
608                    else {
609                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_TAGID;
610                            finderArgs = new Object[] { tagId, start, end, orderByComparator };
611                    }
612    
613                    List<AssetTagStats> list = (List<AssetTagStats>)FinderCacheUtil.getResult(finderPath,
614                                    finderArgs, this);
615    
616                    if ((list != null) && !list.isEmpty()) {
617                            for (AssetTagStats assetTagStats : list) {
618                                    if ((tagId != assetTagStats.getTagId())) {
619                                            list = null;
620    
621                                            break;
622                                    }
623                            }
624                    }
625    
626                    if (list == null) {
627                            StringBundler query = null;
628    
629                            if (orderByComparator != null) {
630                                    query = new StringBundler(3 +
631                                                    (orderByComparator.getOrderByFields().length * 3));
632                            }
633                            else {
634                                    query = new StringBundler(3);
635                            }
636    
637                            query.append(_SQL_SELECT_ASSETTAGSTATS_WHERE);
638    
639                            query.append(_FINDER_COLUMN_TAGID_TAGID_2);
640    
641                            if (orderByComparator != null) {
642                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
643                                            orderByComparator);
644                            }
645    
646                            else {
647                                    query.append(AssetTagStatsModelImpl.ORDER_BY_JPQL);
648                            }
649    
650                            String sql = query.toString();
651    
652                            Session session = null;
653    
654                            try {
655                                    session = openSession();
656    
657                                    Query q = session.createQuery(sql);
658    
659                                    QueryPos qPos = QueryPos.getInstance(q);
660    
661                                    qPos.add(tagId);
662    
663                                    list = (List<AssetTagStats>)QueryUtil.list(q, getDialect(),
664                                                    start, end);
665                            }
666                            catch (Exception e) {
667                                    throw processException(e);
668                            }
669                            finally {
670                                    if (list == null) {
671                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
672                                    }
673                                    else {
674                                            cacheResult(list);
675    
676                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
677                                    }
678    
679                                    closeSession(session);
680                            }
681                    }
682    
683                    return list;
684            }
685    
686            /**
687             * Returns the first asset tag stats in the ordered set where tagId = &#63;.
688             *
689             * @param tagId the tag ID
690             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
691             * @return the first matching asset tag stats
692             * @throws com.liferay.portlet.asset.NoSuchTagStatsException if a matching asset tag stats could not be found
693             * @throws SystemException if a system exception occurred
694             */
695            public AssetTagStats findByTagId_First(long tagId,
696                    OrderByComparator orderByComparator)
697                    throws NoSuchTagStatsException, SystemException {
698                    AssetTagStats assetTagStats = fetchByTagId_First(tagId,
699                                    orderByComparator);
700    
701                    if (assetTagStats != null) {
702                            return assetTagStats;
703                    }
704    
705                    StringBundler msg = new StringBundler(4);
706    
707                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
708    
709                    msg.append("tagId=");
710                    msg.append(tagId);
711    
712                    msg.append(StringPool.CLOSE_CURLY_BRACE);
713    
714                    throw new NoSuchTagStatsException(msg.toString());
715            }
716    
717            /**
718             * Returns the first asset tag stats in the ordered set where tagId = &#63;.
719             *
720             * @param tagId the tag ID
721             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
722             * @return the first matching asset tag stats, or <code>null</code> if a matching asset tag stats could not be found
723             * @throws SystemException if a system exception occurred
724             */
725            public AssetTagStats fetchByTagId_First(long tagId,
726                    OrderByComparator orderByComparator) throws SystemException {
727                    List<AssetTagStats> list = findByTagId(tagId, 0, 1, orderByComparator);
728    
729                    if (!list.isEmpty()) {
730                            return list.get(0);
731                    }
732    
733                    return null;
734            }
735    
736            /**
737             * Returns the last asset tag stats in the ordered set where tagId = &#63;.
738             *
739             * @param tagId the tag ID
740             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
741             * @return the last matching asset tag stats
742             * @throws com.liferay.portlet.asset.NoSuchTagStatsException if a matching asset tag stats could not be found
743             * @throws SystemException if a system exception occurred
744             */
745            public AssetTagStats findByTagId_Last(long tagId,
746                    OrderByComparator orderByComparator)
747                    throws NoSuchTagStatsException, SystemException {
748                    AssetTagStats assetTagStats = fetchByTagId_Last(tagId, orderByComparator);
749    
750                    if (assetTagStats != null) {
751                            return assetTagStats;
752                    }
753    
754                    StringBundler msg = new StringBundler(4);
755    
756                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
757    
758                    msg.append("tagId=");
759                    msg.append(tagId);
760    
761                    msg.append(StringPool.CLOSE_CURLY_BRACE);
762    
763                    throw new NoSuchTagStatsException(msg.toString());
764            }
765    
766            /**
767             * Returns the last asset tag stats in the ordered set where tagId = &#63;.
768             *
769             * @param tagId the tag ID
770             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
771             * @return the last matching asset tag stats, or <code>null</code> if a matching asset tag stats could not be found
772             * @throws SystemException if a system exception occurred
773             */
774            public AssetTagStats fetchByTagId_Last(long tagId,
775                    OrderByComparator orderByComparator) throws SystemException {
776                    int count = countByTagId(tagId);
777    
778                    List<AssetTagStats> list = findByTagId(tagId, count - 1, count,
779                                    orderByComparator);
780    
781                    if (!list.isEmpty()) {
782                            return list.get(0);
783                    }
784    
785                    return null;
786            }
787    
788            /**
789             * Returns the asset tag statses before and after the current asset tag stats in the ordered set where tagId = &#63;.
790             *
791             * @param tagStatsId the primary key of the current asset tag stats
792             * @param tagId the tag ID
793             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
794             * @return the previous, current, and next asset tag stats
795             * @throws com.liferay.portlet.asset.NoSuchTagStatsException if a asset tag stats with the primary key could not be found
796             * @throws SystemException if a system exception occurred
797             */
798            public AssetTagStats[] findByTagId_PrevAndNext(long tagStatsId, long tagId,
799                    OrderByComparator orderByComparator)
800                    throws NoSuchTagStatsException, SystemException {
801                    AssetTagStats assetTagStats = findByPrimaryKey(tagStatsId);
802    
803                    Session session = null;
804    
805                    try {
806                            session = openSession();
807    
808                            AssetTagStats[] array = new AssetTagStatsImpl[3];
809    
810                            array[0] = getByTagId_PrevAndNext(session, assetTagStats, tagId,
811                                            orderByComparator, true);
812    
813                            array[1] = assetTagStats;
814    
815                            array[2] = getByTagId_PrevAndNext(session, assetTagStats, tagId,
816                                            orderByComparator, false);
817    
818                            return array;
819                    }
820                    catch (Exception e) {
821                            throw processException(e);
822                    }
823                    finally {
824                            closeSession(session);
825                    }
826            }
827    
828            protected AssetTagStats getByTagId_PrevAndNext(Session session,
829                    AssetTagStats assetTagStats, long tagId,
830                    OrderByComparator orderByComparator, boolean previous) {
831                    StringBundler query = null;
832    
833                    if (orderByComparator != null) {
834                            query = new StringBundler(6 +
835                                            (orderByComparator.getOrderByFields().length * 6));
836                    }
837                    else {
838                            query = new StringBundler(3);
839                    }
840    
841                    query.append(_SQL_SELECT_ASSETTAGSTATS_WHERE);
842    
843                    query.append(_FINDER_COLUMN_TAGID_TAGID_2);
844    
845                    if (orderByComparator != null) {
846                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
847    
848                            if (orderByConditionFields.length > 0) {
849                                    query.append(WHERE_AND);
850                            }
851    
852                            for (int i = 0; i < orderByConditionFields.length; i++) {
853                                    query.append(_ORDER_BY_ENTITY_ALIAS);
854                                    query.append(orderByConditionFields[i]);
855    
856                                    if ((i + 1) < orderByConditionFields.length) {
857                                            if (orderByComparator.isAscending() ^ previous) {
858                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
859                                            }
860                                            else {
861                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
862                                            }
863                                    }
864                                    else {
865                                            if (orderByComparator.isAscending() ^ previous) {
866                                                    query.append(WHERE_GREATER_THAN);
867                                            }
868                                            else {
869                                                    query.append(WHERE_LESSER_THAN);
870                                            }
871                                    }
872                            }
873    
874                            query.append(ORDER_BY_CLAUSE);
875    
876                            String[] orderByFields = orderByComparator.getOrderByFields();
877    
878                            for (int i = 0; i < orderByFields.length; i++) {
879                                    query.append(_ORDER_BY_ENTITY_ALIAS);
880                                    query.append(orderByFields[i]);
881    
882                                    if ((i + 1) < orderByFields.length) {
883                                            if (orderByComparator.isAscending() ^ previous) {
884                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
885                                            }
886                                            else {
887                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
888                                            }
889                                    }
890                                    else {
891                                            if (orderByComparator.isAscending() ^ previous) {
892                                                    query.append(ORDER_BY_ASC);
893                                            }
894                                            else {
895                                                    query.append(ORDER_BY_DESC);
896                                            }
897                                    }
898                            }
899                    }
900    
901                    else {
902                            query.append(AssetTagStatsModelImpl.ORDER_BY_JPQL);
903                    }
904    
905                    String sql = query.toString();
906    
907                    Query q = session.createQuery(sql);
908    
909                    q.setFirstResult(0);
910                    q.setMaxResults(2);
911    
912                    QueryPos qPos = QueryPos.getInstance(q);
913    
914                    qPos.add(tagId);
915    
916                    if (orderByComparator != null) {
917                            Object[] values = orderByComparator.getOrderByConditionValues(assetTagStats);
918    
919                            for (Object value : values) {
920                                    qPos.add(value);
921                            }
922                    }
923    
924                    List<AssetTagStats> list = q.list();
925    
926                    if (list.size() == 2) {
927                            return list.get(1);
928                    }
929                    else {
930                            return null;
931                    }
932            }
933    
934            /**
935             * Returns all the asset tag statses where classNameId = &#63;.
936             *
937             * @param classNameId the class name ID
938             * @return the matching asset tag statses
939             * @throws SystemException if a system exception occurred
940             */
941            public List<AssetTagStats> findByClassNameId(long classNameId)
942                    throws SystemException {
943                    return findByClassNameId(classNameId, QueryUtil.ALL_POS,
944                            QueryUtil.ALL_POS, null);
945            }
946    
947            /**
948             * Returns a range of all the asset tag statses where classNameId = &#63;.
949             *
950             * <p>
951             * 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.
952             * </p>
953             *
954             * @param classNameId the class name ID
955             * @param start the lower bound of the range of asset tag statses
956             * @param end the upper bound of the range of asset tag statses (not inclusive)
957             * @return the range of matching asset tag statses
958             * @throws SystemException if a system exception occurred
959             */
960            public List<AssetTagStats> findByClassNameId(long classNameId, int start,
961                    int end) throws SystemException {
962                    return findByClassNameId(classNameId, start, end, null);
963            }
964    
965            /**
966             * Returns an ordered range of all the asset tag statses where classNameId = &#63;.
967             *
968             * <p>
969             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
970             * </p>
971             *
972             * @param classNameId the class name ID
973             * @param start the lower bound of the range of asset tag statses
974             * @param end the upper bound of the range of asset tag statses (not inclusive)
975             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
976             * @return the ordered range of matching asset tag statses
977             * @throws SystemException if a system exception occurred
978             */
979            public List<AssetTagStats> findByClassNameId(long classNameId, int start,
980                    int end, OrderByComparator orderByComparator) throws SystemException {
981                    FinderPath finderPath = null;
982                    Object[] finderArgs = null;
983    
984                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
985                                    (orderByComparator == null)) {
986                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID;
987                            finderArgs = new Object[] { classNameId };
988                    }
989                    else {
990                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_CLASSNAMEID;
991                            finderArgs = new Object[] { classNameId, start, end, orderByComparator };
992                    }
993    
994                    List<AssetTagStats> list = (List<AssetTagStats>)FinderCacheUtil.getResult(finderPath,
995                                    finderArgs, this);
996    
997                    if ((list != null) && !list.isEmpty()) {
998                            for (AssetTagStats assetTagStats : list) {
999                                    if ((classNameId != assetTagStats.getClassNameId())) {
1000                                            list = null;
1001    
1002                                            break;
1003                                    }
1004                            }
1005                    }
1006    
1007                    if (list == null) {
1008                            StringBundler query = null;
1009    
1010                            if (orderByComparator != null) {
1011                                    query = new StringBundler(3 +
1012                                                    (orderByComparator.getOrderByFields().length * 3));
1013                            }
1014                            else {
1015                                    query = new StringBundler(3);
1016                            }
1017    
1018                            query.append(_SQL_SELECT_ASSETTAGSTATS_WHERE);
1019    
1020                            query.append(_FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2);
1021    
1022                            if (orderByComparator != null) {
1023                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1024                                            orderByComparator);
1025                            }
1026    
1027                            else {
1028                                    query.append(AssetTagStatsModelImpl.ORDER_BY_JPQL);
1029                            }
1030    
1031                            String sql = query.toString();
1032    
1033                            Session session = null;
1034    
1035                            try {
1036                                    session = openSession();
1037    
1038                                    Query q = session.createQuery(sql);
1039    
1040                                    QueryPos qPos = QueryPos.getInstance(q);
1041    
1042                                    qPos.add(classNameId);
1043    
1044                                    list = (List<AssetTagStats>)QueryUtil.list(q, getDialect(),
1045                                                    start, end);
1046                            }
1047                            catch (Exception e) {
1048                                    throw processException(e);
1049                            }
1050                            finally {
1051                                    if (list == null) {
1052                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1053                                    }
1054                                    else {
1055                                            cacheResult(list);
1056    
1057                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1058                                    }
1059    
1060                                    closeSession(session);
1061                            }
1062                    }
1063    
1064                    return list;
1065            }
1066    
1067            /**
1068             * Returns the first asset tag stats in the ordered set where classNameId = &#63;.
1069             *
1070             * @param classNameId the class name ID
1071             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1072             * @return the first matching asset tag stats
1073             * @throws com.liferay.portlet.asset.NoSuchTagStatsException if a matching asset tag stats could not be found
1074             * @throws SystemException if a system exception occurred
1075             */
1076            public AssetTagStats findByClassNameId_First(long classNameId,
1077                    OrderByComparator orderByComparator)
1078                    throws NoSuchTagStatsException, SystemException {
1079                    AssetTagStats assetTagStats = fetchByClassNameId_First(classNameId,
1080                                    orderByComparator);
1081    
1082                    if (assetTagStats != null) {
1083                            return assetTagStats;
1084                    }
1085    
1086                    StringBundler msg = new StringBundler(4);
1087    
1088                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1089    
1090                    msg.append("classNameId=");
1091                    msg.append(classNameId);
1092    
1093                    msg.append(StringPool.CLOSE_CURLY_BRACE);
1094    
1095                    throw new NoSuchTagStatsException(msg.toString());
1096            }
1097    
1098            /**
1099             * Returns the first asset tag stats in the ordered set where classNameId = &#63;.
1100             *
1101             * @param classNameId the class name ID
1102             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1103             * @return the first matching asset tag stats, or <code>null</code> if a matching asset tag stats could not be found
1104             * @throws SystemException if a system exception occurred
1105             */
1106            public AssetTagStats fetchByClassNameId_First(long classNameId,
1107                    OrderByComparator orderByComparator) throws SystemException {
1108                    List<AssetTagStats> list = findByClassNameId(classNameId, 0, 1,
1109                                    orderByComparator);
1110    
1111                    if (!list.isEmpty()) {
1112                            return list.get(0);
1113                    }
1114    
1115                    return null;
1116            }
1117    
1118            /**
1119             * Returns the last asset tag stats in the ordered set where classNameId = &#63;.
1120             *
1121             * @param classNameId the class name ID
1122             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1123             * @return the last matching asset tag stats
1124             * @throws com.liferay.portlet.asset.NoSuchTagStatsException if a matching asset tag stats could not be found
1125             * @throws SystemException if a system exception occurred
1126             */
1127            public AssetTagStats findByClassNameId_Last(long classNameId,
1128                    OrderByComparator orderByComparator)
1129                    throws NoSuchTagStatsException, SystemException {
1130                    AssetTagStats assetTagStats = fetchByClassNameId_Last(classNameId,
1131                                    orderByComparator);
1132    
1133                    if (assetTagStats != null) {
1134                            return assetTagStats;
1135                    }
1136    
1137                    StringBundler msg = new StringBundler(4);
1138    
1139                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1140    
1141                    msg.append("classNameId=");
1142                    msg.append(classNameId);
1143    
1144                    msg.append(StringPool.CLOSE_CURLY_BRACE);
1145    
1146                    throw new NoSuchTagStatsException(msg.toString());
1147            }
1148    
1149            /**
1150             * Returns the last asset tag stats in the ordered set where classNameId = &#63;.
1151             *
1152             * @param classNameId the class name ID
1153             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1154             * @return the last matching asset tag stats, or <code>null</code> if a matching asset tag stats could not be found
1155             * @throws SystemException if a system exception occurred
1156             */
1157            public AssetTagStats fetchByClassNameId_Last(long classNameId,
1158                    OrderByComparator orderByComparator) throws SystemException {
1159                    int count = countByClassNameId(classNameId);
1160    
1161                    List<AssetTagStats> list = findByClassNameId(classNameId, count - 1,
1162                                    count, orderByComparator);
1163    
1164                    if (!list.isEmpty()) {
1165                            return list.get(0);
1166                    }
1167    
1168                    return null;
1169            }
1170    
1171            /**
1172             * Returns the asset tag statses before and after the current asset tag stats in the ordered set where classNameId = &#63;.
1173             *
1174             * @param tagStatsId the primary key of the current asset tag stats
1175             * @param classNameId the class name ID
1176             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1177             * @return the previous, current, and next asset tag stats
1178             * @throws com.liferay.portlet.asset.NoSuchTagStatsException if a asset tag stats with the primary key could not be found
1179             * @throws SystemException if a system exception occurred
1180             */
1181            public AssetTagStats[] findByClassNameId_PrevAndNext(long tagStatsId,
1182                    long classNameId, OrderByComparator orderByComparator)
1183                    throws NoSuchTagStatsException, SystemException {
1184                    AssetTagStats assetTagStats = findByPrimaryKey(tagStatsId);
1185    
1186                    Session session = null;
1187    
1188                    try {
1189                            session = openSession();
1190    
1191                            AssetTagStats[] array = new AssetTagStatsImpl[3];
1192    
1193                            array[0] = getByClassNameId_PrevAndNext(session, assetTagStats,
1194                                            classNameId, orderByComparator, true);
1195    
1196                            array[1] = assetTagStats;
1197    
1198                            array[2] = getByClassNameId_PrevAndNext(session, assetTagStats,
1199                                            classNameId, orderByComparator, false);
1200    
1201                            return array;
1202                    }
1203                    catch (Exception e) {
1204                            throw processException(e);
1205                    }
1206                    finally {
1207                            closeSession(session);
1208                    }
1209            }
1210    
1211            protected AssetTagStats getByClassNameId_PrevAndNext(Session session,
1212                    AssetTagStats assetTagStats, long classNameId,
1213                    OrderByComparator orderByComparator, boolean previous) {
1214                    StringBundler query = null;
1215    
1216                    if (orderByComparator != null) {
1217                            query = new StringBundler(6 +
1218                                            (orderByComparator.getOrderByFields().length * 6));
1219                    }
1220                    else {
1221                            query = new StringBundler(3);
1222                    }
1223    
1224                    query.append(_SQL_SELECT_ASSETTAGSTATS_WHERE);
1225    
1226                    query.append(_FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2);
1227    
1228                    if (orderByComparator != null) {
1229                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1230    
1231                            if (orderByConditionFields.length > 0) {
1232                                    query.append(WHERE_AND);
1233                            }
1234    
1235                            for (int i = 0; i < orderByConditionFields.length; i++) {
1236                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1237                                    query.append(orderByConditionFields[i]);
1238    
1239                                    if ((i + 1) < orderByConditionFields.length) {
1240                                            if (orderByComparator.isAscending() ^ previous) {
1241                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1242                                            }
1243                                            else {
1244                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1245                                            }
1246                                    }
1247                                    else {
1248                                            if (orderByComparator.isAscending() ^ previous) {
1249                                                    query.append(WHERE_GREATER_THAN);
1250                                            }
1251                                            else {
1252                                                    query.append(WHERE_LESSER_THAN);
1253                                            }
1254                                    }
1255                            }
1256    
1257                            query.append(ORDER_BY_CLAUSE);
1258    
1259                            String[] orderByFields = orderByComparator.getOrderByFields();
1260    
1261                            for (int i = 0; i < orderByFields.length; i++) {
1262                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1263                                    query.append(orderByFields[i]);
1264    
1265                                    if ((i + 1) < orderByFields.length) {
1266                                            if (orderByComparator.isAscending() ^ previous) {
1267                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1268                                            }
1269                                            else {
1270                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1271                                            }
1272                                    }
1273                                    else {
1274                                            if (orderByComparator.isAscending() ^ previous) {
1275                                                    query.append(ORDER_BY_ASC);
1276                                            }
1277                                            else {
1278                                                    query.append(ORDER_BY_DESC);
1279                                            }
1280                                    }
1281                            }
1282                    }
1283    
1284                    else {
1285                            query.append(AssetTagStatsModelImpl.ORDER_BY_JPQL);
1286                    }
1287    
1288                    String sql = query.toString();
1289    
1290                    Query q = session.createQuery(sql);
1291    
1292                    q.setFirstResult(0);
1293                    q.setMaxResults(2);
1294    
1295                    QueryPos qPos = QueryPos.getInstance(q);
1296    
1297                    qPos.add(classNameId);
1298    
1299                    if (orderByComparator != null) {
1300                            Object[] values = orderByComparator.getOrderByConditionValues(assetTagStats);
1301    
1302                            for (Object value : values) {
1303                                    qPos.add(value);
1304                            }
1305                    }
1306    
1307                    List<AssetTagStats> list = q.list();
1308    
1309                    if (list.size() == 2) {
1310                            return list.get(1);
1311                    }
1312                    else {
1313                            return null;
1314                    }
1315            }
1316    
1317            /**
1318             * 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.
1319             *
1320             * @param tagId the tag ID
1321             * @param classNameId the class name ID
1322             * @return the matching asset tag stats
1323             * @throws com.liferay.portlet.asset.NoSuchTagStatsException if a matching asset tag stats could not be found
1324             * @throws SystemException if a system exception occurred
1325             */
1326            public AssetTagStats findByT_C(long tagId, long classNameId)
1327                    throws NoSuchTagStatsException, SystemException {
1328                    AssetTagStats assetTagStats = fetchByT_C(tagId, classNameId);
1329    
1330                    if (assetTagStats == null) {
1331                            StringBundler msg = new StringBundler(6);
1332    
1333                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1334    
1335                            msg.append("tagId=");
1336                            msg.append(tagId);
1337    
1338                            msg.append(", classNameId=");
1339                            msg.append(classNameId);
1340    
1341                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1342    
1343                            if (_log.isWarnEnabled()) {
1344                                    _log.warn(msg.toString());
1345                            }
1346    
1347                            throw new NoSuchTagStatsException(msg.toString());
1348                    }
1349    
1350                    return assetTagStats;
1351            }
1352    
1353            /**
1354             * 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.
1355             *
1356             * @param tagId the tag ID
1357             * @param classNameId the class name ID
1358             * @return the matching asset tag stats, or <code>null</code> if a matching asset tag stats could not be found
1359             * @throws SystemException if a system exception occurred
1360             */
1361            public AssetTagStats fetchByT_C(long tagId, long classNameId)
1362                    throws SystemException {
1363                    return fetchByT_C(tagId, classNameId, true);
1364            }
1365    
1366            /**
1367             * 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.
1368             *
1369             * @param tagId the tag ID
1370             * @param classNameId the class name ID
1371             * @param retrieveFromCache whether to use the finder cache
1372             * @return the matching asset tag stats, or <code>null</code> if a matching asset tag stats could not be found
1373             * @throws SystemException if a system exception occurred
1374             */
1375            public AssetTagStats fetchByT_C(long tagId, long classNameId,
1376                    boolean retrieveFromCache) throws SystemException {
1377                    Object[] finderArgs = new Object[] { tagId, classNameId };
1378    
1379                    Object result = null;
1380    
1381                    if (retrieveFromCache) {
1382                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_T_C,
1383                                            finderArgs, this);
1384                    }
1385    
1386                    if (result instanceof AssetTagStats) {
1387                            AssetTagStats assetTagStats = (AssetTagStats)result;
1388    
1389                            if ((tagId != assetTagStats.getTagId()) ||
1390                                            (classNameId != assetTagStats.getClassNameId())) {
1391                                    result = null;
1392                            }
1393                    }
1394    
1395                    if (result == null) {
1396                            StringBundler query = new StringBundler(4);
1397    
1398                            query.append(_SQL_SELECT_ASSETTAGSTATS_WHERE);
1399    
1400                            query.append(_FINDER_COLUMN_T_C_TAGID_2);
1401    
1402                            query.append(_FINDER_COLUMN_T_C_CLASSNAMEID_2);
1403    
1404                            query.append(AssetTagStatsModelImpl.ORDER_BY_JPQL);
1405    
1406                            String sql = query.toString();
1407    
1408                            Session session = null;
1409    
1410                            try {
1411                                    session = openSession();
1412    
1413                                    Query q = session.createQuery(sql);
1414    
1415                                    QueryPos qPos = QueryPos.getInstance(q);
1416    
1417                                    qPos.add(tagId);
1418    
1419                                    qPos.add(classNameId);
1420    
1421                                    List<AssetTagStats> list = q.list();
1422    
1423                                    result = list;
1424    
1425                                    AssetTagStats assetTagStats = null;
1426    
1427                                    if (list.isEmpty()) {
1428                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_C,
1429                                                    finderArgs, list);
1430                                    }
1431                                    else {
1432                                            assetTagStats = list.get(0);
1433    
1434                                            cacheResult(assetTagStats);
1435    
1436                                            if ((assetTagStats.getTagId() != tagId) ||
1437                                                            (assetTagStats.getClassNameId() != classNameId)) {
1438                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_C,
1439                                                            finderArgs, assetTagStats);
1440                                            }
1441                                    }
1442    
1443                                    return assetTagStats;
1444                            }
1445                            catch (Exception e) {
1446                                    throw processException(e);
1447                            }
1448                            finally {
1449                                    if (result == null) {
1450                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_T_C,
1451                                                    finderArgs);
1452                                    }
1453    
1454                                    closeSession(session);
1455                            }
1456                    }
1457                    else {
1458                            if (result instanceof List<?>) {
1459                                    return null;
1460                            }
1461                            else {
1462                                    return (AssetTagStats)result;
1463                            }
1464                    }
1465            }
1466    
1467            /**
1468             * Returns all the asset tag statses.
1469             *
1470             * @return the asset tag statses
1471             * @throws SystemException if a system exception occurred
1472             */
1473            public List<AssetTagStats> findAll() throws SystemException {
1474                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1475            }
1476    
1477            /**
1478             * Returns a range of all the asset tag statses.
1479             *
1480             * <p>
1481             * 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.
1482             * </p>
1483             *
1484             * @param start the lower bound of the range of asset tag statses
1485             * @param end the upper bound of the range of asset tag statses (not inclusive)
1486             * @return the range of asset tag statses
1487             * @throws SystemException if a system exception occurred
1488             */
1489            public List<AssetTagStats> findAll(int start, int end)
1490                    throws SystemException {
1491                    return findAll(start, end, null);
1492            }
1493    
1494            /**
1495             * Returns an ordered range of all the asset tag statses.
1496             *
1497             * <p>
1498             * 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.
1499             * </p>
1500             *
1501             * @param start the lower bound of the range of asset tag statses
1502             * @param end the upper bound of the range of asset tag statses (not inclusive)
1503             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1504             * @return the ordered range of asset tag statses
1505             * @throws SystemException if a system exception occurred
1506             */
1507            public List<AssetTagStats> findAll(int start, int end,
1508                    OrderByComparator orderByComparator) throws SystemException {
1509                    FinderPath finderPath = null;
1510                    Object[] finderArgs = new Object[] { start, end, orderByComparator };
1511    
1512                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1513                                    (orderByComparator == null)) {
1514                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1515                            finderArgs = FINDER_ARGS_EMPTY;
1516                    }
1517                    else {
1518                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1519                            finderArgs = new Object[] { start, end, orderByComparator };
1520                    }
1521    
1522                    List<AssetTagStats> list = (List<AssetTagStats>)FinderCacheUtil.getResult(finderPath,
1523                                    finderArgs, this);
1524    
1525                    if (list == null) {
1526                            StringBundler query = null;
1527                            String sql = null;
1528    
1529                            if (orderByComparator != null) {
1530                                    query = new StringBundler(2 +
1531                                                    (orderByComparator.getOrderByFields().length * 3));
1532    
1533                                    query.append(_SQL_SELECT_ASSETTAGSTATS);
1534    
1535                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1536                                            orderByComparator);
1537    
1538                                    sql = query.toString();
1539                            }
1540                            else {
1541                                    sql = _SQL_SELECT_ASSETTAGSTATS.concat(AssetTagStatsModelImpl.ORDER_BY_JPQL);
1542                            }
1543    
1544                            Session session = null;
1545    
1546                            try {
1547                                    session = openSession();
1548    
1549                                    Query q = session.createQuery(sql);
1550    
1551                                    if (orderByComparator == null) {
1552                                            list = (List<AssetTagStats>)QueryUtil.list(q, getDialect(),
1553                                                            start, end, false);
1554    
1555                                            Collections.sort(list);
1556                                    }
1557                                    else {
1558                                            list = (List<AssetTagStats>)QueryUtil.list(q, getDialect(),
1559                                                            start, end);
1560                                    }
1561                            }
1562                            catch (Exception e) {
1563                                    throw processException(e);
1564                            }
1565                            finally {
1566                                    if (list == null) {
1567                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1568                                    }
1569                                    else {
1570                                            cacheResult(list);
1571    
1572                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1573                                    }
1574    
1575                                    closeSession(session);
1576                            }
1577                    }
1578    
1579                    return list;
1580            }
1581    
1582            /**
1583             * Removes all the asset tag statses where tagId = &#63; from the database.
1584             *
1585             * @param tagId the tag ID
1586             * @throws SystemException if a system exception occurred
1587             */
1588            public void removeByTagId(long tagId) throws SystemException {
1589                    for (AssetTagStats assetTagStats : findByTagId(tagId)) {
1590                            remove(assetTagStats);
1591                    }
1592            }
1593    
1594            /**
1595             * Removes all the asset tag statses where classNameId = &#63; from the database.
1596             *
1597             * @param classNameId the class name ID
1598             * @throws SystemException if a system exception occurred
1599             */
1600            public void removeByClassNameId(long classNameId) throws SystemException {
1601                    for (AssetTagStats assetTagStats : findByClassNameId(classNameId)) {
1602                            remove(assetTagStats);
1603                    }
1604            }
1605    
1606            /**
1607             * Removes the asset tag stats where tagId = &#63; and classNameId = &#63; from the database.
1608             *
1609             * @param tagId the tag ID
1610             * @param classNameId the class name ID
1611             * @return the asset tag stats that was removed
1612             * @throws SystemException if a system exception occurred
1613             */
1614            public AssetTagStats removeByT_C(long tagId, long classNameId)
1615                    throws NoSuchTagStatsException, SystemException {
1616                    AssetTagStats assetTagStats = findByT_C(tagId, classNameId);
1617    
1618                    return remove(assetTagStats);
1619            }
1620    
1621            /**
1622             * Removes all the asset tag statses from the database.
1623             *
1624             * @throws SystemException if a system exception occurred
1625             */
1626            public void removeAll() throws SystemException {
1627                    for (AssetTagStats assetTagStats : findAll()) {
1628                            remove(assetTagStats);
1629                    }
1630            }
1631    
1632            /**
1633             * Returns the number of asset tag statses where tagId = &#63;.
1634             *
1635             * @param tagId the tag ID
1636             * @return the number of matching asset tag statses
1637             * @throws SystemException if a system exception occurred
1638             */
1639            public int countByTagId(long tagId) throws SystemException {
1640                    Object[] finderArgs = new Object[] { tagId };
1641    
1642                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_TAGID,
1643                                    finderArgs, this);
1644    
1645                    if (count == null) {
1646                            StringBundler query = new StringBundler(2);
1647    
1648                            query.append(_SQL_COUNT_ASSETTAGSTATS_WHERE);
1649    
1650                            query.append(_FINDER_COLUMN_TAGID_TAGID_2);
1651    
1652                            String sql = query.toString();
1653    
1654                            Session session = null;
1655    
1656                            try {
1657                                    session = openSession();
1658    
1659                                    Query q = session.createQuery(sql);
1660    
1661                                    QueryPos qPos = QueryPos.getInstance(q);
1662    
1663                                    qPos.add(tagId);
1664    
1665                                    count = (Long)q.uniqueResult();
1666                            }
1667                            catch (Exception e) {
1668                                    throw processException(e);
1669                            }
1670                            finally {
1671                                    if (count == null) {
1672                                            count = Long.valueOf(0);
1673                                    }
1674    
1675                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TAGID,
1676                                            finderArgs, count);
1677    
1678                                    closeSession(session);
1679                            }
1680                    }
1681    
1682                    return count.intValue();
1683            }
1684    
1685            /**
1686             * Returns the number of asset tag statses where classNameId = &#63;.
1687             *
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 countByClassNameId(long classNameId) throws SystemException {
1693                    Object[] finderArgs = new Object[] { classNameId };
1694    
1695                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_CLASSNAMEID,
1696                                    finderArgs, this);
1697    
1698                    if (count == null) {
1699                            StringBundler query = new StringBundler(2);
1700    
1701                            query.append(_SQL_COUNT_ASSETTAGSTATS_WHERE);
1702    
1703                            query.append(_FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2);
1704    
1705                            String sql = query.toString();
1706    
1707                            Session session = null;
1708    
1709                            try {
1710                                    session = openSession();
1711    
1712                                    Query q = session.createQuery(sql);
1713    
1714                                    QueryPos qPos = QueryPos.getInstance(q);
1715    
1716                                    qPos.add(classNameId);
1717    
1718                                    count = (Long)q.uniqueResult();
1719                            }
1720                            catch (Exception e) {
1721                                    throw processException(e);
1722                            }
1723                            finally {
1724                                    if (count == null) {
1725                                            count = Long.valueOf(0);
1726                                    }
1727    
1728                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_CLASSNAMEID,
1729                                            finderArgs, count);
1730    
1731                                    closeSession(session);
1732                            }
1733                    }
1734    
1735                    return count.intValue();
1736            }
1737    
1738            /**
1739             * Returns the number of asset tag statses where tagId = &#63; and classNameId = &#63;.
1740             *
1741             * @param tagId the tag ID
1742             * @param classNameId the class name ID
1743             * @return the number of matching asset tag statses
1744             * @throws SystemException if a system exception occurred
1745             */
1746            public int countByT_C(long tagId, long classNameId)
1747                    throws SystemException {
1748                    Object[] finderArgs = new Object[] { tagId, classNameId };
1749    
1750                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_T_C,
1751                                    finderArgs, this);
1752    
1753                    if (count == null) {
1754                            StringBundler query = new StringBundler(3);
1755    
1756                            query.append(_SQL_COUNT_ASSETTAGSTATS_WHERE);
1757    
1758                            query.append(_FINDER_COLUMN_T_C_TAGID_2);
1759    
1760                            query.append(_FINDER_COLUMN_T_C_CLASSNAMEID_2);
1761    
1762                            String sql = query.toString();
1763    
1764                            Session session = null;
1765    
1766                            try {
1767                                    session = openSession();
1768    
1769                                    Query q = session.createQuery(sql);
1770    
1771                                    QueryPos qPos = QueryPos.getInstance(q);
1772    
1773                                    qPos.add(tagId);
1774    
1775                                    qPos.add(classNameId);
1776    
1777                                    count = (Long)q.uniqueResult();
1778                            }
1779                            catch (Exception e) {
1780                                    throw processException(e);
1781                            }
1782                            finally {
1783                                    if (count == null) {
1784                                            count = Long.valueOf(0);
1785                                    }
1786    
1787                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_T_C, finderArgs,
1788                                            count);
1789    
1790                                    closeSession(session);
1791                            }
1792                    }
1793    
1794                    return count.intValue();
1795            }
1796    
1797            /**
1798             * Returns the number of asset tag statses.
1799             *
1800             * @return the number of asset tag statses
1801             * @throws SystemException if a system exception occurred
1802             */
1803            public int countAll() throws SystemException {
1804                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1805                                    FINDER_ARGS_EMPTY, this);
1806    
1807                    if (count == null) {
1808                            Session session = null;
1809    
1810                            try {
1811                                    session = openSession();
1812    
1813                                    Query q = session.createQuery(_SQL_COUNT_ASSETTAGSTATS);
1814    
1815                                    count = (Long)q.uniqueResult();
1816                            }
1817                            catch (Exception e) {
1818                                    throw processException(e);
1819                            }
1820                            finally {
1821                                    if (count == null) {
1822                                            count = Long.valueOf(0);
1823                                    }
1824    
1825                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1826                                            FINDER_ARGS_EMPTY, count);
1827    
1828                                    closeSession(session);
1829                            }
1830                    }
1831    
1832                    return count.intValue();
1833            }
1834    
1835            /**
1836             * Initializes the asset tag stats persistence.
1837             */
1838            public void afterPropertiesSet() {
1839                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1840                                            com.liferay.portal.util.PropsUtil.get(
1841                                                    "value.object.listener.com.liferay.portlet.asset.model.AssetTagStats")));
1842    
1843                    if (listenerClassNames.length > 0) {
1844                            try {
1845                                    List<ModelListener<AssetTagStats>> listenersList = new ArrayList<ModelListener<AssetTagStats>>();
1846    
1847                                    for (String listenerClassName : listenerClassNames) {
1848                                            listenersList.add((ModelListener<AssetTagStats>)InstanceFactory.newInstance(
1849                                                            listenerClassName));
1850                                    }
1851    
1852                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1853                            }
1854                            catch (Exception e) {
1855                                    _log.error(e);
1856                            }
1857                    }
1858            }
1859    
1860            public void destroy() {
1861                    EntityCacheUtil.removeCache(AssetTagStatsImpl.class.getName());
1862                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1863                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1864            }
1865    
1866            @BeanReference(type = AssetCategoryPersistence.class)
1867            protected AssetCategoryPersistence assetCategoryPersistence;
1868            @BeanReference(type = AssetCategoryPropertyPersistence.class)
1869            protected AssetCategoryPropertyPersistence assetCategoryPropertyPersistence;
1870            @BeanReference(type = AssetEntryPersistence.class)
1871            protected AssetEntryPersistence assetEntryPersistence;
1872            @BeanReference(type = AssetLinkPersistence.class)
1873            protected AssetLinkPersistence assetLinkPersistence;
1874            @BeanReference(type = AssetTagPersistence.class)
1875            protected AssetTagPersistence assetTagPersistence;
1876            @BeanReference(type = AssetTagPropertyPersistence.class)
1877            protected AssetTagPropertyPersistence assetTagPropertyPersistence;
1878            @BeanReference(type = AssetTagStatsPersistence.class)
1879            protected AssetTagStatsPersistence assetTagStatsPersistence;
1880            @BeanReference(type = AssetVocabularyPersistence.class)
1881            protected AssetVocabularyPersistence assetVocabularyPersistence;
1882            @BeanReference(type = ResourcePersistence.class)
1883            protected ResourcePersistence resourcePersistence;
1884            @BeanReference(type = UserPersistence.class)
1885            protected UserPersistence userPersistence;
1886            private static final String _SQL_SELECT_ASSETTAGSTATS = "SELECT assetTagStats FROM AssetTagStats assetTagStats";
1887            private static final String _SQL_SELECT_ASSETTAGSTATS_WHERE = "SELECT assetTagStats FROM AssetTagStats assetTagStats WHERE ";
1888            private static final String _SQL_COUNT_ASSETTAGSTATS = "SELECT COUNT(assetTagStats) FROM AssetTagStats assetTagStats";
1889            private static final String _SQL_COUNT_ASSETTAGSTATS_WHERE = "SELECT COUNT(assetTagStats) FROM AssetTagStats assetTagStats WHERE ";
1890            private static final String _FINDER_COLUMN_TAGID_TAGID_2 = "assetTagStats.tagId = ?";
1891            private static final String _FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2 = "assetTagStats.classNameId = ?";
1892            private static final String _FINDER_COLUMN_T_C_TAGID_2 = "assetTagStats.tagId = ? AND ";
1893            private static final String _FINDER_COLUMN_T_C_CLASSNAMEID_2 = "assetTagStats.classNameId = ?";
1894            private static final String _ORDER_BY_ENTITY_ALIAS = "assetTagStats.";
1895            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No AssetTagStats exists with the primary key ";
1896            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No AssetTagStats exists with the key {";
1897            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1898            private static Log _log = LogFactoryUtil.getLog(AssetTagStatsPersistenceImpl.class);
1899            private static AssetTagStats _nullAssetTagStats = new AssetTagStatsImpl() {
1900                            @Override
1901                            public Object clone() {
1902                                    return this;
1903                            }
1904    
1905                            @Override
1906                            public CacheModel<AssetTagStats> toCacheModel() {
1907                                    return _nullAssetTagStatsCacheModel;
1908                            }
1909                    };
1910    
1911            private static CacheModel<AssetTagStats> _nullAssetTagStatsCacheModel = new CacheModel<AssetTagStats>() {
1912                            public AssetTagStats toEntityModel() {
1913                                    return _nullAssetTagStats;
1914                            }
1915                    };
1916    }