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