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