001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.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.kernel.util.Validator;
044    import com.liferay.portal.model.ModelListener;
045    import com.liferay.portal.service.persistence.BatchSessionUtil;
046    import com.liferay.portal.service.persistence.CompanyPersistence;
047    import com.liferay.portal.service.persistence.GroupPersistence;
048    import com.liferay.portal.service.persistence.ResourcePersistence;
049    import com.liferay.portal.service.persistence.UserPersistence;
050    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
051    
052    import com.liferay.portlet.asset.NoSuchEntryException;
053    import com.liferay.portlet.asset.model.AssetEntry;
054    import com.liferay.portlet.asset.model.impl.AssetEntryImpl;
055    import com.liferay.portlet.asset.model.impl.AssetEntryModelImpl;
056    import com.liferay.portlet.blogs.service.persistence.BlogsEntryPersistence;
057    import com.liferay.portlet.bookmarks.service.persistence.BookmarksEntryPersistence;
058    import com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryPersistence;
059    import com.liferay.portlet.documentlibrary.service.persistence.DLFolderPersistence;
060    import com.liferay.portlet.journal.service.persistence.JournalArticlePersistence;
061    import com.liferay.portlet.journal.service.persistence.JournalArticleResourcePersistence;
062    import com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence;
063    import com.liferay.portlet.social.service.persistence.SocialEquityLogPersistence;
064    import com.liferay.portlet.wiki.service.persistence.WikiPagePersistence;
065    import com.liferay.portlet.wiki.service.persistence.WikiPageResourcePersistence;
066    
067    import java.io.Serializable;
068    
069    import java.util.ArrayList;
070    import java.util.Collections;
071    import java.util.List;
072    import java.util.Set;
073    
074    /**
075     * The persistence implementation for the asset entry service.
076     *
077     * <p>
078     * Never modify or reference this class directly. Always use {@link AssetEntryUtil} to access the asset entry persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
079     * </p>
080     *
081     * <p>
082     * Caching information and settings can be found in <code>portal.properties</code>
083     * </p>
084     *
085     * @author Brian Wing Shun Chan
086     * @see AssetEntryPersistence
087     * @see AssetEntryUtil
088     * @generated
089     */
090    public class AssetEntryPersistenceImpl extends BasePersistenceImpl<AssetEntry>
091            implements AssetEntryPersistence {
092            public static final String FINDER_CLASS_NAME_ENTITY = AssetEntryImpl.class.getName();
093            public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
094                    ".List";
095            public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(AssetEntryModelImpl.ENTITY_CACHE_ENABLED,
096                            AssetEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
097                            "findByCompanyId",
098                            new String[] {
099                                    Long.class.getName(),
100                                    
101                            "java.lang.Integer", "java.lang.Integer",
102                                    "com.liferay.portal.kernel.util.OrderByComparator"
103                            });
104            public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(AssetEntryModelImpl.ENTITY_CACHE_ENABLED,
105                            AssetEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
106                            "countByCompanyId", new String[] { Long.class.getName() });
107            public static final FinderPath FINDER_PATH_FETCH_BY_G_CU = new FinderPath(AssetEntryModelImpl.ENTITY_CACHE_ENABLED,
108                            AssetEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
109                            "fetchByG_CU",
110                            new String[] { Long.class.getName(), String.class.getName() });
111            public static final FinderPath FINDER_PATH_COUNT_BY_G_CU = new FinderPath(AssetEntryModelImpl.ENTITY_CACHE_ENABLED,
112                            AssetEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
113                            "countByG_CU",
114                            new String[] { Long.class.getName(), String.class.getName() });
115            public static final FinderPath FINDER_PATH_FETCH_BY_C_C = new FinderPath(AssetEntryModelImpl.ENTITY_CACHE_ENABLED,
116                            AssetEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
117                            "fetchByC_C",
118                            new String[] { Long.class.getName(), Long.class.getName() });
119            public static final FinderPath FINDER_PATH_COUNT_BY_C_C = new FinderPath(AssetEntryModelImpl.ENTITY_CACHE_ENABLED,
120                            AssetEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
121                            "countByC_C",
122                            new String[] { Long.class.getName(), Long.class.getName() });
123            public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(AssetEntryModelImpl.ENTITY_CACHE_ENABLED,
124                            AssetEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
125                            "findAll", new String[0]);
126            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(AssetEntryModelImpl.ENTITY_CACHE_ENABLED,
127                            AssetEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
128                            "countAll", new String[0]);
129    
130            /**
131             * Caches the asset entry in the entity cache if it is enabled.
132             *
133             * @param assetEntry the asset entry to cache
134             */
135            public void cacheResult(AssetEntry assetEntry) {
136                    EntityCacheUtil.putResult(AssetEntryModelImpl.ENTITY_CACHE_ENABLED,
137                            AssetEntryImpl.class, assetEntry.getPrimaryKey(), assetEntry);
138    
139                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_CU,
140                            new Object[] {
141                                    new Long(assetEntry.getGroupId()),
142                                    
143                            assetEntry.getClassUuid()
144                            }, assetEntry);
145    
146                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
147                            new Object[] {
148                                    new Long(assetEntry.getClassNameId()),
149                                    new Long(assetEntry.getClassPK())
150                            }, assetEntry);
151            }
152    
153            /**
154             * Caches the asset entries in the entity cache if it is enabled.
155             *
156             * @param assetEntries the asset entries to cache
157             */
158            public void cacheResult(List<AssetEntry> assetEntries) {
159                    for (AssetEntry assetEntry : assetEntries) {
160                            if (EntityCacheUtil.getResult(
161                                                    AssetEntryModelImpl.ENTITY_CACHE_ENABLED,
162                                                    AssetEntryImpl.class, assetEntry.getPrimaryKey(), this) == null) {
163                                    cacheResult(assetEntry);
164                            }
165                    }
166            }
167    
168            /**
169             * Clears the cache for all asset entries.
170             *
171             * <p>
172             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
173             * </p>
174             */
175            public void clearCache() {
176                    CacheRegistryUtil.clear(AssetEntryImpl.class.getName());
177                    EntityCacheUtil.clearCache(AssetEntryImpl.class.getName());
178                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
179                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
180            }
181    
182            /**
183             * Clears the cache for the asset entry.
184             *
185             * <p>
186             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
187             * </p>
188             */
189            public void clearCache(AssetEntry assetEntry) {
190                    EntityCacheUtil.removeResult(AssetEntryModelImpl.ENTITY_CACHE_ENABLED,
191                            AssetEntryImpl.class, assetEntry.getPrimaryKey());
192    
193                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_CU,
194                            new Object[] {
195                                    new Long(assetEntry.getGroupId()),
196                                    
197                            assetEntry.getClassUuid()
198                            });
199    
200                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
201                            new Object[] {
202                                    new Long(assetEntry.getClassNameId()),
203                                    new Long(assetEntry.getClassPK())
204                            });
205            }
206    
207            /**
208             * Creates a new asset entry with the primary key. Does not add the asset entry to the database.
209             *
210             * @param entryId the primary key for the new asset entry
211             * @return the new asset entry
212             */
213            public AssetEntry create(long entryId) {
214                    AssetEntry assetEntry = new AssetEntryImpl();
215    
216                    assetEntry.setNew(true);
217                    assetEntry.setPrimaryKey(entryId);
218    
219                    return assetEntry;
220            }
221    
222            /**
223             * Removes the asset entry with the primary key from the database. Also notifies the appropriate model listeners.
224             *
225             * @param primaryKey the primary key of the asset entry to remove
226             * @return the asset entry that was removed
227             * @throws com.liferay.portal.NoSuchModelException if a asset entry with the primary key could not be found
228             * @throws SystemException if a system exception occurred
229             */
230            public AssetEntry remove(Serializable primaryKey)
231                    throws NoSuchModelException, SystemException {
232                    return remove(((Long)primaryKey).longValue());
233            }
234    
235            /**
236             * Removes the asset entry with the primary key from the database. Also notifies the appropriate model listeners.
237             *
238             * @param entryId the primary key of the asset entry to remove
239             * @return the asset entry that was removed
240             * @throws com.liferay.portlet.asset.NoSuchEntryException if a asset entry with the primary key could not be found
241             * @throws SystemException if a system exception occurred
242             */
243            public AssetEntry remove(long entryId)
244                    throws NoSuchEntryException, SystemException {
245                    Session session = null;
246    
247                    try {
248                            session = openSession();
249    
250                            AssetEntry assetEntry = (AssetEntry)session.get(AssetEntryImpl.class,
251                                            new Long(entryId));
252    
253                            if (assetEntry == null) {
254                                    if (_log.isWarnEnabled()) {
255                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + entryId);
256                                    }
257    
258                                    throw new NoSuchEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
259                                            entryId);
260                            }
261    
262                            return remove(assetEntry);
263                    }
264                    catch (NoSuchEntryException nsee) {
265                            throw nsee;
266                    }
267                    catch (Exception e) {
268                            throw processException(e);
269                    }
270                    finally {
271                            closeSession(session);
272                    }
273            }
274    
275            protected AssetEntry removeImpl(AssetEntry assetEntry)
276                    throws SystemException {
277                    assetEntry = toUnwrappedModel(assetEntry);
278    
279                    try {
280                            clearAssetCategories.clear(assetEntry.getPrimaryKey());
281                    }
282                    catch (Exception e) {
283                            throw processException(e);
284                    }
285                    finally {
286                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETCATEGORIES_NAME);
287                    }
288    
289                    try {
290                            clearAssetTags.clear(assetEntry.getPrimaryKey());
291                    }
292                    catch (Exception e) {
293                            throw processException(e);
294                    }
295                    finally {
296                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
297                    }
298    
299                    Session session = null;
300    
301                    try {
302                            session = openSession();
303    
304                            BatchSessionUtil.delete(session, assetEntry);
305                    }
306                    catch (Exception e) {
307                            throw processException(e);
308                    }
309                    finally {
310                            closeSession(session);
311                    }
312    
313                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
314    
315                    AssetEntryModelImpl assetEntryModelImpl = (AssetEntryModelImpl)assetEntry;
316    
317                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_CU,
318                            new Object[] {
319                                    new Long(assetEntryModelImpl.getOriginalGroupId()),
320                                    
321                            assetEntryModelImpl.getOriginalClassUuid()
322                            });
323    
324                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
325                            new Object[] {
326                                    new Long(assetEntryModelImpl.getOriginalClassNameId()),
327                                    new Long(assetEntryModelImpl.getOriginalClassPK())
328                            });
329    
330                    EntityCacheUtil.removeResult(AssetEntryModelImpl.ENTITY_CACHE_ENABLED,
331                            AssetEntryImpl.class, assetEntry.getPrimaryKey());
332    
333                    return assetEntry;
334            }
335    
336            public AssetEntry updateImpl(
337                    com.liferay.portlet.asset.model.AssetEntry assetEntry, boolean merge)
338                    throws SystemException {
339                    assetEntry = toUnwrappedModel(assetEntry);
340    
341                    boolean isNew = assetEntry.isNew();
342    
343                    AssetEntryModelImpl assetEntryModelImpl = (AssetEntryModelImpl)assetEntry;
344    
345                    Session session = null;
346    
347                    try {
348                            session = openSession();
349    
350                            BatchSessionUtil.update(session, assetEntry, merge);
351    
352                            assetEntry.setNew(false);
353                    }
354                    catch (Exception e) {
355                            throw processException(e);
356                    }
357                    finally {
358                            closeSession(session);
359                    }
360    
361                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
362    
363                    EntityCacheUtil.putResult(AssetEntryModelImpl.ENTITY_CACHE_ENABLED,
364                            AssetEntryImpl.class, assetEntry.getPrimaryKey(), assetEntry);
365    
366                    if (!isNew &&
367                                    ((assetEntry.getGroupId() != assetEntryModelImpl.getOriginalGroupId()) ||
368                                    !Validator.equals(assetEntry.getClassUuid(),
369                                            assetEntryModelImpl.getOriginalClassUuid()))) {
370                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_CU,
371                                    new Object[] {
372                                            new Long(assetEntryModelImpl.getOriginalGroupId()),
373                                            
374                                    assetEntryModelImpl.getOriginalClassUuid()
375                                    });
376                    }
377    
378                    if (isNew ||
379                                    ((assetEntry.getGroupId() != assetEntryModelImpl.getOriginalGroupId()) ||
380                                    !Validator.equals(assetEntry.getClassUuid(),
381                                            assetEntryModelImpl.getOriginalClassUuid()))) {
382                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_CU,
383                                    new Object[] {
384                                            new Long(assetEntry.getGroupId()),
385                                            
386                                    assetEntry.getClassUuid()
387                                    }, assetEntry);
388                    }
389    
390                    if (!isNew &&
391                                    ((assetEntry.getClassNameId() != assetEntryModelImpl.getOriginalClassNameId()) ||
392                                    (assetEntry.getClassPK() != assetEntryModelImpl.getOriginalClassPK()))) {
393                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
394                                    new Object[] {
395                                            new Long(assetEntryModelImpl.getOriginalClassNameId()),
396                                            new Long(assetEntryModelImpl.getOriginalClassPK())
397                                    });
398                    }
399    
400                    if (isNew ||
401                                    ((assetEntry.getClassNameId() != assetEntryModelImpl.getOriginalClassNameId()) ||
402                                    (assetEntry.getClassPK() != assetEntryModelImpl.getOriginalClassPK()))) {
403                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
404                                    new Object[] {
405                                            new Long(assetEntry.getClassNameId()),
406                                            new Long(assetEntry.getClassPK())
407                                    }, assetEntry);
408                    }
409    
410                    return assetEntry;
411            }
412    
413            protected AssetEntry toUnwrappedModel(AssetEntry assetEntry) {
414                    if (assetEntry instanceof AssetEntryImpl) {
415                            return assetEntry;
416                    }
417    
418                    AssetEntryImpl assetEntryImpl = new AssetEntryImpl();
419    
420                    assetEntryImpl.setNew(assetEntry.isNew());
421                    assetEntryImpl.setPrimaryKey(assetEntry.getPrimaryKey());
422    
423                    assetEntryImpl.setEntryId(assetEntry.getEntryId());
424                    assetEntryImpl.setGroupId(assetEntry.getGroupId());
425                    assetEntryImpl.setCompanyId(assetEntry.getCompanyId());
426                    assetEntryImpl.setUserId(assetEntry.getUserId());
427                    assetEntryImpl.setUserName(assetEntry.getUserName());
428                    assetEntryImpl.setCreateDate(assetEntry.getCreateDate());
429                    assetEntryImpl.setModifiedDate(assetEntry.getModifiedDate());
430                    assetEntryImpl.setClassNameId(assetEntry.getClassNameId());
431                    assetEntryImpl.setClassPK(assetEntry.getClassPK());
432                    assetEntryImpl.setClassUuid(assetEntry.getClassUuid());
433                    assetEntryImpl.setVisible(assetEntry.isVisible());
434                    assetEntryImpl.setStartDate(assetEntry.getStartDate());
435                    assetEntryImpl.setEndDate(assetEntry.getEndDate());
436                    assetEntryImpl.setPublishDate(assetEntry.getPublishDate());
437                    assetEntryImpl.setExpirationDate(assetEntry.getExpirationDate());
438                    assetEntryImpl.setMimeType(assetEntry.getMimeType());
439                    assetEntryImpl.setTitle(assetEntry.getTitle());
440                    assetEntryImpl.setDescription(assetEntry.getDescription());
441                    assetEntryImpl.setSummary(assetEntry.getSummary());
442                    assetEntryImpl.setUrl(assetEntry.getUrl());
443                    assetEntryImpl.setHeight(assetEntry.getHeight());
444                    assetEntryImpl.setWidth(assetEntry.getWidth());
445                    assetEntryImpl.setPriority(assetEntry.getPriority());
446                    assetEntryImpl.setViewCount(assetEntry.getViewCount());
447    
448                    return assetEntryImpl;
449            }
450    
451            /**
452             * Finds the asset entry with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
453             *
454             * @param primaryKey the primary key of the asset entry to find
455             * @return the asset entry
456             * @throws com.liferay.portal.NoSuchModelException if a asset entry with the primary key could not be found
457             * @throws SystemException if a system exception occurred
458             */
459            public AssetEntry findByPrimaryKey(Serializable primaryKey)
460                    throws NoSuchModelException, SystemException {
461                    return findByPrimaryKey(((Long)primaryKey).longValue());
462            }
463    
464            /**
465             * Finds the asset entry with the primary key or throws a {@link com.liferay.portlet.asset.NoSuchEntryException} if it could not be found.
466             *
467             * @param entryId the primary key of the asset entry to find
468             * @return the asset entry
469             * @throws com.liferay.portlet.asset.NoSuchEntryException if a asset entry with the primary key could not be found
470             * @throws SystemException if a system exception occurred
471             */
472            public AssetEntry findByPrimaryKey(long entryId)
473                    throws NoSuchEntryException, SystemException {
474                    AssetEntry assetEntry = fetchByPrimaryKey(entryId);
475    
476                    if (assetEntry == null) {
477                            if (_log.isWarnEnabled()) {
478                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + entryId);
479                            }
480    
481                            throw new NoSuchEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
482                                    entryId);
483                    }
484    
485                    return assetEntry;
486            }
487    
488            /**
489             * Finds the asset entry with the primary key or returns <code>null</code> if it could not be found.
490             *
491             * @param primaryKey the primary key of the asset entry to find
492             * @return the asset entry, or <code>null</code> if a asset entry with the primary key could not be found
493             * @throws SystemException if a system exception occurred
494             */
495            public AssetEntry fetchByPrimaryKey(Serializable primaryKey)
496                    throws SystemException {
497                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
498            }
499    
500            /**
501             * Finds the asset entry with the primary key or returns <code>null</code> if it could not be found.
502             *
503             * @param entryId the primary key of the asset entry to find
504             * @return the asset entry, or <code>null</code> if a asset entry with the primary key could not be found
505             * @throws SystemException if a system exception occurred
506             */
507            public AssetEntry fetchByPrimaryKey(long entryId) throws SystemException {
508                    AssetEntry assetEntry = (AssetEntry)EntityCacheUtil.getResult(AssetEntryModelImpl.ENTITY_CACHE_ENABLED,
509                                    AssetEntryImpl.class, entryId, this);
510    
511                    if (assetEntry == null) {
512                            Session session = null;
513    
514                            try {
515                                    session = openSession();
516    
517                                    assetEntry = (AssetEntry)session.get(AssetEntryImpl.class,
518                                                    new Long(entryId));
519                            }
520                            catch (Exception e) {
521                                    throw processException(e);
522                            }
523                            finally {
524                                    if (assetEntry != null) {
525                                            cacheResult(assetEntry);
526                                    }
527    
528                                    closeSession(session);
529                            }
530                    }
531    
532                    return assetEntry;
533            }
534    
535            /**
536             * Finds all the asset entries where companyId = &#63;.
537             *
538             * @param companyId the company id to search with
539             * @return the matching asset entries
540             * @throws SystemException if a system exception occurred
541             */
542            public List<AssetEntry> findByCompanyId(long companyId)
543                    throws SystemException {
544                    return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
545                            null);
546            }
547    
548            /**
549             * Finds a range of all the asset entries where companyId = &#63;.
550             *
551             * <p>
552             * 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.
553             * </p>
554             *
555             * @param companyId the company id to search with
556             * @param start the lower bound of the range of asset entries to return
557             * @param end the upper bound of the range of asset entries to return (not inclusive)
558             * @return the range of matching asset entries
559             * @throws SystemException if a system exception occurred
560             */
561            public List<AssetEntry> findByCompanyId(long companyId, int start, int end)
562                    throws SystemException {
563                    return findByCompanyId(companyId, start, end, null);
564            }
565    
566            /**
567             * Finds an ordered range of all the asset entries where companyId = &#63;.
568             *
569             * <p>
570             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
571             * </p>
572             *
573             * @param companyId the company id to search with
574             * @param start the lower bound of the range of asset entries to return
575             * @param end the upper bound of the range of asset entries to return (not inclusive)
576             * @param orderByComparator the comparator to order the results by
577             * @return the ordered range of matching asset entries
578             * @throws SystemException if a system exception occurred
579             */
580            public List<AssetEntry> findByCompanyId(long companyId, int start, int end,
581                    OrderByComparator orderByComparator) throws SystemException {
582                    Object[] finderArgs = new Object[] {
583                                    companyId,
584                                    
585                                    String.valueOf(start), String.valueOf(end),
586                                    String.valueOf(orderByComparator)
587                            };
588    
589                    List<AssetEntry> list = (List<AssetEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
590                                    finderArgs, this);
591    
592                    if (list == null) {
593                            Session session = null;
594    
595                            try {
596                                    session = openSession();
597    
598                                    StringBundler query = null;
599    
600                                    if (orderByComparator != null) {
601                                            query = new StringBundler(3 +
602                                                            (orderByComparator.getOrderByFields().length * 3));
603                                    }
604                                    else {
605                                            query = new StringBundler(2);
606                                    }
607    
608                                    query.append(_SQL_SELECT_ASSETENTRY_WHERE);
609    
610                                    query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
611    
612                                    if (orderByComparator != null) {
613                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
614                                                    orderByComparator);
615                                    }
616    
617                                    String sql = query.toString();
618    
619                                    Query q = session.createQuery(sql);
620    
621                                    QueryPos qPos = QueryPos.getInstance(q);
622    
623                                    qPos.add(companyId);
624    
625                                    list = (List<AssetEntry>)QueryUtil.list(q, getDialect(), start,
626                                                    end);
627                            }
628                            catch (Exception e) {
629                                    throw processException(e);
630                            }
631                            finally {
632                                    if (list == null) {
633                                            list = new ArrayList<AssetEntry>();
634                                    }
635    
636                                    cacheResult(list);
637    
638                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
639                                            finderArgs, list);
640    
641                                    closeSession(session);
642                            }
643                    }
644    
645                    return list;
646            }
647    
648            /**
649             * Finds the first asset entry in the ordered set where companyId = &#63;.
650             *
651             * <p>
652             * 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.
653             * </p>
654             *
655             * @param companyId the company id to search with
656             * @param orderByComparator the comparator to order the set by
657             * @return the first matching asset entry
658             * @throws com.liferay.portlet.asset.NoSuchEntryException if a matching asset entry could not be found
659             * @throws SystemException if a system exception occurred
660             */
661            public AssetEntry findByCompanyId_First(long companyId,
662                    OrderByComparator orderByComparator)
663                    throws NoSuchEntryException, SystemException {
664                    List<AssetEntry> list = findByCompanyId(companyId, 0, 1,
665                                    orderByComparator);
666    
667                    if (list.isEmpty()) {
668                            StringBundler msg = new StringBundler(4);
669    
670                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
671    
672                            msg.append("companyId=");
673                            msg.append(companyId);
674    
675                            msg.append(StringPool.CLOSE_CURLY_BRACE);
676    
677                            throw new NoSuchEntryException(msg.toString());
678                    }
679                    else {
680                            return list.get(0);
681                    }
682            }
683    
684            /**
685             * Finds the last asset entry in the ordered set where companyId = &#63;.
686             *
687             * <p>
688             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
689             * </p>
690             *
691             * @param companyId the company id to search with
692             * @param orderByComparator the comparator to order the set by
693             * @return the last matching asset entry
694             * @throws com.liferay.portlet.asset.NoSuchEntryException if a matching asset entry could not be found
695             * @throws SystemException if a system exception occurred
696             */
697            public AssetEntry findByCompanyId_Last(long companyId,
698                    OrderByComparator orderByComparator)
699                    throws NoSuchEntryException, SystemException {
700                    int count = countByCompanyId(companyId);
701    
702                    List<AssetEntry> list = findByCompanyId(companyId, count - 1, count,
703                                    orderByComparator);
704    
705                    if (list.isEmpty()) {
706                            StringBundler msg = new StringBundler(4);
707    
708                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
709    
710                            msg.append("companyId=");
711                            msg.append(companyId);
712    
713                            msg.append(StringPool.CLOSE_CURLY_BRACE);
714    
715                            throw new NoSuchEntryException(msg.toString());
716                    }
717                    else {
718                            return list.get(0);
719                    }
720            }
721    
722            /**
723             * Finds the asset entries before and after the current asset entry in the ordered set where companyId = &#63;.
724             *
725             * <p>
726             * 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.
727             * </p>
728             *
729             * @param entryId the primary key of the current asset entry
730             * @param companyId the company id to search with
731             * @param orderByComparator the comparator to order the set by
732             * @return the previous, current, and next asset entry
733             * @throws com.liferay.portlet.asset.NoSuchEntryException if a asset entry with the primary key could not be found
734             * @throws SystemException if a system exception occurred
735             */
736            public AssetEntry[] findByCompanyId_PrevAndNext(long entryId,
737                    long companyId, OrderByComparator orderByComparator)
738                    throws NoSuchEntryException, SystemException {
739                    AssetEntry assetEntry = findByPrimaryKey(entryId);
740    
741                    Session session = null;
742    
743                    try {
744                            session = openSession();
745    
746                            AssetEntry[] array = new AssetEntryImpl[3];
747    
748                            array[0] = getByCompanyId_PrevAndNext(session, assetEntry,
749                                            companyId, orderByComparator, true);
750    
751                            array[1] = assetEntry;
752    
753                            array[2] = getByCompanyId_PrevAndNext(session, assetEntry,
754                                            companyId, orderByComparator, false);
755    
756                            return array;
757                    }
758                    catch (Exception e) {
759                            throw processException(e);
760                    }
761                    finally {
762                            closeSession(session);
763                    }
764            }
765    
766            protected AssetEntry getByCompanyId_PrevAndNext(Session session,
767                    AssetEntry assetEntry, long companyId,
768                    OrderByComparator orderByComparator, boolean previous) {
769                    StringBundler query = null;
770    
771                    if (orderByComparator != null) {
772                            query = new StringBundler(6 +
773                                            (orderByComparator.getOrderByFields().length * 6));
774                    }
775                    else {
776                            query = new StringBundler(3);
777                    }
778    
779                    query.append(_SQL_SELECT_ASSETENTRY_WHERE);
780    
781                    query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
782    
783                    if (orderByComparator != null) {
784                            String[] orderByFields = orderByComparator.getOrderByFields();
785    
786                            if (orderByFields.length > 0) {
787                                    query.append(WHERE_AND);
788                            }
789    
790                            for (int i = 0; i < orderByFields.length; i++) {
791                                    query.append(_ORDER_BY_ENTITY_ALIAS);
792                                    query.append(orderByFields[i]);
793    
794                                    if ((i + 1) < orderByFields.length) {
795                                            if (orderByComparator.isAscending() ^ previous) {
796                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
797                                            }
798                                            else {
799                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
800                                            }
801                                    }
802                                    else {
803                                            if (orderByComparator.isAscending() ^ previous) {
804                                                    query.append(WHERE_GREATER_THAN);
805                                            }
806                                            else {
807                                                    query.append(WHERE_LESSER_THAN);
808                                            }
809                                    }
810                            }
811    
812                            query.append(ORDER_BY_CLAUSE);
813    
814                            for (int i = 0; i < orderByFields.length; i++) {
815                                    query.append(_ORDER_BY_ENTITY_ALIAS);
816                                    query.append(orderByFields[i]);
817    
818                                    if ((i + 1) < orderByFields.length) {
819                                            if (orderByComparator.isAscending() ^ previous) {
820                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
821                                            }
822                                            else {
823                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
824                                            }
825                                    }
826                                    else {
827                                            if (orderByComparator.isAscending() ^ previous) {
828                                                    query.append(ORDER_BY_ASC);
829                                            }
830                                            else {
831                                                    query.append(ORDER_BY_DESC);
832                                            }
833                                    }
834                            }
835                    }
836    
837                    String sql = query.toString();
838    
839                    Query q = session.createQuery(sql);
840    
841                    q.setFirstResult(0);
842                    q.setMaxResults(2);
843    
844                    QueryPos qPos = QueryPos.getInstance(q);
845    
846                    qPos.add(companyId);
847    
848                    if (orderByComparator != null) {
849                            Object[] values = orderByComparator.getOrderByValues(assetEntry);
850    
851                            for (Object value : values) {
852                                    qPos.add(value);
853                            }
854                    }
855    
856                    List<AssetEntry> list = q.list();
857    
858                    if (list.size() == 2) {
859                            return list.get(1);
860                    }
861                    else {
862                            return null;
863                    }
864            }
865    
866            /**
867             * Finds the asset entry where groupId = &#63; and classUuid = &#63; or throws a {@link com.liferay.portlet.asset.NoSuchEntryException} if it could not be found.
868             *
869             * @param groupId the group id to search with
870             * @param classUuid the class uuid to search with
871             * @return the matching asset entry
872             * @throws com.liferay.portlet.asset.NoSuchEntryException if a matching asset entry could not be found
873             * @throws SystemException if a system exception occurred
874             */
875            public AssetEntry findByG_CU(long groupId, String classUuid)
876                    throws NoSuchEntryException, SystemException {
877                    AssetEntry assetEntry = fetchByG_CU(groupId, classUuid);
878    
879                    if (assetEntry == null) {
880                            StringBundler msg = new StringBundler(6);
881    
882                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
883    
884                            msg.append("groupId=");
885                            msg.append(groupId);
886    
887                            msg.append(", classUuid=");
888                            msg.append(classUuid);
889    
890                            msg.append(StringPool.CLOSE_CURLY_BRACE);
891    
892                            if (_log.isWarnEnabled()) {
893                                    _log.warn(msg.toString());
894                            }
895    
896                            throw new NoSuchEntryException(msg.toString());
897                    }
898    
899                    return assetEntry;
900            }
901    
902            /**
903             * Finds the asset entry where groupId = &#63; and classUuid = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
904             *
905             * @param groupId the group id to search with
906             * @param classUuid the class uuid to search with
907             * @return the matching asset entry, or <code>null</code> if a matching asset entry could not be found
908             * @throws SystemException if a system exception occurred
909             */
910            public AssetEntry fetchByG_CU(long groupId, String classUuid)
911                    throws SystemException {
912                    return fetchByG_CU(groupId, classUuid, true);
913            }
914    
915            /**
916             * Finds the asset entry where groupId = &#63; and classUuid = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
917             *
918             * @param groupId the group id to search with
919             * @param classUuid the class uuid to search with
920             * @return the matching asset entry, or <code>null</code> if a matching asset entry could not be found
921             * @throws SystemException if a system exception occurred
922             */
923            public AssetEntry fetchByG_CU(long groupId, String classUuid,
924                    boolean retrieveFromCache) throws SystemException {
925                    Object[] finderArgs = new Object[] { groupId, classUuid };
926    
927                    Object result = null;
928    
929                    if (retrieveFromCache) {
930                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_CU,
931                                            finderArgs, this);
932                    }
933    
934                    if (result == null) {
935                            Session session = null;
936    
937                            try {
938                                    session = openSession();
939    
940                                    StringBundler query = new StringBundler(3);
941    
942                                    query.append(_SQL_SELECT_ASSETENTRY_WHERE);
943    
944                                    query.append(_FINDER_COLUMN_G_CU_GROUPID_2);
945    
946                                    if (classUuid == null) {
947                                            query.append(_FINDER_COLUMN_G_CU_CLASSUUID_1);
948                                    }
949                                    else {
950                                            if (classUuid.equals(StringPool.BLANK)) {
951                                                    query.append(_FINDER_COLUMN_G_CU_CLASSUUID_3);
952                                            }
953                                            else {
954                                                    query.append(_FINDER_COLUMN_G_CU_CLASSUUID_2);
955                                            }
956                                    }
957    
958                                    String sql = query.toString();
959    
960                                    Query q = session.createQuery(sql);
961    
962                                    QueryPos qPos = QueryPos.getInstance(q);
963    
964                                    qPos.add(groupId);
965    
966                                    if (classUuid != null) {
967                                            qPos.add(classUuid);
968                                    }
969    
970                                    List<AssetEntry> list = q.list();
971    
972                                    result = list;
973    
974                                    AssetEntry assetEntry = null;
975    
976                                    if (list.isEmpty()) {
977                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_CU,
978                                                    finderArgs, list);
979                                    }
980                                    else {
981                                            assetEntry = list.get(0);
982    
983                                            cacheResult(assetEntry);
984    
985                                            if ((assetEntry.getGroupId() != groupId) ||
986                                                            (assetEntry.getClassUuid() == null) ||
987                                                            !assetEntry.getClassUuid().equals(classUuid)) {
988                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_CU,
989                                                            finderArgs, assetEntry);
990                                            }
991                                    }
992    
993                                    return assetEntry;
994                            }
995                            catch (Exception e) {
996                                    throw processException(e);
997                            }
998                            finally {
999                                    if (result == null) {
1000                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_CU,
1001                                                    finderArgs, new ArrayList<AssetEntry>());
1002                                    }
1003    
1004                                    closeSession(session);
1005                            }
1006                    }
1007                    else {
1008                            if (result instanceof List<?>) {
1009                                    return null;
1010                            }
1011                            else {
1012                                    return (AssetEntry)result;
1013                            }
1014                    }
1015            }
1016    
1017            /**
1018             * Finds the asset entry where classNameId = &#63; and classPK = &#63; or throws a {@link com.liferay.portlet.asset.NoSuchEntryException} if it could not be found.
1019             *
1020             * @param classNameId the class name id to search with
1021             * @param classPK the class p k to search with
1022             * @return the matching asset entry
1023             * @throws com.liferay.portlet.asset.NoSuchEntryException if a matching asset entry could not be found
1024             * @throws SystemException if a system exception occurred
1025             */
1026            public AssetEntry findByC_C(long classNameId, long classPK)
1027                    throws NoSuchEntryException, SystemException {
1028                    AssetEntry assetEntry = fetchByC_C(classNameId, classPK);
1029    
1030                    if (assetEntry == null) {
1031                            StringBundler msg = new StringBundler(6);
1032    
1033                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1034    
1035                            msg.append("classNameId=");
1036                            msg.append(classNameId);
1037    
1038                            msg.append(", classPK=");
1039                            msg.append(classPK);
1040    
1041                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1042    
1043                            if (_log.isWarnEnabled()) {
1044                                    _log.warn(msg.toString());
1045                            }
1046    
1047                            throw new NoSuchEntryException(msg.toString());
1048                    }
1049    
1050                    return assetEntry;
1051            }
1052    
1053            /**
1054             * Finds the asset entry where classNameId = &#63; and classPK = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
1055             *
1056             * @param classNameId the class name id to search with
1057             * @param classPK the class p k to search with
1058             * @return the matching asset entry, or <code>null</code> if a matching asset entry could not be found
1059             * @throws SystemException if a system exception occurred
1060             */
1061            public AssetEntry fetchByC_C(long classNameId, long classPK)
1062                    throws SystemException {
1063                    return fetchByC_C(classNameId, classPK, true);
1064            }
1065    
1066            /**
1067             * Finds the asset entry where classNameId = &#63; and classPK = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
1068             *
1069             * @param classNameId the class name id to search with
1070             * @param classPK the class p k to search with
1071             * @return the matching asset entry, or <code>null</code> if a matching asset entry could not be found
1072             * @throws SystemException if a system exception occurred
1073             */
1074            public AssetEntry fetchByC_C(long classNameId, long classPK,
1075                    boolean retrieveFromCache) throws SystemException {
1076                    Object[] finderArgs = new Object[] { classNameId, classPK };
1077    
1078                    Object result = null;
1079    
1080                    if (retrieveFromCache) {
1081                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_C,
1082                                            finderArgs, this);
1083                    }
1084    
1085                    if (result == null) {
1086                            Session session = null;
1087    
1088                            try {
1089                                    session = openSession();
1090    
1091                                    StringBundler query = new StringBundler(3);
1092    
1093                                    query.append(_SQL_SELECT_ASSETENTRY_WHERE);
1094    
1095                                    query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1096    
1097                                    query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
1098    
1099                                    String sql = query.toString();
1100    
1101                                    Query q = session.createQuery(sql);
1102    
1103                                    QueryPos qPos = QueryPos.getInstance(q);
1104    
1105                                    qPos.add(classNameId);
1106    
1107                                    qPos.add(classPK);
1108    
1109                                    List<AssetEntry> list = q.list();
1110    
1111                                    result = list;
1112    
1113                                    AssetEntry assetEntry = null;
1114    
1115                                    if (list.isEmpty()) {
1116                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
1117                                                    finderArgs, list);
1118                                    }
1119                                    else {
1120                                            assetEntry = list.get(0);
1121    
1122                                            cacheResult(assetEntry);
1123    
1124                                            if ((assetEntry.getClassNameId() != classNameId) ||
1125                                                            (assetEntry.getClassPK() != classPK)) {
1126                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
1127                                                            finderArgs, assetEntry);
1128                                            }
1129                                    }
1130    
1131                                    return assetEntry;
1132                            }
1133                            catch (Exception e) {
1134                                    throw processException(e);
1135                            }
1136                            finally {
1137                                    if (result == null) {
1138                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
1139                                                    finderArgs, new ArrayList<AssetEntry>());
1140                                    }
1141    
1142                                    closeSession(session);
1143                            }
1144                    }
1145                    else {
1146                            if (result instanceof List<?>) {
1147                                    return null;
1148                            }
1149                            else {
1150                                    return (AssetEntry)result;
1151                            }
1152                    }
1153            }
1154    
1155            /**
1156             * Finds all the asset entries.
1157             *
1158             * @return the asset entries
1159             * @throws SystemException if a system exception occurred
1160             */
1161            public List<AssetEntry> findAll() throws SystemException {
1162                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1163            }
1164    
1165            /**
1166             * Finds a range of all the asset entries.
1167             *
1168             * <p>
1169             * 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.
1170             * </p>
1171             *
1172             * @param start the lower bound of the range of asset entries to return
1173             * @param end the upper bound of the range of asset entries to return (not inclusive)
1174             * @return the range of asset entries
1175             * @throws SystemException if a system exception occurred
1176             */
1177            public List<AssetEntry> findAll(int start, int end)
1178                    throws SystemException {
1179                    return findAll(start, end, null);
1180            }
1181    
1182            /**
1183             * Finds an ordered range of all the asset entries.
1184             *
1185             * <p>
1186             * 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.
1187             * </p>
1188             *
1189             * @param start the lower bound of the range of asset entries to return
1190             * @param end the upper bound of the range of asset entries to return (not inclusive)
1191             * @param orderByComparator the comparator to order the results by
1192             * @return the ordered range of asset entries
1193             * @throws SystemException if a system exception occurred
1194             */
1195            public List<AssetEntry> findAll(int start, int end,
1196                    OrderByComparator orderByComparator) throws SystemException {
1197                    Object[] finderArgs = new Object[] {
1198                                    String.valueOf(start), String.valueOf(end),
1199                                    String.valueOf(orderByComparator)
1200                            };
1201    
1202                    List<AssetEntry> list = (List<AssetEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1203                                    finderArgs, this);
1204    
1205                    if (list == null) {
1206                            Session session = null;
1207    
1208                            try {
1209                                    session = openSession();
1210    
1211                                    StringBundler query = null;
1212                                    String sql = null;
1213    
1214                                    if (orderByComparator != null) {
1215                                            query = new StringBundler(2 +
1216                                                            (orderByComparator.getOrderByFields().length * 3));
1217    
1218                                            query.append(_SQL_SELECT_ASSETENTRY);
1219    
1220                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1221                                                    orderByComparator);
1222    
1223                                            sql = query.toString();
1224                                    }
1225                                    else {
1226                                            sql = _SQL_SELECT_ASSETENTRY;
1227                                    }
1228    
1229                                    Query q = session.createQuery(sql);
1230    
1231                                    if (orderByComparator == null) {
1232                                            list = (List<AssetEntry>)QueryUtil.list(q, getDialect(),
1233                                                            start, end, false);
1234    
1235                                            Collections.sort(list);
1236                                    }
1237                                    else {
1238                                            list = (List<AssetEntry>)QueryUtil.list(q, getDialect(),
1239                                                            start, end);
1240                                    }
1241                            }
1242                            catch (Exception e) {
1243                                    throw processException(e);
1244                            }
1245                            finally {
1246                                    if (list == null) {
1247                                            list = new ArrayList<AssetEntry>();
1248                                    }
1249    
1250                                    cacheResult(list);
1251    
1252                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1253    
1254                                    closeSession(session);
1255                            }
1256                    }
1257    
1258                    return list;
1259            }
1260    
1261            /**
1262             * Removes all the asset entries where companyId = &#63; from the database.
1263             *
1264             * @param companyId the company id to search with
1265             * @throws SystemException if a system exception occurred
1266             */
1267            public void removeByCompanyId(long companyId) throws SystemException {
1268                    for (AssetEntry assetEntry : findByCompanyId(companyId)) {
1269                            remove(assetEntry);
1270                    }
1271            }
1272    
1273            /**
1274             * Removes the asset entry where groupId = &#63; and classUuid = &#63; from the database.
1275             *
1276             * @param groupId the group id to search with
1277             * @param classUuid the class uuid to search with
1278             * @throws SystemException if a system exception occurred
1279             */
1280            public void removeByG_CU(long groupId, String classUuid)
1281                    throws NoSuchEntryException, SystemException {
1282                    AssetEntry assetEntry = findByG_CU(groupId, classUuid);
1283    
1284                    remove(assetEntry);
1285            }
1286    
1287            /**
1288             * Removes the asset entry where classNameId = &#63; and classPK = &#63; from the database.
1289             *
1290             * @param classNameId the class name id to search with
1291             * @param classPK the class p k to search with
1292             * @throws SystemException if a system exception occurred
1293             */
1294            public void removeByC_C(long classNameId, long classPK)
1295                    throws NoSuchEntryException, SystemException {
1296                    AssetEntry assetEntry = findByC_C(classNameId, classPK);
1297    
1298                    remove(assetEntry);
1299            }
1300    
1301            /**
1302             * Removes all the asset entries from the database.
1303             *
1304             * @throws SystemException if a system exception occurred
1305             */
1306            public void removeAll() throws SystemException {
1307                    for (AssetEntry assetEntry : findAll()) {
1308                            remove(assetEntry);
1309                    }
1310            }
1311    
1312            /**
1313             * Counts all the asset entries where companyId = &#63;.
1314             *
1315             * @param companyId the company id to search with
1316             * @return the number of matching asset entries
1317             * @throws SystemException if a system exception occurred
1318             */
1319            public int countByCompanyId(long companyId) throws SystemException {
1320                    Object[] finderArgs = new Object[] { companyId };
1321    
1322                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
1323                                    finderArgs, this);
1324    
1325                    if (count == null) {
1326                            Session session = null;
1327    
1328                            try {
1329                                    session = openSession();
1330    
1331                                    StringBundler query = new StringBundler(2);
1332    
1333                                    query.append(_SQL_COUNT_ASSETENTRY_WHERE);
1334    
1335                                    query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1336    
1337                                    String sql = query.toString();
1338    
1339                                    Query q = session.createQuery(sql);
1340    
1341                                    QueryPos qPos = QueryPos.getInstance(q);
1342    
1343                                    qPos.add(companyId);
1344    
1345                                    count = (Long)q.uniqueResult();
1346                            }
1347                            catch (Exception e) {
1348                                    throw processException(e);
1349                            }
1350                            finally {
1351                                    if (count == null) {
1352                                            count = Long.valueOf(0);
1353                                    }
1354    
1355                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
1356                                            finderArgs, count);
1357    
1358                                    closeSession(session);
1359                            }
1360                    }
1361    
1362                    return count.intValue();
1363            }
1364    
1365            /**
1366             * Counts all the asset entries where groupId = &#63; and classUuid = &#63;.
1367             *
1368             * @param groupId the group id to search with
1369             * @param classUuid the class uuid to search with
1370             * @return the number of matching asset entries
1371             * @throws SystemException if a system exception occurred
1372             */
1373            public int countByG_CU(long groupId, String classUuid)
1374                    throws SystemException {
1375                    Object[] finderArgs = new Object[] { groupId, classUuid };
1376    
1377                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_CU,
1378                                    finderArgs, this);
1379    
1380                    if (count == null) {
1381                            Session session = null;
1382    
1383                            try {
1384                                    session = openSession();
1385    
1386                                    StringBundler query = new StringBundler(3);
1387    
1388                                    query.append(_SQL_COUNT_ASSETENTRY_WHERE);
1389    
1390                                    query.append(_FINDER_COLUMN_G_CU_GROUPID_2);
1391    
1392                                    if (classUuid == null) {
1393                                            query.append(_FINDER_COLUMN_G_CU_CLASSUUID_1);
1394                                    }
1395                                    else {
1396                                            if (classUuid.equals(StringPool.BLANK)) {
1397                                                    query.append(_FINDER_COLUMN_G_CU_CLASSUUID_3);
1398                                            }
1399                                            else {
1400                                                    query.append(_FINDER_COLUMN_G_CU_CLASSUUID_2);
1401                                            }
1402                                    }
1403    
1404                                    String sql = query.toString();
1405    
1406                                    Query q = session.createQuery(sql);
1407    
1408                                    QueryPos qPos = QueryPos.getInstance(q);
1409    
1410                                    qPos.add(groupId);
1411    
1412                                    if (classUuid != null) {
1413                                            qPos.add(classUuid);
1414                                    }
1415    
1416                                    count = (Long)q.uniqueResult();
1417                            }
1418                            catch (Exception e) {
1419                                    throw processException(e);
1420                            }
1421                            finally {
1422                                    if (count == null) {
1423                                            count = Long.valueOf(0);
1424                                    }
1425    
1426                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_CU,
1427                                            finderArgs, count);
1428    
1429                                    closeSession(session);
1430                            }
1431                    }
1432    
1433                    return count.intValue();
1434            }
1435    
1436            /**
1437             * Counts all the asset entries where classNameId = &#63; and classPK = &#63;.
1438             *
1439             * @param classNameId the class name id to search with
1440             * @param classPK the class p k to search with
1441             * @return the number of matching asset entries
1442             * @throws SystemException if a system exception occurred
1443             */
1444            public int countByC_C(long classNameId, long classPK)
1445                    throws SystemException {
1446                    Object[] finderArgs = new Object[] { classNameId, classPK };
1447    
1448                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
1449                                    finderArgs, this);
1450    
1451                    if (count == null) {
1452                            Session session = null;
1453    
1454                            try {
1455                                    session = openSession();
1456    
1457                                    StringBundler query = new StringBundler(3);
1458    
1459                                    query.append(_SQL_COUNT_ASSETENTRY_WHERE);
1460    
1461                                    query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1462    
1463                                    query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
1464    
1465                                    String sql = query.toString();
1466    
1467                                    Query q = session.createQuery(sql);
1468    
1469                                    QueryPos qPos = QueryPos.getInstance(q);
1470    
1471                                    qPos.add(classNameId);
1472    
1473                                    qPos.add(classPK);
1474    
1475                                    count = (Long)q.uniqueResult();
1476                            }
1477                            catch (Exception e) {
1478                                    throw processException(e);
1479                            }
1480                            finally {
1481                                    if (count == null) {
1482                                            count = Long.valueOf(0);
1483                                    }
1484    
1485                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
1486                                            count);
1487    
1488                                    closeSession(session);
1489                            }
1490                    }
1491    
1492                    return count.intValue();
1493            }
1494    
1495            /**
1496             * Counts all the asset entries.
1497             *
1498             * @return the number of asset entries
1499             * @throws SystemException if a system exception occurred
1500             */
1501            public int countAll() throws SystemException {
1502                    Object[] finderArgs = new Object[0];
1503    
1504                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1505                                    finderArgs, this);
1506    
1507                    if (count == null) {
1508                            Session session = null;
1509    
1510                            try {
1511                                    session = openSession();
1512    
1513                                    Query q = session.createQuery(_SQL_COUNT_ASSETENTRY);
1514    
1515                                    count = (Long)q.uniqueResult();
1516                            }
1517                            catch (Exception e) {
1518                                    throw processException(e);
1519                            }
1520                            finally {
1521                                    if (count == null) {
1522                                            count = Long.valueOf(0);
1523                                    }
1524    
1525                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1526                                            count);
1527    
1528                                    closeSession(session);
1529                            }
1530                    }
1531    
1532                    return count.intValue();
1533            }
1534    
1535            /**
1536             * Gets all the asset categories associated with the asset entry.
1537             *
1538             * @param pk the primary key of the asset entry to get the associated asset categories for
1539             * @return the asset categories associated with the asset entry
1540             * @throws SystemException if a system exception occurred
1541             */
1542            public List<com.liferay.portlet.asset.model.AssetCategory> getAssetCategories(
1543                    long pk) throws SystemException {
1544                    return getAssetCategories(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
1545            }
1546    
1547            /**
1548             * Gets a range of all the asset categories associated with the asset entry.
1549             *
1550             * <p>
1551             * 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.
1552             * </p>
1553             *
1554             * @param pk the primary key of the asset entry to get the associated asset categories for
1555             * @param start the lower bound of the range of asset entries to return
1556             * @param end the upper bound of the range of asset entries to return (not inclusive)
1557             * @return the range of asset categories associated with the asset entry
1558             * @throws SystemException if a system exception occurred
1559             */
1560            public List<com.liferay.portlet.asset.model.AssetCategory> getAssetCategories(
1561                    long pk, int start, int end) throws SystemException {
1562                    return getAssetCategories(pk, start, end, null);
1563            }
1564    
1565            public static final FinderPath FINDER_PATH_GET_ASSETCATEGORIES = new FinderPath(com.liferay.portlet.asset.model.impl.AssetCategoryModelImpl.ENTITY_CACHE_ENABLED,
1566                            AssetEntryModelImpl.FINDER_CACHE_ENABLED_ASSETENTRIES_ASSETCATEGORIES,
1567                            AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETCATEGORIES_NAME,
1568                            "getAssetCategories",
1569                            new String[] {
1570                                    Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
1571                                    "com.liferay.portal.kernel.util.OrderByComparator"
1572                            });
1573    
1574            /**
1575             * Gets an ordered range of all the asset categories associated with the asset entry.
1576             *
1577             * <p>
1578             * 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.
1579             * </p>
1580             *
1581             * @param pk the primary key of the asset entry to get the associated asset categories for
1582             * @param start the lower bound of the range of asset entries to return
1583             * @param end the upper bound of the range of asset entries to return (not inclusive)
1584             * @param orderByComparator the comparator to order the results by
1585             * @return the ordered range of asset categories associated with the asset entry
1586             * @throws SystemException if a system exception occurred
1587             */
1588            public List<com.liferay.portlet.asset.model.AssetCategory> getAssetCategories(
1589                    long pk, int start, int end, OrderByComparator orderByComparator)
1590                    throws SystemException {
1591                    Object[] finderArgs = new Object[] {
1592                                    pk, String.valueOf(start), String.valueOf(end),
1593                                    String.valueOf(orderByComparator)
1594                            };
1595    
1596                    List<com.liferay.portlet.asset.model.AssetCategory> list = (List<com.liferay.portlet.asset.model.AssetCategory>)FinderCacheUtil.getResult(FINDER_PATH_GET_ASSETCATEGORIES,
1597                                    finderArgs, this);
1598    
1599                    if (list == null) {
1600                            Session session = null;
1601    
1602                            try {
1603                                    session = openSession();
1604    
1605                                    String sql = null;
1606    
1607                                    if (orderByComparator != null) {
1608                                            sql = _SQL_GETASSETCATEGORIES.concat(ORDER_BY_CLAUSE)
1609                                                                                                     .concat(orderByComparator.getOrderBy());
1610                                    }
1611                                    else {
1612                                            sql = _SQL_GETASSETCATEGORIES.concat(com.liferay.portlet.asset.model.impl.AssetCategoryModelImpl.ORDER_BY_SQL);
1613                                    }
1614    
1615                                    SQLQuery q = session.createSQLQuery(sql);
1616    
1617                                    q.addEntity("AssetCategory",
1618                                            com.liferay.portlet.asset.model.impl.AssetCategoryImpl.class);
1619    
1620                                    QueryPos qPos = QueryPos.getInstance(q);
1621    
1622                                    qPos.add(pk);
1623    
1624                                    list = (List<com.liferay.portlet.asset.model.AssetCategory>)QueryUtil.list(q,
1625                                                    getDialect(), start, end);
1626                            }
1627                            catch (Exception e) {
1628                                    throw processException(e);
1629                            }
1630                            finally {
1631                                    if (list == null) {
1632                                            list = new ArrayList<com.liferay.portlet.asset.model.AssetCategory>();
1633                                    }
1634    
1635                                    assetCategoryPersistence.cacheResult(list);
1636    
1637                                    FinderCacheUtil.putResult(FINDER_PATH_GET_ASSETCATEGORIES,
1638                                            finderArgs, list);
1639    
1640                                    closeSession(session);
1641                            }
1642                    }
1643    
1644                    return list;
1645            }
1646    
1647            public static final FinderPath FINDER_PATH_GET_ASSETCATEGORIES_SIZE = new FinderPath(com.liferay.portlet.asset.model.impl.AssetCategoryModelImpl.ENTITY_CACHE_ENABLED,
1648                            AssetEntryModelImpl.FINDER_CACHE_ENABLED_ASSETENTRIES_ASSETCATEGORIES,
1649                            AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETCATEGORIES_NAME,
1650                            "getAssetCategoriesSize", new String[] { Long.class.getName() });
1651    
1652            /**
1653             * Gets the number of asset categories associated with the asset entry.
1654             *
1655             * @param pk the primary key of the asset entry to get the number of associated asset categories for
1656             * @return the number of asset categories associated with the asset entry
1657             * @throws SystemException if a system exception occurred
1658             */
1659            public int getAssetCategoriesSize(long pk) throws SystemException {
1660                    Object[] finderArgs = new Object[] { pk };
1661    
1662                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_ASSETCATEGORIES_SIZE,
1663                                    finderArgs, this);
1664    
1665                    if (count == null) {
1666                            Session session = null;
1667    
1668                            try {
1669                                    session = openSession();
1670    
1671                                    SQLQuery q = session.createSQLQuery(_SQL_GETASSETCATEGORIESSIZE);
1672    
1673                                    q.addScalar(COUNT_COLUMN_NAME,
1674                                            com.liferay.portal.kernel.dao.orm.Type.LONG);
1675    
1676                                    QueryPos qPos = QueryPos.getInstance(q);
1677    
1678                                    qPos.add(pk);
1679    
1680                                    count = (Long)q.uniqueResult();
1681                            }
1682                            catch (Exception e) {
1683                                    throw processException(e);
1684                            }
1685                            finally {
1686                                    if (count == null) {
1687                                            count = Long.valueOf(0);
1688                                    }
1689    
1690                                    FinderCacheUtil.putResult(FINDER_PATH_GET_ASSETCATEGORIES_SIZE,
1691                                            finderArgs, count);
1692    
1693                                    closeSession(session);
1694                            }
1695                    }
1696    
1697                    return count.intValue();
1698            }
1699    
1700            public static final FinderPath FINDER_PATH_CONTAINS_ASSETCATEGORY = new FinderPath(com.liferay.portlet.asset.model.impl.AssetCategoryModelImpl.ENTITY_CACHE_ENABLED,
1701                            AssetEntryModelImpl.FINDER_CACHE_ENABLED_ASSETENTRIES_ASSETCATEGORIES,
1702                            AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETCATEGORIES_NAME,
1703                            "containsAssetCategory",
1704                            new String[] { Long.class.getName(), Long.class.getName() });
1705    
1706            /**
1707             * Determines whether the asset category is associated with the asset entry.
1708             *
1709             * @param pk the primary key of the asset entry
1710             * @param assetCategoryPK the primary key of the asset category
1711             * @return whether the asset category is associated with the asset entry
1712             * @throws SystemException if a system exception occurred
1713             */
1714            public boolean containsAssetCategory(long pk, long assetCategoryPK)
1715                    throws SystemException {
1716                    Object[] finderArgs = new Object[] { pk, assetCategoryPK };
1717    
1718                    Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_ASSETCATEGORY,
1719                                    finderArgs, this);
1720    
1721                    if (value == null) {
1722                            try {
1723                                    value = Boolean.valueOf(containsAssetCategory.contains(pk,
1724                                                            assetCategoryPK));
1725                            }
1726                            catch (Exception e) {
1727                                    throw processException(e);
1728                            }
1729                            finally {
1730                                    if (value == null) {
1731                                            value = Boolean.FALSE;
1732                                    }
1733    
1734                                    FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_ASSETCATEGORY,
1735                                            finderArgs, value);
1736                            }
1737                    }
1738    
1739                    return value.booleanValue();
1740            }
1741    
1742            /**
1743             * Determines whether the asset entry has any asset categories associated with it.
1744             *
1745             * @param pk the primary key of the asset entry to check for associations with asset categories
1746             * @return whether the asset entry has any asset categories associated with it
1747             * @throws SystemException if a system exception occurred
1748             */
1749            public boolean containsAssetCategories(long pk) throws SystemException {
1750                    if (getAssetCategoriesSize(pk) > 0) {
1751                            return true;
1752                    }
1753                    else {
1754                            return false;
1755                    }
1756            }
1757    
1758            /**
1759             * Adds an association between the asset entry and the asset category. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1760             *
1761             * @param pk the primary key of the asset entry
1762             * @param assetCategoryPK the primary key of the asset category
1763             * @throws SystemException if a system exception occurred
1764             */
1765            public void addAssetCategory(long pk, long assetCategoryPK)
1766                    throws SystemException {
1767                    try {
1768                            addAssetCategory.add(pk, assetCategoryPK);
1769                    }
1770                    catch (Exception e) {
1771                            throw processException(e);
1772                    }
1773                    finally {
1774                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETCATEGORIES_NAME);
1775                    }
1776            }
1777    
1778            /**
1779             * Adds an association between the asset entry and the asset category. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1780             *
1781             * @param pk the primary key of the asset entry
1782             * @param assetCategory the asset category
1783             * @throws SystemException if a system exception occurred
1784             */
1785            public void addAssetCategory(long pk,
1786                    com.liferay.portlet.asset.model.AssetCategory assetCategory)
1787                    throws SystemException {
1788                    try {
1789                            addAssetCategory.add(pk, assetCategory.getPrimaryKey());
1790                    }
1791                    catch (Exception e) {
1792                            throw processException(e);
1793                    }
1794                    finally {
1795                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETCATEGORIES_NAME);
1796                    }
1797            }
1798    
1799            /**
1800             * Adds an association between the asset entry and the asset categories. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1801             *
1802             * @param pk the primary key of the asset entry
1803             * @param assetCategoryPKs the primary keys of the asset categories
1804             * @throws SystemException if a system exception occurred
1805             */
1806            public void addAssetCategories(long pk, long[] assetCategoryPKs)
1807                    throws SystemException {
1808                    try {
1809                            for (long assetCategoryPK : assetCategoryPKs) {
1810                                    addAssetCategory.add(pk, assetCategoryPK);
1811                            }
1812                    }
1813                    catch (Exception e) {
1814                            throw processException(e);
1815                    }
1816                    finally {
1817                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETCATEGORIES_NAME);
1818                    }
1819            }
1820    
1821            /**
1822             * Adds an association between the asset entry and the asset categories. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1823             *
1824             * @param pk the primary key of the asset entry
1825             * @param assetCategories the asset categories
1826             * @throws SystemException if a system exception occurred
1827             */
1828            public void addAssetCategories(long pk,
1829                    List<com.liferay.portlet.asset.model.AssetCategory> assetCategories)
1830                    throws SystemException {
1831                    try {
1832                            for (com.liferay.portlet.asset.model.AssetCategory assetCategory : assetCategories) {
1833                                    addAssetCategory.add(pk, assetCategory.getPrimaryKey());
1834                            }
1835                    }
1836                    catch (Exception e) {
1837                            throw processException(e);
1838                    }
1839                    finally {
1840                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETCATEGORIES_NAME);
1841                    }
1842            }
1843    
1844            /**
1845             * Clears all associations between the asset entry and its asset categories. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1846             *
1847             * @param pk the primary key of the asset entry to clear the associated asset categories from
1848             * @throws SystemException if a system exception occurred
1849             */
1850            public void clearAssetCategories(long pk) throws SystemException {
1851                    try {
1852                            clearAssetCategories.clear(pk);
1853                    }
1854                    catch (Exception e) {
1855                            throw processException(e);
1856                    }
1857                    finally {
1858                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETCATEGORIES_NAME);
1859                    }
1860            }
1861    
1862            /**
1863             * Removes the association between the asset entry and the asset category. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1864             *
1865             * @param pk the primary key of the asset entry
1866             * @param assetCategoryPK the primary key of the asset category
1867             * @throws SystemException if a system exception occurred
1868             */
1869            public void removeAssetCategory(long pk, long assetCategoryPK)
1870                    throws SystemException {
1871                    try {
1872                            removeAssetCategory.remove(pk, assetCategoryPK);
1873                    }
1874                    catch (Exception e) {
1875                            throw processException(e);
1876                    }
1877                    finally {
1878                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETCATEGORIES_NAME);
1879                    }
1880            }
1881    
1882            /**
1883             * Removes the association between the asset entry and the asset category. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1884             *
1885             * @param pk the primary key of the asset entry
1886             * @param assetCategory the asset category
1887             * @throws SystemException if a system exception occurred
1888             */
1889            public void removeAssetCategory(long pk,
1890                    com.liferay.portlet.asset.model.AssetCategory assetCategory)
1891                    throws SystemException {
1892                    try {
1893                            removeAssetCategory.remove(pk, assetCategory.getPrimaryKey());
1894                    }
1895                    catch (Exception e) {
1896                            throw processException(e);
1897                    }
1898                    finally {
1899                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETCATEGORIES_NAME);
1900                    }
1901            }
1902    
1903            /**
1904             * Removes the association between the asset entry and the asset categories. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1905             *
1906             * @param pk the primary key of the asset entry
1907             * @param assetCategoryPKs the primary keys of the asset categories
1908             * @throws SystemException if a system exception occurred
1909             */
1910            public void removeAssetCategories(long pk, long[] assetCategoryPKs)
1911                    throws SystemException {
1912                    try {
1913                            for (long assetCategoryPK : assetCategoryPKs) {
1914                                    removeAssetCategory.remove(pk, assetCategoryPK);
1915                            }
1916                    }
1917                    catch (Exception e) {
1918                            throw processException(e);
1919                    }
1920                    finally {
1921                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETCATEGORIES_NAME);
1922                    }
1923            }
1924    
1925            /**
1926             * Removes the association between the asset entry and the asset categories. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1927             *
1928             * @param pk the primary key of the asset entry
1929             * @param assetCategories the asset categories
1930             * @throws SystemException if a system exception occurred
1931             */
1932            public void removeAssetCategories(long pk,
1933                    List<com.liferay.portlet.asset.model.AssetCategory> assetCategories)
1934                    throws SystemException {
1935                    try {
1936                            for (com.liferay.portlet.asset.model.AssetCategory assetCategory : assetCategories) {
1937                                    removeAssetCategory.remove(pk, assetCategory.getPrimaryKey());
1938                            }
1939                    }
1940                    catch (Exception e) {
1941                            throw processException(e);
1942                    }
1943                    finally {
1944                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETCATEGORIES_NAME);
1945                    }
1946            }
1947    
1948            /**
1949             * Sets the asset categories associated with the asset entry, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1950             *
1951             * @param pk the primary key of the asset entry to set the associations for
1952             * @param assetCategoryPKs the primary keys of the asset categories to be associated with the asset entry
1953             * @throws SystemException if a system exception occurred
1954             */
1955            public void setAssetCategories(long pk, long[] assetCategoryPKs)
1956                    throws SystemException {
1957                    try {
1958                            Set<Long> assetCategoryPKSet = SetUtil.fromArray(assetCategoryPKs);
1959    
1960                            List<com.liferay.portlet.asset.model.AssetCategory> assetCategories = getAssetCategories(pk);
1961    
1962                            for (com.liferay.portlet.asset.model.AssetCategory assetCategory : assetCategories) {
1963                                    if (!assetCategoryPKSet.remove(assetCategory.getPrimaryKey())) {
1964                                            removeAssetCategory.remove(pk, assetCategory.getPrimaryKey());
1965                                    }
1966                            }
1967    
1968                            for (Long assetCategoryPK : assetCategoryPKSet) {
1969                                    addAssetCategory.add(pk, assetCategoryPK);
1970                            }
1971                    }
1972                    catch (Exception e) {
1973                            throw processException(e);
1974                    }
1975                    finally {
1976                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETCATEGORIES_NAME);
1977                    }
1978            }
1979    
1980            /**
1981             * Sets the asset categories associated with the asset entry, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1982             *
1983             * @param pk the primary key of the asset entry to set the associations for
1984             * @param assetCategories the asset categories to be associated with the asset entry
1985             * @throws SystemException if a system exception occurred
1986             */
1987            public void setAssetCategories(long pk,
1988                    List<com.liferay.portlet.asset.model.AssetCategory> assetCategories)
1989                    throws SystemException {
1990                    try {
1991                            long[] assetCategoryPKs = new long[assetCategories.size()];
1992    
1993                            for (int i = 0; i < assetCategories.size(); i++) {
1994                                    com.liferay.portlet.asset.model.AssetCategory assetCategory = assetCategories.get(i);
1995    
1996                                    assetCategoryPKs[i] = assetCategory.getPrimaryKey();
1997                            }
1998    
1999                            setAssetCategories(pk, assetCategoryPKs);
2000                    }
2001                    catch (Exception e) {
2002                            throw processException(e);
2003                    }
2004                    finally {
2005                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETCATEGORIES_NAME);
2006                    }
2007            }
2008    
2009            /**
2010             * Gets all the asset tags associated with the asset entry.
2011             *
2012             * @param pk the primary key of the asset entry to get the associated asset tags for
2013             * @return the asset tags associated with the asset entry
2014             * @throws SystemException if a system exception occurred
2015             */
2016            public List<com.liferay.portlet.asset.model.AssetTag> getAssetTags(long pk)
2017                    throws SystemException {
2018                    return getAssetTags(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
2019            }
2020    
2021            /**
2022             * Gets a range of all the asset tags associated with the asset entry.
2023             *
2024             * <p>
2025             * 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.
2026             * </p>
2027             *
2028             * @param pk the primary key of the asset entry to get the associated asset tags for
2029             * @param start the lower bound of the range of asset entries to return
2030             * @param end the upper bound of the range of asset entries to return (not inclusive)
2031             * @return the range of asset tags associated with the asset entry
2032             * @throws SystemException if a system exception occurred
2033             */
2034            public List<com.liferay.portlet.asset.model.AssetTag> getAssetTags(
2035                    long pk, int start, int end) throws SystemException {
2036                    return getAssetTags(pk, start, end, null);
2037            }
2038    
2039            public static final FinderPath FINDER_PATH_GET_ASSETTAGS = new FinderPath(com.liferay.portlet.asset.model.impl.AssetTagModelImpl.ENTITY_CACHE_ENABLED,
2040                            AssetEntryModelImpl.FINDER_CACHE_ENABLED_ASSETENTRIES_ASSETTAGS,
2041                            AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME,
2042                            "getAssetTags",
2043                            new String[] {
2044                                    Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
2045                                    "com.liferay.portal.kernel.util.OrderByComparator"
2046                            });
2047    
2048            /**
2049             * Gets an ordered range of all the asset tags associated with the asset entry.
2050             *
2051             * <p>
2052             * 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.
2053             * </p>
2054             *
2055             * @param pk the primary key of the asset entry to get the associated asset tags for
2056             * @param start the lower bound of the range of asset entries to return
2057             * @param end the upper bound of the range of asset entries to return (not inclusive)
2058             * @param orderByComparator the comparator to order the results by
2059             * @return the ordered range of asset tags associated with the asset entry
2060             * @throws SystemException if a system exception occurred
2061             */
2062            public List<com.liferay.portlet.asset.model.AssetTag> getAssetTags(
2063                    long pk, int start, int end, OrderByComparator orderByComparator)
2064                    throws SystemException {
2065                    Object[] finderArgs = new Object[] {
2066                                    pk, String.valueOf(start), String.valueOf(end),
2067                                    String.valueOf(orderByComparator)
2068                            };
2069    
2070                    List<com.liferay.portlet.asset.model.AssetTag> list = (List<com.liferay.portlet.asset.model.AssetTag>)FinderCacheUtil.getResult(FINDER_PATH_GET_ASSETTAGS,
2071                                    finderArgs, this);
2072    
2073                    if (list == null) {
2074                            Session session = null;
2075    
2076                            try {
2077                                    session = openSession();
2078    
2079                                    String sql = null;
2080    
2081                                    if (orderByComparator != null) {
2082                                            sql = _SQL_GETASSETTAGS.concat(ORDER_BY_CLAUSE)
2083                                                                                       .concat(orderByComparator.getOrderBy());
2084                                    }
2085                                    else {
2086                                            sql = _SQL_GETASSETTAGS.concat(com.liferay.portlet.asset.model.impl.AssetTagModelImpl.ORDER_BY_SQL);
2087                                    }
2088    
2089                                    SQLQuery q = session.createSQLQuery(sql);
2090    
2091                                    q.addEntity("AssetTag",
2092                                            com.liferay.portlet.asset.model.impl.AssetTagImpl.class);
2093    
2094                                    QueryPos qPos = QueryPos.getInstance(q);
2095    
2096                                    qPos.add(pk);
2097    
2098                                    list = (List<com.liferay.portlet.asset.model.AssetTag>)QueryUtil.list(q,
2099                                                    getDialect(), start, end);
2100                            }
2101                            catch (Exception e) {
2102                                    throw processException(e);
2103                            }
2104                            finally {
2105                                    if (list == null) {
2106                                            list = new ArrayList<com.liferay.portlet.asset.model.AssetTag>();
2107                                    }
2108    
2109                                    assetTagPersistence.cacheResult(list);
2110    
2111                                    FinderCacheUtil.putResult(FINDER_PATH_GET_ASSETTAGS,
2112                                            finderArgs, list);
2113    
2114                                    closeSession(session);
2115                            }
2116                    }
2117    
2118                    return list;
2119            }
2120    
2121            public static final FinderPath FINDER_PATH_GET_ASSETTAGS_SIZE = new FinderPath(com.liferay.portlet.asset.model.impl.AssetTagModelImpl.ENTITY_CACHE_ENABLED,
2122                            AssetEntryModelImpl.FINDER_CACHE_ENABLED_ASSETENTRIES_ASSETTAGS,
2123                            AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME,
2124                            "getAssetTagsSize", new String[] { Long.class.getName() });
2125    
2126            /**
2127             * Gets the number of asset tags associated with the asset entry.
2128             *
2129             * @param pk the primary key of the asset entry to get the number of associated asset tags for
2130             * @return the number of asset tags associated with the asset entry
2131             * @throws SystemException if a system exception occurred
2132             */
2133            public int getAssetTagsSize(long pk) throws SystemException {
2134                    Object[] finderArgs = new Object[] { pk };
2135    
2136                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_ASSETTAGS_SIZE,
2137                                    finderArgs, this);
2138    
2139                    if (count == null) {
2140                            Session session = null;
2141    
2142                            try {
2143                                    session = openSession();
2144    
2145                                    SQLQuery q = session.createSQLQuery(_SQL_GETASSETTAGSSIZE);
2146    
2147                                    q.addScalar(COUNT_COLUMN_NAME,
2148                                            com.liferay.portal.kernel.dao.orm.Type.LONG);
2149    
2150                                    QueryPos qPos = QueryPos.getInstance(q);
2151    
2152                                    qPos.add(pk);
2153    
2154                                    count = (Long)q.uniqueResult();
2155                            }
2156                            catch (Exception e) {
2157                                    throw processException(e);
2158                            }
2159                            finally {
2160                                    if (count == null) {
2161                                            count = Long.valueOf(0);
2162                                    }
2163    
2164                                    FinderCacheUtil.putResult(FINDER_PATH_GET_ASSETTAGS_SIZE,
2165                                            finderArgs, count);
2166    
2167                                    closeSession(session);
2168                            }
2169                    }
2170    
2171                    return count.intValue();
2172            }
2173    
2174            public static final FinderPath FINDER_PATH_CONTAINS_ASSETTAG = new FinderPath(com.liferay.portlet.asset.model.impl.AssetTagModelImpl.ENTITY_CACHE_ENABLED,
2175                            AssetEntryModelImpl.FINDER_CACHE_ENABLED_ASSETENTRIES_ASSETTAGS,
2176                            AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME,
2177                            "containsAssetTag",
2178                            new String[] { Long.class.getName(), Long.class.getName() });
2179    
2180            /**
2181             * Determines whether the asset tag is associated with the asset entry.
2182             *
2183             * @param pk the primary key of the asset entry
2184             * @param assetTagPK the primary key of the asset tag
2185             * @return whether the asset tag is associated with the asset entry
2186             * @throws SystemException if a system exception occurred
2187             */
2188            public boolean containsAssetTag(long pk, long assetTagPK)
2189                    throws SystemException {
2190                    Object[] finderArgs = new Object[] { pk, assetTagPK };
2191    
2192                    Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_ASSETTAG,
2193                                    finderArgs, this);
2194    
2195                    if (value == null) {
2196                            try {
2197                                    value = Boolean.valueOf(containsAssetTag.contains(pk, assetTagPK));
2198                            }
2199                            catch (Exception e) {
2200                                    throw processException(e);
2201                            }
2202                            finally {
2203                                    if (value == null) {
2204                                            value = Boolean.FALSE;
2205                                    }
2206    
2207                                    FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_ASSETTAG,
2208                                            finderArgs, value);
2209                            }
2210                    }
2211    
2212                    return value.booleanValue();
2213            }
2214    
2215            /**
2216             * Determines whether the asset entry has any asset tags associated with it.
2217             *
2218             * @param pk the primary key of the asset entry to check for associations with asset tags
2219             * @return whether the asset entry has any asset tags associated with it
2220             * @throws SystemException if a system exception occurred
2221             */
2222            public boolean containsAssetTags(long pk) throws SystemException {
2223                    if (getAssetTagsSize(pk) > 0) {
2224                            return true;
2225                    }
2226                    else {
2227                            return false;
2228                    }
2229            }
2230    
2231            /**
2232             * Adds an association between the asset entry and the asset tag. Also notifies the appropriate model listeners and clears the mapping table finder cache.
2233             *
2234             * @param pk the primary key of the asset entry
2235             * @param assetTagPK the primary key of the asset tag
2236             * @throws SystemException if a system exception occurred
2237             */
2238            public void addAssetTag(long pk, long assetTagPK) throws SystemException {
2239                    try {
2240                            addAssetTag.add(pk, assetTagPK);
2241                    }
2242                    catch (Exception e) {
2243                            throw processException(e);
2244                    }
2245                    finally {
2246                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
2247                    }
2248            }
2249    
2250            /**
2251             * Adds an association between the asset entry and the asset tag. Also notifies the appropriate model listeners and clears the mapping table finder cache.
2252             *
2253             * @param pk the primary key of the asset entry
2254             * @param assetTag the asset tag
2255             * @throws SystemException if a system exception occurred
2256             */
2257            public void addAssetTag(long pk,
2258                    com.liferay.portlet.asset.model.AssetTag assetTag)
2259                    throws SystemException {
2260                    try {
2261                            addAssetTag.add(pk, assetTag.getPrimaryKey());
2262                    }
2263                    catch (Exception e) {
2264                            throw processException(e);
2265                    }
2266                    finally {
2267                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
2268                    }
2269            }
2270    
2271            /**
2272             * Adds an association between the asset entry and the asset tags. Also notifies the appropriate model listeners and clears the mapping table finder cache.
2273             *
2274             * @param pk the primary key of the asset entry
2275             * @param assetTagPKs the primary keys of the asset tags
2276             * @throws SystemException if a system exception occurred
2277             */
2278            public void addAssetTags(long pk, long[] assetTagPKs)
2279                    throws SystemException {
2280                    try {
2281                            for (long assetTagPK : assetTagPKs) {
2282                                    addAssetTag.add(pk, assetTagPK);
2283                            }
2284                    }
2285                    catch (Exception e) {
2286                            throw processException(e);
2287                    }
2288                    finally {
2289                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
2290                    }
2291            }
2292    
2293            /**
2294             * Adds an association between the asset entry and the asset tags. Also notifies the appropriate model listeners and clears the mapping table finder cache.
2295             *
2296             * @param pk the primary key of the asset entry
2297             * @param assetTags the asset tags
2298             * @throws SystemException if a system exception occurred
2299             */
2300            public void addAssetTags(long pk,
2301                    List<com.liferay.portlet.asset.model.AssetTag> assetTags)
2302                    throws SystemException {
2303                    try {
2304                            for (com.liferay.portlet.asset.model.AssetTag assetTag : assetTags) {
2305                                    addAssetTag.add(pk, assetTag.getPrimaryKey());
2306                            }
2307                    }
2308                    catch (Exception e) {
2309                            throw processException(e);
2310                    }
2311                    finally {
2312                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
2313                    }
2314            }
2315    
2316            /**
2317             * Clears all associations between the asset entry and its asset tags. Also notifies the appropriate model listeners and clears the mapping table finder cache.
2318             *
2319             * @param pk the primary key of the asset entry to clear the associated asset tags from
2320             * @throws SystemException if a system exception occurred
2321             */
2322            public void clearAssetTags(long pk) throws SystemException {
2323                    try {
2324                            clearAssetTags.clear(pk);
2325                    }
2326                    catch (Exception e) {
2327                            throw processException(e);
2328                    }
2329                    finally {
2330                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
2331                    }
2332            }
2333    
2334            /**
2335             * Removes the association between the asset entry and the asset tag. Also notifies the appropriate model listeners and clears the mapping table finder cache.
2336             *
2337             * @param pk the primary key of the asset entry
2338             * @param assetTagPK the primary key of the asset tag
2339             * @throws SystemException if a system exception occurred
2340             */
2341            public void removeAssetTag(long pk, long assetTagPK)
2342                    throws SystemException {
2343                    try {
2344                            removeAssetTag.remove(pk, assetTagPK);
2345                    }
2346                    catch (Exception e) {
2347                            throw processException(e);
2348                    }
2349                    finally {
2350                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
2351                    }
2352            }
2353    
2354            /**
2355             * Removes the association between the asset entry and the asset tag. Also notifies the appropriate model listeners and clears the mapping table finder cache.
2356             *
2357             * @param pk the primary key of the asset entry
2358             * @param assetTag the asset tag
2359             * @throws SystemException if a system exception occurred
2360             */
2361            public void removeAssetTag(long pk,
2362                    com.liferay.portlet.asset.model.AssetTag assetTag)
2363                    throws SystemException {
2364                    try {
2365                            removeAssetTag.remove(pk, assetTag.getPrimaryKey());
2366                    }
2367                    catch (Exception e) {
2368                            throw processException(e);
2369                    }
2370                    finally {
2371                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
2372                    }
2373            }
2374    
2375            /**
2376             * Removes the association between the asset entry and the asset tags. Also notifies the appropriate model listeners and clears the mapping table finder cache.
2377             *
2378             * @param pk the primary key of the asset entry
2379             * @param assetTagPKs the primary keys of the asset tags
2380             * @throws SystemException if a system exception occurred
2381             */
2382            public void removeAssetTags(long pk, long[] assetTagPKs)
2383                    throws SystemException {
2384                    try {
2385                            for (long assetTagPK : assetTagPKs) {
2386                                    removeAssetTag.remove(pk, assetTagPK);
2387                            }
2388                    }
2389                    catch (Exception e) {
2390                            throw processException(e);
2391                    }
2392                    finally {
2393                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
2394                    }
2395            }
2396    
2397            /**
2398             * Removes the association between the asset entry and the asset tags. Also notifies the appropriate model listeners and clears the mapping table finder cache.
2399             *
2400             * @param pk the primary key of the asset entry
2401             * @param assetTags the asset tags
2402             * @throws SystemException if a system exception occurred
2403             */
2404            public void removeAssetTags(long pk,
2405                    List<com.liferay.portlet.asset.model.AssetTag> assetTags)
2406                    throws SystemException {
2407                    try {
2408                            for (com.liferay.portlet.asset.model.AssetTag assetTag : assetTags) {
2409                                    removeAssetTag.remove(pk, assetTag.getPrimaryKey());
2410                            }
2411                    }
2412                    catch (Exception e) {
2413                            throw processException(e);
2414                    }
2415                    finally {
2416                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
2417                    }
2418            }
2419    
2420            /**
2421             * Sets the asset tags associated with the asset entry, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
2422             *
2423             * @param pk the primary key of the asset entry to set the associations for
2424             * @param assetTagPKs the primary keys of the asset tags to be associated with the asset entry
2425             * @throws SystemException if a system exception occurred
2426             */
2427            public void setAssetTags(long pk, long[] assetTagPKs)
2428                    throws SystemException {
2429                    try {
2430                            Set<Long> assetTagPKSet = SetUtil.fromArray(assetTagPKs);
2431    
2432                            List<com.liferay.portlet.asset.model.AssetTag> assetTags = getAssetTags(pk);
2433    
2434                            for (com.liferay.portlet.asset.model.AssetTag assetTag : assetTags) {
2435                                    if (!assetTagPKSet.remove(assetTag.getPrimaryKey())) {
2436                                            removeAssetTag.remove(pk, assetTag.getPrimaryKey());
2437                                    }
2438                            }
2439    
2440                            for (Long assetTagPK : assetTagPKSet) {
2441                                    addAssetTag.add(pk, assetTagPK);
2442                            }
2443                    }
2444                    catch (Exception e) {
2445                            throw processException(e);
2446                    }
2447                    finally {
2448                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
2449                    }
2450            }
2451    
2452            /**
2453             * Sets the asset tags associated with the asset entry, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
2454             *
2455             * @param pk the primary key of the asset entry to set the associations for
2456             * @param assetTags the asset tags to be associated with the asset entry
2457             * @throws SystemException if a system exception occurred
2458             */
2459            public void setAssetTags(long pk,
2460                    List<com.liferay.portlet.asset.model.AssetTag> assetTags)
2461                    throws SystemException {
2462                    try {
2463                            long[] assetTagPKs = new long[assetTags.size()];
2464    
2465                            for (int i = 0; i < assetTags.size(); i++) {
2466                                    com.liferay.portlet.asset.model.AssetTag assetTag = assetTags.get(i);
2467    
2468                                    assetTagPKs[i] = assetTag.getPrimaryKey();
2469                            }
2470    
2471                            setAssetTags(pk, assetTagPKs);
2472                    }
2473                    catch (Exception e) {
2474                            throw processException(e);
2475                    }
2476                    finally {
2477                            FinderCacheUtil.clearCache(AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
2478                    }
2479            }
2480    
2481            /**
2482             * Initializes the asset entry persistence.
2483             */
2484            public void afterPropertiesSet() {
2485                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2486                                            com.liferay.portal.util.PropsUtil.get(
2487                                                    "value.object.listener.com.liferay.portlet.asset.model.AssetEntry")));
2488    
2489                    if (listenerClassNames.length > 0) {
2490                            try {
2491                                    List<ModelListener<AssetEntry>> listenersList = new ArrayList<ModelListener<AssetEntry>>();
2492    
2493                                    for (String listenerClassName : listenerClassNames) {
2494                                            listenersList.add((ModelListener<AssetEntry>)InstanceFactory.newInstance(
2495                                                            listenerClassName));
2496                                    }
2497    
2498                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2499                            }
2500                            catch (Exception e) {
2501                                    _log.error(e);
2502                            }
2503                    }
2504    
2505                    containsAssetCategory = new ContainsAssetCategory(this);
2506    
2507                    addAssetCategory = new AddAssetCategory(this);
2508                    clearAssetCategories = new ClearAssetCategories(this);
2509                    removeAssetCategory = new RemoveAssetCategory(this);
2510    
2511                    containsAssetTag = new ContainsAssetTag(this);
2512    
2513                    addAssetTag = new AddAssetTag(this);
2514                    clearAssetTags = new ClearAssetTags(this);
2515                    removeAssetTag = new RemoveAssetTag(this);
2516            }
2517    
2518            public void destroy() {
2519                    EntityCacheUtil.removeCache(AssetEntryImpl.class.getName());
2520                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2521                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
2522            }
2523    
2524            @BeanReference(type = AssetCategoryPersistence.class)
2525            protected AssetCategoryPersistence assetCategoryPersistence;
2526            @BeanReference(type = AssetCategoryPropertyPersistence.class)
2527            protected AssetCategoryPropertyPersistence assetCategoryPropertyPersistence;
2528            @BeanReference(type = AssetEntryPersistence.class)
2529            protected AssetEntryPersistence assetEntryPersistence;
2530            @BeanReference(type = AssetLinkPersistence.class)
2531            protected AssetLinkPersistence assetLinkPersistence;
2532            @BeanReference(type = AssetTagPersistence.class)
2533            protected AssetTagPersistence assetTagPersistence;
2534            @BeanReference(type = AssetTagPropertyPersistence.class)
2535            protected AssetTagPropertyPersistence assetTagPropertyPersistence;
2536            @BeanReference(type = AssetTagStatsPersistence.class)
2537            protected AssetTagStatsPersistence assetTagStatsPersistence;
2538            @BeanReference(type = AssetVocabularyPersistence.class)
2539            protected AssetVocabularyPersistence assetVocabularyPersistence;
2540            @BeanReference(type = CompanyPersistence.class)
2541            protected CompanyPersistence companyPersistence;
2542            @BeanReference(type = GroupPersistence.class)
2543            protected GroupPersistence groupPersistence;
2544            @BeanReference(type = ResourcePersistence.class)
2545            protected ResourcePersistence resourcePersistence;
2546            @BeanReference(type = UserPersistence.class)
2547            protected UserPersistence userPersistence;
2548            @BeanReference(type = BlogsEntryPersistence.class)
2549            protected BlogsEntryPersistence blogsEntryPersistence;
2550            @BeanReference(type = BookmarksEntryPersistence.class)
2551            protected BookmarksEntryPersistence bookmarksEntryPersistence;
2552            @BeanReference(type = DLFileEntryPersistence.class)
2553            protected DLFileEntryPersistence dlFileEntryPersistence;
2554            @BeanReference(type = DLFolderPersistence.class)
2555            protected DLFolderPersistence dlFolderPersistence;
2556            @BeanReference(type = JournalArticlePersistence.class)
2557            protected JournalArticlePersistence journalArticlePersistence;
2558            @BeanReference(type = JournalArticleResourcePersistence.class)
2559            protected JournalArticleResourcePersistence journalArticleResourcePersistence;
2560            @BeanReference(type = MBMessagePersistence.class)
2561            protected MBMessagePersistence mbMessagePersistence;
2562            @BeanReference(type = SocialEquityLogPersistence.class)
2563            protected SocialEquityLogPersistence socialEquityLogPersistence;
2564            @BeanReference(type = WikiPagePersistence.class)
2565            protected WikiPagePersistence wikiPagePersistence;
2566            @BeanReference(type = WikiPageResourcePersistence.class)
2567            protected WikiPageResourcePersistence wikiPageResourcePersistence;
2568            protected ContainsAssetCategory containsAssetCategory;
2569            protected AddAssetCategory addAssetCategory;
2570            protected ClearAssetCategories clearAssetCategories;
2571            protected RemoveAssetCategory removeAssetCategory;
2572            protected ContainsAssetTag containsAssetTag;
2573            protected AddAssetTag addAssetTag;
2574            protected ClearAssetTags clearAssetTags;
2575            protected RemoveAssetTag removeAssetTag;
2576    
2577            protected class ContainsAssetCategory {
2578                    protected ContainsAssetCategory(
2579                            AssetEntryPersistenceImpl persistenceImpl) {
2580                            super();
2581    
2582                            _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
2583                                            _SQL_CONTAINSASSETCATEGORY,
2584                                            new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
2585                                            RowMapper.COUNT);
2586                    }
2587    
2588                    protected boolean contains(long entryId, long categoryId) {
2589                            List<Integer> results = _mappingSqlQuery.execute(new Object[] {
2590                                                    new Long(entryId), new Long(categoryId)
2591                                            });
2592    
2593                            if (results.size() > 0) {
2594                                    Integer count = results.get(0);
2595    
2596                                    if (count.intValue() > 0) {
2597                                            return true;
2598                                    }
2599                            }
2600    
2601                            return false;
2602                    }
2603    
2604                    private MappingSqlQuery<Integer> _mappingSqlQuery;
2605            }
2606    
2607            protected class AddAssetCategory {
2608                    protected AddAssetCategory(AssetEntryPersistenceImpl persistenceImpl) {
2609                            _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2610                                            "INSERT INTO AssetEntries_AssetCategories (entryId, categoryId) VALUES (?, ?)",
2611                                            new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
2612                            _persistenceImpl = persistenceImpl;
2613                    }
2614    
2615                    protected void add(long entryId, long categoryId)
2616                            throws SystemException {
2617                            if (!_persistenceImpl.containsAssetCategory.contains(entryId,
2618                                                    categoryId)) {
2619                                    ModelListener<com.liferay.portlet.asset.model.AssetCategory>[] assetCategoryListeners =
2620                                            assetCategoryPersistence.getListeners();
2621    
2622                                    for (ModelListener<AssetEntry> listener : listeners) {
2623                                            listener.onBeforeAddAssociation(entryId,
2624                                                    com.liferay.portlet.asset.model.AssetCategory.class.getName(),
2625                                                    categoryId);
2626                                    }
2627    
2628                                    for (ModelListener<com.liferay.portlet.asset.model.AssetCategory> listener : assetCategoryListeners) {
2629                                            listener.onBeforeAddAssociation(categoryId,
2630                                                    AssetEntry.class.getName(), entryId);
2631                                    }
2632    
2633                                    _sqlUpdate.update(new Object[] {
2634                                                    new Long(entryId), new Long(categoryId)
2635                                            });
2636    
2637                                    for (ModelListener<AssetEntry> listener : listeners) {
2638                                            listener.onAfterAddAssociation(entryId,
2639                                                    com.liferay.portlet.asset.model.AssetCategory.class.getName(),
2640                                                    categoryId);
2641                                    }
2642    
2643                                    for (ModelListener<com.liferay.portlet.asset.model.AssetCategory> listener : assetCategoryListeners) {
2644                                            listener.onAfterAddAssociation(categoryId,
2645                                                    AssetEntry.class.getName(), entryId);
2646                                    }
2647                            }
2648                    }
2649    
2650                    private SqlUpdate _sqlUpdate;
2651                    private AssetEntryPersistenceImpl _persistenceImpl;
2652            }
2653    
2654            protected class ClearAssetCategories {
2655                    protected ClearAssetCategories(
2656                            AssetEntryPersistenceImpl persistenceImpl) {
2657                            _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2658                                            "DELETE FROM AssetEntries_AssetCategories WHERE entryId = ?",
2659                                            new int[] { java.sql.Types.BIGINT });
2660                    }
2661    
2662                    protected void clear(long entryId) throws SystemException {
2663                            ModelListener<com.liferay.portlet.asset.model.AssetCategory>[] assetCategoryListeners =
2664                                    assetCategoryPersistence.getListeners();
2665    
2666                            List<com.liferay.portlet.asset.model.AssetCategory> assetCategories = null;
2667    
2668                            if ((listeners.length > 0) || (assetCategoryListeners.length > 0)) {
2669                                    assetCategories = getAssetCategories(entryId);
2670    
2671                                    for (com.liferay.portlet.asset.model.AssetCategory assetCategory : assetCategories) {
2672                                            for (ModelListener<AssetEntry> listener : listeners) {
2673                                                    listener.onBeforeRemoveAssociation(entryId,
2674                                                            com.liferay.portlet.asset.model.AssetCategory.class.getName(),
2675                                                            assetCategory.getPrimaryKey());
2676                                            }
2677    
2678                                            for (ModelListener<com.liferay.portlet.asset.model.AssetCategory> listener : assetCategoryListeners) {
2679                                                    listener.onBeforeRemoveAssociation(assetCategory.getPrimaryKey(),
2680                                                            AssetEntry.class.getName(), entryId);
2681                                            }
2682                                    }
2683                            }
2684    
2685                            _sqlUpdate.update(new Object[] { new Long(entryId) });
2686    
2687                            if ((listeners.length > 0) || (assetCategoryListeners.length > 0)) {
2688                                    for (com.liferay.portlet.asset.model.AssetCategory assetCategory : assetCategories) {
2689                                            for (ModelListener<AssetEntry> listener : listeners) {
2690                                                    listener.onAfterRemoveAssociation(entryId,
2691                                                            com.liferay.portlet.asset.model.AssetCategory.class.getName(),
2692                                                            assetCategory.getPrimaryKey());
2693                                            }
2694    
2695                                            for (ModelListener<com.liferay.portlet.asset.model.AssetCategory> listener : assetCategoryListeners) {
2696                                                    listener.onAfterRemoveAssociation(assetCategory.getPrimaryKey(),
2697                                                            AssetEntry.class.getName(), entryId);
2698                                            }
2699                                    }
2700                            }
2701                    }
2702    
2703                    private SqlUpdate _sqlUpdate;
2704            }
2705    
2706            protected class RemoveAssetCategory {
2707                    protected RemoveAssetCategory(AssetEntryPersistenceImpl persistenceImpl) {
2708                            _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2709                                            "DELETE FROM AssetEntries_AssetCategories WHERE entryId = ? AND categoryId = ?",
2710                                            new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
2711                            _persistenceImpl = persistenceImpl;
2712                    }
2713    
2714                    protected void remove(long entryId, long categoryId)
2715                            throws SystemException {
2716                            if (_persistenceImpl.containsAssetCategory.contains(entryId,
2717                                                    categoryId)) {
2718                                    ModelListener<com.liferay.portlet.asset.model.AssetCategory>[] assetCategoryListeners =
2719                                            assetCategoryPersistence.getListeners();
2720    
2721                                    for (ModelListener<AssetEntry> listener : listeners) {
2722                                            listener.onBeforeRemoveAssociation(entryId,
2723                                                    com.liferay.portlet.asset.model.AssetCategory.class.getName(),
2724                                                    categoryId);
2725                                    }
2726    
2727                                    for (ModelListener<com.liferay.portlet.asset.model.AssetCategory> listener : assetCategoryListeners) {
2728                                            listener.onBeforeRemoveAssociation(categoryId,
2729                                                    AssetEntry.class.getName(), entryId);
2730                                    }
2731    
2732                                    _sqlUpdate.update(new Object[] {
2733                                                    new Long(entryId), new Long(categoryId)
2734                                            });
2735    
2736                                    for (ModelListener<AssetEntry> listener : listeners) {
2737                                            listener.onAfterRemoveAssociation(entryId,
2738                                                    com.liferay.portlet.asset.model.AssetCategory.class.getName(),
2739                                                    categoryId);
2740                                    }
2741    
2742                                    for (ModelListener<com.liferay.portlet.asset.model.AssetCategory> listener : assetCategoryListeners) {
2743                                            listener.onAfterRemoveAssociation(categoryId,
2744                                                    AssetEntry.class.getName(), entryId);
2745                                    }
2746                            }
2747                    }
2748    
2749                    private SqlUpdate _sqlUpdate;
2750                    private AssetEntryPersistenceImpl _persistenceImpl;
2751            }
2752    
2753            protected class ContainsAssetTag {
2754                    protected ContainsAssetTag(AssetEntryPersistenceImpl persistenceImpl) {
2755                            super();
2756    
2757                            _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
2758                                            _SQL_CONTAINSASSETTAG,
2759                                            new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
2760                                            RowMapper.COUNT);
2761                    }
2762    
2763                    protected boolean contains(long entryId, long tagId) {
2764                            List<Integer> results = _mappingSqlQuery.execute(new Object[] {
2765                                                    new Long(entryId), new Long(tagId)
2766                                            });
2767    
2768                            if (results.size() > 0) {
2769                                    Integer count = results.get(0);
2770    
2771                                    if (count.intValue() > 0) {
2772                                            return true;
2773                                    }
2774                            }
2775    
2776                            return false;
2777                    }
2778    
2779                    private MappingSqlQuery<Integer> _mappingSqlQuery;
2780            }
2781    
2782            protected class AddAssetTag {
2783                    protected AddAssetTag(AssetEntryPersistenceImpl persistenceImpl) {
2784                            _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2785                                            "INSERT INTO AssetEntries_AssetTags (entryId, tagId) VALUES (?, ?)",
2786                                            new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
2787                            _persistenceImpl = persistenceImpl;
2788                    }
2789    
2790                    protected void add(long entryId, long tagId) throws SystemException {
2791                            if (!_persistenceImpl.containsAssetTag.contains(entryId, tagId)) {
2792                                    ModelListener<com.liferay.portlet.asset.model.AssetTag>[] assetTagListeners =
2793                                            assetTagPersistence.getListeners();
2794    
2795                                    for (ModelListener<AssetEntry> listener : listeners) {
2796                                            listener.onBeforeAddAssociation(entryId,
2797                                                    com.liferay.portlet.asset.model.AssetTag.class.getName(),
2798                                                    tagId);
2799                                    }
2800    
2801                                    for (ModelListener<com.liferay.portlet.asset.model.AssetTag> listener : assetTagListeners) {
2802                                            listener.onBeforeAddAssociation(tagId,
2803                                                    AssetEntry.class.getName(), entryId);
2804                                    }
2805    
2806                                    _sqlUpdate.update(new Object[] {
2807                                                    new Long(entryId), new Long(tagId)
2808                                            });
2809    
2810                                    for (ModelListener<AssetEntry> listener : listeners) {
2811                                            listener.onAfterAddAssociation(entryId,
2812                                                    com.liferay.portlet.asset.model.AssetTag.class.getName(),
2813                                                    tagId);
2814                                    }
2815    
2816                                    for (ModelListener<com.liferay.portlet.asset.model.AssetTag> listener : assetTagListeners) {
2817                                            listener.onAfterAddAssociation(tagId,
2818                                                    AssetEntry.class.getName(), entryId);
2819                                    }
2820                            }
2821                    }
2822    
2823                    private SqlUpdate _sqlUpdate;
2824                    private AssetEntryPersistenceImpl _persistenceImpl;
2825            }
2826    
2827            protected class ClearAssetTags {
2828                    protected ClearAssetTags(AssetEntryPersistenceImpl persistenceImpl) {
2829                            _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2830                                            "DELETE FROM AssetEntries_AssetTags WHERE entryId = ?",
2831                                            new int[] { java.sql.Types.BIGINT });
2832                    }
2833    
2834                    protected void clear(long entryId) throws SystemException {
2835                            ModelListener<com.liferay.portlet.asset.model.AssetTag>[] assetTagListeners =
2836                                    assetTagPersistence.getListeners();
2837    
2838                            List<com.liferay.portlet.asset.model.AssetTag> assetTags = null;
2839    
2840                            if ((listeners.length > 0) || (assetTagListeners.length > 0)) {
2841                                    assetTags = getAssetTags(entryId);
2842    
2843                                    for (com.liferay.portlet.asset.model.AssetTag assetTag : assetTags) {
2844                                            for (ModelListener<AssetEntry> listener : listeners) {
2845                                                    listener.onBeforeRemoveAssociation(entryId,
2846                                                            com.liferay.portlet.asset.model.AssetTag.class.getName(),
2847                                                            assetTag.getPrimaryKey());
2848                                            }
2849    
2850                                            for (ModelListener<com.liferay.portlet.asset.model.AssetTag> listener : assetTagListeners) {
2851                                                    listener.onBeforeRemoveAssociation(assetTag.getPrimaryKey(),
2852                                                            AssetEntry.class.getName(), entryId);
2853                                            }
2854                                    }
2855                            }
2856    
2857                            _sqlUpdate.update(new Object[] { new Long(entryId) });
2858    
2859                            if ((listeners.length > 0) || (assetTagListeners.length > 0)) {
2860                                    for (com.liferay.portlet.asset.model.AssetTag assetTag : assetTags) {
2861                                            for (ModelListener<AssetEntry> listener : listeners) {
2862                                                    listener.onAfterRemoveAssociation(entryId,
2863                                                            com.liferay.portlet.asset.model.AssetTag.class.getName(),
2864                                                            assetTag.getPrimaryKey());
2865                                            }
2866    
2867                                            for (ModelListener<com.liferay.portlet.asset.model.AssetTag> listener : assetTagListeners) {
2868                                                    listener.onAfterRemoveAssociation(assetTag.getPrimaryKey(),
2869                                                            AssetEntry.class.getName(), entryId);
2870                                            }
2871                                    }
2872                            }
2873                    }
2874    
2875                    private SqlUpdate _sqlUpdate;
2876            }
2877    
2878            protected class RemoveAssetTag {
2879                    protected RemoveAssetTag(AssetEntryPersistenceImpl persistenceImpl) {
2880                            _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2881                                            "DELETE FROM AssetEntries_AssetTags WHERE entryId = ? AND tagId = ?",
2882                                            new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
2883                            _persistenceImpl = persistenceImpl;
2884                    }
2885    
2886                    protected void remove(long entryId, long tagId)
2887                            throws SystemException {
2888                            if (_persistenceImpl.containsAssetTag.contains(entryId, tagId)) {
2889                                    ModelListener<com.liferay.portlet.asset.model.AssetTag>[] assetTagListeners =
2890                                            assetTagPersistence.getListeners();
2891    
2892                                    for (ModelListener<AssetEntry> listener : listeners) {
2893                                            listener.onBeforeRemoveAssociation(entryId,
2894                                                    com.liferay.portlet.asset.model.AssetTag.class.getName(),
2895                                                    tagId);
2896                                    }
2897    
2898                                    for (ModelListener<com.liferay.portlet.asset.model.AssetTag> listener : assetTagListeners) {
2899                                            listener.onBeforeRemoveAssociation(tagId,
2900                                                    AssetEntry.class.getName(), entryId);
2901                                    }
2902    
2903                                    _sqlUpdate.update(new Object[] {
2904                                                    new Long(entryId), new Long(tagId)
2905                                            });
2906    
2907                                    for (ModelListener<AssetEntry> listener : listeners) {
2908                                            listener.onAfterRemoveAssociation(entryId,
2909                                                    com.liferay.portlet.asset.model.AssetTag.class.getName(),
2910                                                    tagId);
2911                                    }
2912    
2913                                    for (ModelListener<com.liferay.portlet.asset.model.AssetTag> listener : assetTagListeners) {
2914                                            listener.onAfterRemoveAssociation(tagId,
2915                                                    AssetEntry.class.getName(), entryId);
2916                                    }
2917                            }
2918                    }
2919    
2920                    private SqlUpdate _sqlUpdate;
2921                    private AssetEntryPersistenceImpl _persistenceImpl;
2922            }
2923    
2924            private static final String _SQL_SELECT_ASSETENTRY = "SELECT assetEntry FROM AssetEntry assetEntry";
2925            private static final String _SQL_SELECT_ASSETENTRY_WHERE = "SELECT assetEntry FROM AssetEntry assetEntry WHERE ";
2926            private static final String _SQL_COUNT_ASSETENTRY = "SELECT COUNT(assetEntry) FROM AssetEntry assetEntry";
2927            private static final String _SQL_COUNT_ASSETENTRY_WHERE = "SELECT COUNT(assetEntry) FROM AssetEntry assetEntry WHERE ";
2928            private static final String _SQL_GETASSETCATEGORIES = "SELECT {AssetCategory.*} FROM AssetCategory INNER JOIN AssetEntries_AssetCategories ON (AssetEntries_AssetCategories.categoryId = AssetCategory.categoryId) WHERE (AssetEntries_AssetCategories.entryId = ?)";
2929            private static final String _SQL_GETASSETCATEGORIESSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM AssetEntries_AssetCategories WHERE entryId = ?";
2930            private static final String _SQL_CONTAINSASSETCATEGORY = "SELECT COUNT(*) AS COUNT_VALUE FROM AssetEntries_AssetCategories WHERE entryId = ? AND categoryId = ?";
2931            private static final String _SQL_GETASSETTAGS = "SELECT {AssetTag.*} FROM AssetTag INNER JOIN AssetEntries_AssetTags ON (AssetEntries_AssetTags.tagId = AssetTag.tagId) WHERE (AssetEntries_AssetTags.entryId = ?)";
2932            private static final String _SQL_GETASSETTAGSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM AssetEntries_AssetTags WHERE entryId = ?";
2933            private static final String _SQL_CONTAINSASSETTAG = "SELECT COUNT(*) AS COUNT_VALUE FROM AssetEntries_AssetTags WHERE entryId = ? AND tagId = ?";
2934            private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "assetEntry.companyId = ?";
2935            private static final String _FINDER_COLUMN_G_CU_GROUPID_2 = "assetEntry.groupId = ? AND ";
2936            private static final String _FINDER_COLUMN_G_CU_CLASSUUID_1 = "assetEntry.classUuid IS NULL";
2937            private static final String _FINDER_COLUMN_G_CU_CLASSUUID_2 = "assetEntry.classUuid = ?";
2938            private static final String _FINDER_COLUMN_G_CU_CLASSUUID_3 = "(assetEntry.classUuid IS NULL OR assetEntry.classUuid = ?)";
2939            private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "assetEntry.classNameId = ? AND ";
2940            private static final String _FINDER_COLUMN_C_C_CLASSPK_2 = "assetEntry.classPK = ?";
2941            private static final String _ORDER_BY_ENTITY_ALIAS = "assetEntry.";
2942            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No AssetEntry exists with the primary key ";
2943            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No AssetEntry exists with the key {";
2944            private static Log _log = LogFactoryUtil.getLog(AssetEntryPersistenceImpl.class);
2945    }