001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.asset.service.persistence;
016    
017    import com.liferay.portal.NoSuchModelException;
018    import com.liferay.portal.kernel.bean.BeanReference;
019    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderPath;
023    import com.liferay.portal.kernel.dao.orm.Query;
024    import com.liferay.portal.kernel.dao.orm.QueryPos;
025    import com.liferay.portal.kernel.dao.orm.QueryUtil;
026    import com.liferay.portal.kernel.dao.orm.Session;
027    import com.liferay.portal.kernel.exception.SystemException;
028    import com.liferay.portal.kernel.log.Log;
029    import com.liferay.portal.kernel.log.LogFactoryUtil;
030    import com.liferay.portal.kernel.util.GetterUtil;
031    import com.liferay.portal.kernel.util.InstanceFactory;
032    import com.liferay.portal.kernel.util.OrderByComparator;
033    import com.liferay.portal.kernel.util.StringBundler;
034    import com.liferay.portal.kernel.util.StringPool;
035    import com.liferay.portal.kernel.util.StringUtil;
036    import com.liferay.portal.kernel.util.Validator;
037    import com.liferay.portal.model.CacheModel;
038    import com.liferay.portal.model.ModelListener;
039    import com.liferay.portal.service.persistence.BatchSessionUtil;
040    import com.liferay.portal.service.persistence.ResourcePersistence;
041    import com.liferay.portal.service.persistence.UserPersistence;
042    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
043    
044    import com.liferay.portlet.asset.NoSuchTagPropertyException;
045    import com.liferay.portlet.asset.model.AssetTagProperty;
046    import com.liferay.portlet.asset.model.impl.AssetTagPropertyImpl;
047    import com.liferay.portlet.asset.model.impl.AssetTagPropertyModelImpl;
048    
049    import java.io.Serializable;
050    
051    import java.util.ArrayList;
052    import java.util.Collections;
053    import java.util.List;
054    
055    /**
056     * The persistence implementation for the asset tag property service.
057     *
058     * <p>
059     * Caching information and settings can be found in <code>portal.properties</code>
060     * </p>
061     *
062     * @author Brian Wing Shun Chan
063     * @see AssetTagPropertyPersistence
064     * @see AssetTagPropertyUtil
065     * @generated
066     */
067    public class AssetTagPropertyPersistenceImpl extends BasePersistenceImpl<AssetTagProperty>
068            implements AssetTagPropertyPersistence {
069            /*
070             * NOTE FOR DEVELOPERS:
071             *
072             * Never modify or reference this class directly. Always use {@link AssetTagPropertyUtil} to access the asset tag property persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
073             */
074            public static final String FINDER_CLASS_NAME_ENTITY = AssetTagPropertyImpl.class.getName();
075            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
076                    ".List1";
077            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
078                    ".List2";
079            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID =
080                    new FinderPath(AssetTagPropertyModelImpl.ENTITY_CACHE_ENABLED,
081                            AssetTagPropertyModelImpl.FINDER_CACHE_ENABLED,
082                            AssetTagPropertyImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
083                            "findByCompanyId",
084                            new String[] {
085                                    Long.class.getName(),
086                                    
087                            "java.lang.Integer", "java.lang.Integer",
088                                    "com.liferay.portal.kernel.util.OrderByComparator"
089                            });
090            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID =
091                    new FinderPath(AssetTagPropertyModelImpl.ENTITY_CACHE_ENABLED,
092                            AssetTagPropertyModelImpl.FINDER_CACHE_ENABLED,
093                            AssetTagPropertyImpl.class,
094                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCompanyId",
095                            new String[] { Long.class.getName() },
096                            AssetTagPropertyModelImpl.COMPANYID_COLUMN_BITMASK);
097            public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(AssetTagPropertyModelImpl.ENTITY_CACHE_ENABLED,
098                            AssetTagPropertyModelImpl.FINDER_CACHE_ENABLED, Long.class,
099                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByCompanyId",
100                            new String[] { Long.class.getName() });
101            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_TAGID = new FinderPath(AssetTagPropertyModelImpl.ENTITY_CACHE_ENABLED,
102                            AssetTagPropertyModelImpl.FINDER_CACHE_ENABLED,
103                            AssetTagPropertyImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
104                            "findByTagId",
105                            new String[] {
106                                    Long.class.getName(),
107                                    
108                            "java.lang.Integer", "java.lang.Integer",
109                                    "com.liferay.portal.kernel.util.OrderByComparator"
110                            });
111            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TAGID = new FinderPath(AssetTagPropertyModelImpl.ENTITY_CACHE_ENABLED,
112                            AssetTagPropertyModelImpl.FINDER_CACHE_ENABLED,
113                            AssetTagPropertyImpl.class,
114                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByTagId",
115                            new String[] { Long.class.getName() },
116                            AssetTagPropertyModelImpl.TAGID_COLUMN_BITMASK);
117            public static final FinderPath FINDER_PATH_COUNT_BY_TAGID = new FinderPath(AssetTagPropertyModelImpl.ENTITY_CACHE_ENABLED,
118                            AssetTagPropertyModelImpl.FINDER_CACHE_ENABLED, Long.class,
119                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByTagId",
120                            new String[] { Long.class.getName() });
121            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_K = new FinderPath(AssetTagPropertyModelImpl.ENTITY_CACHE_ENABLED,
122                            AssetTagPropertyModelImpl.FINDER_CACHE_ENABLED,
123                            AssetTagPropertyImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
124                            "findByC_K",
125                            new String[] {
126                                    Long.class.getName(), String.class.getName(),
127                                    
128                            "java.lang.Integer", "java.lang.Integer",
129                                    "com.liferay.portal.kernel.util.OrderByComparator"
130                            });
131            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_K = new FinderPath(AssetTagPropertyModelImpl.ENTITY_CACHE_ENABLED,
132                            AssetTagPropertyModelImpl.FINDER_CACHE_ENABLED,
133                            AssetTagPropertyImpl.class,
134                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_K",
135                            new String[] { Long.class.getName(), String.class.getName() },
136                            AssetTagPropertyModelImpl.COMPANYID_COLUMN_BITMASK |
137                            AssetTagPropertyModelImpl.KEY_COLUMN_BITMASK);
138            public static final FinderPath FINDER_PATH_COUNT_BY_C_K = new FinderPath(AssetTagPropertyModelImpl.ENTITY_CACHE_ENABLED,
139                            AssetTagPropertyModelImpl.FINDER_CACHE_ENABLED, Long.class,
140                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_K",
141                            new String[] { Long.class.getName(), String.class.getName() });
142            public static final FinderPath FINDER_PATH_FETCH_BY_T_K = new FinderPath(AssetTagPropertyModelImpl.ENTITY_CACHE_ENABLED,
143                            AssetTagPropertyModelImpl.FINDER_CACHE_ENABLED,
144                            AssetTagPropertyImpl.class, FINDER_CLASS_NAME_ENTITY, "fetchByT_K",
145                            new String[] { Long.class.getName(), String.class.getName() },
146                            AssetTagPropertyModelImpl.TAGID_COLUMN_BITMASK |
147                            AssetTagPropertyModelImpl.KEY_COLUMN_BITMASK);
148            public static final FinderPath FINDER_PATH_COUNT_BY_T_K = new FinderPath(AssetTagPropertyModelImpl.ENTITY_CACHE_ENABLED,
149                            AssetTagPropertyModelImpl.FINDER_CACHE_ENABLED, Long.class,
150                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByT_K",
151                            new String[] { Long.class.getName(), String.class.getName() });
152            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(AssetTagPropertyModelImpl.ENTITY_CACHE_ENABLED,
153                            AssetTagPropertyModelImpl.FINDER_CACHE_ENABLED,
154                            AssetTagPropertyImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
155                            "findAll", new String[0]);
156            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(AssetTagPropertyModelImpl.ENTITY_CACHE_ENABLED,
157                            AssetTagPropertyModelImpl.FINDER_CACHE_ENABLED,
158                            AssetTagPropertyImpl.class,
159                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
160            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(AssetTagPropertyModelImpl.ENTITY_CACHE_ENABLED,
161                            AssetTagPropertyModelImpl.FINDER_CACHE_ENABLED, Long.class,
162                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
163    
164            /**
165             * Caches the asset tag property in the entity cache if it is enabled.
166             *
167             * @param assetTagProperty the asset tag property
168             */
169            public void cacheResult(AssetTagProperty assetTagProperty) {
170                    EntityCacheUtil.putResult(AssetTagPropertyModelImpl.ENTITY_CACHE_ENABLED,
171                            AssetTagPropertyImpl.class, assetTagProperty.getPrimaryKey(),
172                            assetTagProperty);
173    
174                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_K,
175                            new Object[] {
176                                    Long.valueOf(assetTagProperty.getTagId()),
177                                    
178                            assetTagProperty.getKey()
179                            }, assetTagProperty);
180    
181                    assetTagProperty.resetOriginalValues();
182            }
183    
184            /**
185             * Caches the asset tag properties in the entity cache if it is enabled.
186             *
187             * @param assetTagProperties the asset tag properties
188             */
189            public void cacheResult(List<AssetTagProperty> assetTagProperties) {
190                    for (AssetTagProperty assetTagProperty : assetTagProperties) {
191                            if (EntityCacheUtil.getResult(
192                                                    AssetTagPropertyModelImpl.ENTITY_CACHE_ENABLED,
193                                                    AssetTagPropertyImpl.class,
194                                                    assetTagProperty.getPrimaryKey()) == null) {
195                                    cacheResult(assetTagProperty);
196                            }
197                            else {
198                                    assetTagProperty.resetOriginalValues();
199                            }
200                    }
201            }
202    
203            /**
204             * Clears the cache for all asset tag properties.
205             *
206             * <p>
207             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
208             * </p>
209             */
210            @Override
211            public void clearCache() {
212                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
213                            CacheRegistryUtil.clear(AssetTagPropertyImpl.class.getName());
214                    }
215    
216                    EntityCacheUtil.clearCache(AssetTagPropertyImpl.class.getName());
217    
218                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
219                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
220                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
221            }
222    
223            /**
224             * Clears the cache for the asset tag property.
225             *
226             * <p>
227             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
228             * </p>
229             */
230            @Override
231            public void clearCache(AssetTagProperty assetTagProperty) {
232                    EntityCacheUtil.removeResult(AssetTagPropertyModelImpl.ENTITY_CACHE_ENABLED,
233                            AssetTagPropertyImpl.class, assetTagProperty.getPrimaryKey());
234    
235                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
236                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
237    
238                    clearUniqueFindersCache(assetTagProperty);
239            }
240    
241            @Override
242            public void clearCache(List<AssetTagProperty> assetTagProperties) {
243                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
244                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
245    
246                    for (AssetTagProperty assetTagProperty : assetTagProperties) {
247                            EntityCacheUtil.removeResult(AssetTagPropertyModelImpl.ENTITY_CACHE_ENABLED,
248                                    AssetTagPropertyImpl.class, assetTagProperty.getPrimaryKey());
249    
250                            clearUniqueFindersCache(assetTagProperty);
251                    }
252            }
253    
254            protected void clearUniqueFindersCache(AssetTagProperty assetTagProperty) {
255                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_T_K,
256                            new Object[] {
257                                    Long.valueOf(assetTagProperty.getTagId()),
258                                    
259                            assetTagProperty.getKey()
260                            });
261            }
262    
263            /**
264             * Creates a new asset tag property with the primary key. Does not add the asset tag property to the database.
265             *
266             * @param tagPropertyId the primary key for the new asset tag property
267             * @return the new asset tag property
268             */
269            public AssetTagProperty create(long tagPropertyId) {
270                    AssetTagProperty assetTagProperty = new AssetTagPropertyImpl();
271    
272                    assetTagProperty.setNew(true);
273                    assetTagProperty.setPrimaryKey(tagPropertyId);
274    
275                    return assetTagProperty;
276            }
277    
278            /**
279             * Removes the asset tag property with the primary key from the database. Also notifies the appropriate model listeners.
280             *
281             * @param tagPropertyId the primary key of the asset tag property
282             * @return the asset tag property that was removed
283             * @throws com.liferay.portlet.asset.NoSuchTagPropertyException if a asset tag property with the primary key could not be found
284             * @throws SystemException if a system exception occurred
285             */
286            public AssetTagProperty remove(long tagPropertyId)
287                    throws NoSuchTagPropertyException, SystemException {
288                    return remove(Long.valueOf(tagPropertyId));
289            }
290    
291            /**
292             * Removes the asset tag property with the primary key from the database. Also notifies the appropriate model listeners.
293             *
294             * @param primaryKey the primary key of the asset tag property
295             * @return the asset tag property that was removed
296             * @throws com.liferay.portlet.asset.NoSuchTagPropertyException if a asset tag property with the primary key could not be found
297             * @throws SystemException if a system exception occurred
298             */
299            @Override
300            public AssetTagProperty remove(Serializable primaryKey)
301                    throws NoSuchTagPropertyException, SystemException {
302                    Session session = null;
303    
304                    try {
305                            session = openSession();
306    
307                            AssetTagProperty assetTagProperty = (AssetTagProperty)session.get(AssetTagPropertyImpl.class,
308                                            primaryKey);
309    
310                            if (assetTagProperty == null) {
311                                    if (_log.isWarnEnabled()) {
312                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
313                                    }
314    
315                                    throw new NoSuchTagPropertyException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
316                                            primaryKey);
317                            }
318    
319                            return remove(assetTagProperty);
320                    }
321                    catch (NoSuchTagPropertyException nsee) {
322                            throw nsee;
323                    }
324                    catch (Exception e) {
325                            throw processException(e);
326                    }
327                    finally {
328                            closeSession(session);
329                    }
330            }
331    
332            @Override
333            protected AssetTagProperty removeImpl(AssetTagProperty assetTagProperty)
334                    throws SystemException {
335                    assetTagProperty = toUnwrappedModel(assetTagProperty);
336    
337                    Session session = null;
338    
339                    try {
340                            session = openSession();
341    
342                            BatchSessionUtil.delete(session, assetTagProperty);
343                    }
344                    catch (Exception e) {
345                            throw processException(e);
346                    }
347                    finally {
348                            closeSession(session);
349                    }
350    
351                    clearCache(assetTagProperty);
352    
353                    return assetTagProperty;
354            }
355    
356            @Override
357            public AssetTagProperty updateImpl(
358                    com.liferay.portlet.asset.model.AssetTagProperty assetTagProperty,
359                    boolean merge) throws SystemException {
360                    assetTagProperty = toUnwrappedModel(assetTagProperty);
361    
362                    boolean isNew = assetTagProperty.isNew();
363    
364                    AssetTagPropertyModelImpl assetTagPropertyModelImpl = (AssetTagPropertyModelImpl)assetTagProperty;
365    
366                    Session session = null;
367    
368                    try {
369                            session = openSession();
370    
371                            BatchSessionUtil.update(session, assetTagProperty, merge);
372    
373                            assetTagProperty.setNew(false);
374                    }
375                    catch (Exception e) {
376                            throw processException(e);
377                    }
378                    finally {
379                            closeSession(session);
380                    }
381    
382                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
383    
384                    if (isNew || !AssetTagPropertyModelImpl.COLUMN_BITMASK_ENABLED) {
385                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
386                    }
387    
388                    else {
389                            if ((assetTagPropertyModelImpl.getColumnBitmask() &
390                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) {
391                                    Object[] args = new Object[] {
392                                                    Long.valueOf(assetTagPropertyModelImpl.getOriginalCompanyId())
393                                            };
394    
395                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
396                                            args);
397                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
398                                            args);
399    
400                                    args = new Object[] {
401                                                    Long.valueOf(assetTagPropertyModelImpl.getCompanyId())
402                                            };
403    
404                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
405                                            args);
406                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
407                                            args);
408                            }
409    
410                            if ((assetTagPropertyModelImpl.getColumnBitmask() &
411                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TAGID.getColumnBitmask()) != 0) {
412                                    Object[] args = new Object[] {
413                                                    Long.valueOf(assetTagPropertyModelImpl.getOriginalTagId())
414                                            };
415    
416                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TAGID, args);
417                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TAGID,
418                                            args);
419    
420                                    args = new Object[] {
421                                                    Long.valueOf(assetTagPropertyModelImpl.getTagId())
422                                            };
423    
424                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TAGID, args);
425                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TAGID,
426                                            args);
427                            }
428    
429                            if ((assetTagPropertyModelImpl.getColumnBitmask() &
430                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_K.getColumnBitmask()) != 0) {
431                                    Object[] args = new Object[] {
432                                                    Long.valueOf(assetTagPropertyModelImpl.getOriginalCompanyId()),
433                                                    
434                                                    assetTagPropertyModelImpl.getOriginalKey()
435                                            };
436    
437                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_K, args);
438                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_K,
439                                            args);
440    
441                                    args = new Object[] {
442                                                    Long.valueOf(assetTagPropertyModelImpl.getCompanyId()),
443                                                    
444                                                    assetTagPropertyModelImpl.getKey()
445                                            };
446    
447                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_K, args);
448                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_K,
449                                            args);
450                            }
451                    }
452    
453                    EntityCacheUtil.putResult(AssetTagPropertyModelImpl.ENTITY_CACHE_ENABLED,
454                            AssetTagPropertyImpl.class, assetTagProperty.getPrimaryKey(),
455                            assetTagProperty);
456    
457                    if (isNew) {
458                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_K,
459                                    new Object[] {
460                                            Long.valueOf(assetTagProperty.getTagId()),
461                                            
462                                    assetTagProperty.getKey()
463                                    }, assetTagProperty);
464                    }
465                    else {
466                            if ((assetTagPropertyModelImpl.getColumnBitmask() &
467                                            FINDER_PATH_FETCH_BY_T_K.getColumnBitmask()) != 0) {
468                                    Object[] args = new Object[] {
469                                                    Long.valueOf(assetTagPropertyModelImpl.getOriginalTagId()),
470                                                    
471                                                    assetTagPropertyModelImpl.getOriginalKey()
472                                            };
473    
474                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_T_K, args);
475    
476                                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_T_K, args);
477    
478                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_K,
479                                            new Object[] {
480                                                    Long.valueOf(assetTagProperty.getTagId()),
481                                                    
482                                            assetTagProperty.getKey()
483                                            }, assetTagProperty);
484                            }
485                    }
486    
487                    return assetTagProperty;
488            }
489    
490            protected AssetTagProperty toUnwrappedModel(
491                    AssetTagProperty assetTagProperty) {
492                    if (assetTagProperty instanceof AssetTagPropertyImpl) {
493                            return assetTagProperty;
494                    }
495    
496                    AssetTagPropertyImpl assetTagPropertyImpl = new AssetTagPropertyImpl();
497    
498                    assetTagPropertyImpl.setNew(assetTagProperty.isNew());
499                    assetTagPropertyImpl.setPrimaryKey(assetTagProperty.getPrimaryKey());
500    
501                    assetTagPropertyImpl.setTagPropertyId(assetTagProperty.getTagPropertyId());
502                    assetTagPropertyImpl.setCompanyId(assetTagProperty.getCompanyId());
503                    assetTagPropertyImpl.setUserId(assetTagProperty.getUserId());
504                    assetTagPropertyImpl.setUserName(assetTagProperty.getUserName());
505                    assetTagPropertyImpl.setCreateDate(assetTagProperty.getCreateDate());
506                    assetTagPropertyImpl.setModifiedDate(assetTagProperty.getModifiedDate());
507                    assetTagPropertyImpl.setTagId(assetTagProperty.getTagId());
508                    assetTagPropertyImpl.setKey(assetTagProperty.getKey());
509                    assetTagPropertyImpl.setValue(assetTagProperty.getValue());
510    
511                    return assetTagPropertyImpl;
512            }
513    
514            /**
515             * Returns the asset tag property with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
516             *
517             * @param primaryKey the primary key of the asset tag property
518             * @return the asset tag property
519             * @throws com.liferay.portal.NoSuchModelException if a asset tag property with the primary key could not be found
520             * @throws SystemException if a system exception occurred
521             */
522            @Override
523            public AssetTagProperty findByPrimaryKey(Serializable primaryKey)
524                    throws NoSuchModelException, SystemException {
525                    return findByPrimaryKey(((Long)primaryKey).longValue());
526            }
527    
528            /**
529             * Returns the asset tag property with the primary key or throws a {@link com.liferay.portlet.asset.NoSuchTagPropertyException} if it could not be found.
530             *
531             * @param tagPropertyId the primary key of the asset tag property
532             * @return the asset tag property
533             * @throws com.liferay.portlet.asset.NoSuchTagPropertyException if a asset tag property with the primary key could not be found
534             * @throws SystemException if a system exception occurred
535             */
536            public AssetTagProperty findByPrimaryKey(long tagPropertyId)
537                    throws NoSuchTagPropertyException, SystemException {
538                    AssetTagProperty assetTagProperty = fetchByPrimaryKey(tagPropertyId);
539    
540                    if (assetTagProperty == null) {
541                            if (_log.isWarnEnabled()) {
542                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + tagPropertyId);
543                            }
544    
545                            throw new NoSuchTagPropertyException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
546                                    tagPropertyId);
547                    }
548    
549                    return assetTagProperty;
550            }
551    
552            /**
553             * Returns the asset tag property with the primary key or returns <code>null</code> if it could not be found.
554             *
555             * @param primaryKey the primary key of the asset tag property
556             * @return the asset tag property, or <code>null</code> if a asset tag property with the primary key could not be found
557             * @throws SystemException if a system exception occurred
558             */
559            @Override
560            public AssetTagProperty fetchByPrimaryKey(Serializable primaryKey)
561                    throws SystemException {
562                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
563            }
564    
565            /**
566             * Returns the asset tag property with the primary key or returns <code>null</code> if it could not be found.
567             *
568             * @param tagPropertyId the primary key of the asset tag property
569             * @return the asset tag property, or <code>null</code> if a asset tag property with the primary key could not be found
570             * @throws SystemException if a system exception occurred
571             */
572            public AssetTagProperty fetchByPrimaryKey(long tagPropertyId)
573                    throws SystemException {
574                    AssetTagProperty assetTagProperty = (AssetTagProperty)EntityCacheUtil.getResult(AssetTagPropertyModelImpl.ENTITY_CACHE_ENABLED,
575                                    AssetTagPropertyImpl.class, tagPropertyId);
576    
577                    if (assetTagProperty == _nullAssetTagProperty) {
578                            return null;
579                    }
580    
581                    if (assetTagProperty == null) {
582                            Session session = null;
583    
584                            boolean hasException = false;
585    
586                            try {
587                                    session = openSession();
588    
589                                    assetTagProperty = (AssetTagProperty)session.get(AssetTagPropertyImpl.class,
590                                                    Long.valueOf(tagPropertyId));
591                            }
592                            catch (Exception e) {
593                                    hasException = true;
594    
595                                    throw processException(e);
596                            }
597                            finally {
598                                    if (assetTagProperty != null) {
599                                            cacheResult(assetTagProperty);
600                                    }
601                                    else if (!hasException) {
602                                            EntityCacheUtil.putResult(AssetTagPropertyModelImpl.ENTITY_CACHE_ENABLED,
603                                                    AssetTagPropertyImpl.class, tagPropertyId,
604                                                    _nullAssetTagProperty);
605                                    }
606    
607                                    closeSession(session);
608                            }
609                    }
610    
611                    return assetTagProperty;
612            }
613    
614            /**
615             * Returns all the asset tag properties where companyId = &#63;.
616             *
617             * @param companyId the company ID
618             * @return the matching asset tag properties
619             * @throws SystemException if a system exception occurred
620             */
621            public List<AssetTagProperty> findByCompanyId(long companyId)
622                    throws SystemException {
623                    return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
624                            null);
625            }
626    
627            /**
628             * Returns a range of all the asset tag properties where companyId = &#63;.
629             *
630             * <p>
631             * 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.
632             * </p>
633             *
634             * @param companyId the company ID
635             * @param start the lower bound of the range of asset tag properties
636             * @param end the upper bound of the range of asset tag properties (not inclusive)
637             * @return the range of matching asset tag properties
638             * @throws SystemException if a system exception occurred
639             */
640            public List<AssetTagProperty> findByCompanyId(long companyId, int start,
641                    int end) throws SystemException {
642                    return findByCompanyId(companyId, start, end, null);
643            }
644    
645            /**
646             * Returns an ordered range of all the asset tag properties where companyId = &#63;.
647             *
648             * <p>
649             * 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.
650             * </p>
651             *
652             * @param companyId the company ID
653             * @param start the lower bound of the range of asset tag properties
654             * @param end the upper bound of the range of asset tag properties (not inclusive)
655             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
656             * @return the ordered range of matching asset tag properties
657             * @throws SystemException if a system exception occurred
658             */
659            public List<AssetTagProperty> findByCompanyId(long companyId, int start,
660                    int end, OrderByComparator orderByComparator) throws SystemException {
661                    FinderPath finderPath = null;
662                    Object[] finderArgs = null;
663    
664                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
665                                    (orderByComparator == null)) {
666                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID;
667                            finderArgs = new Object[] { companyId };
668                    }
669                    else {
670                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID;
671                            finderArgs = new Object[] { companyId, start, end, orderByComparator };
672                    }
673    
674                    List<AssetTagProperty> list = (List<AssetTagProperty>)FinderCacheUtil.getResult(finderPath,
675                                    finderArgs, this);
676    
677                    if ((list != null) && !list.isEmpty()) {
678                            for (AssetTagProperty assetTagProperty : list) {
679                                    if ((companyId != assetTagProperty.getCompanyId())) {
680                                            list = null;
681    
682                                            break;
683                                    }
684                            }
685                    }
686    
687                    if (list == null) {
688                            StringBundler query = null;
689    
690                            if (orderByComparator != null) {
691                                    query = new StringBundler(3 +
692                                                    (orderByComparator.getOrderByFields().length * 3));
693                            }
694                            else {
695                                    query = new StringBundler(3);
696                            }
697    
698                            query.append(_SQL_SELECT_ASSETTAGPROPERTY_WHERE);
699    
700                            query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
701    
702                            if (orderByComparator != null) {
703                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
704                                            orderByComparator);
705                            }
706    
707                            else {
708                                    query.append(AssetTagPropertyModelImpl.ORDER_BY_JPQL);
709                            }
710    
711                            String sql = query.toString();
712    
713                            Session session = null;
714    
715                            try {
716                                    session = openSession();
717    
718                                    Query q = session.createQuery(sql);
719    
720                                    QueryPos qPos = QueryPos.getInstance(q);
721    
722                                    qPos.add(companyId);
723    
724                                    list = (List<AssetTagProperty>)QueryUtil.list(q, getDialect(),
725                                                    start, end);
726                            }
727                            catch (Exception e) {
728                                    throw processException(e);
729                            }
730                            finally {
731                                    if (list == null) {
732                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
733                                    }
734                                    else {
735                                            cacheResult(list);
736    
737                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
738                                    }
739    
740                                    closeSession(session);
741                            }
742                    }
743    
744                    return list;
745            }
746    
747            /**
748             * Returns the first asset tag property in the ordered set where companyId = &#63;.
749             *
750             * @param companyId the company ID
751             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
752             * @return the first matching asset tag property
753             * @throws com.liferay.portlet.asset.NoSuchTagPropertyException if a matching asset tag property could not be found
754             * @throws SystemException if a system exception occurred
755             */
756            public AssetTagProperty findByCompanyId_First(long companyId,
757                    OrderByComparator orderByComparator)
758                    throws NoSuchTagPropertyException, SystemException {
759                    AssetTagProperty assetTagProperty = fetchByCompanyId_First(companyId,
760                                    orderByComparator);
761    
762                    if (assetTagProperty != null) {
763                            return assetTagProperty;
764                    }
765    
766                    StringBundler msg = new StringBundler(4);
767    
768                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
769    
770                    msg.append("companyId=");
771                    msg.append(companyId);
772    
773                    msg.append(StringPool.CLOSE_CURLY_BRACE);
774    
775                    throw new NoSuchTagPropertyException(msg.toString());
776            }
777    
778            /**
779             * Returns the first asset tag property in the ordered set where companyId = &#63;.
780             *
781             * @param companyId the company ID
782             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
783             * @return the first matching asset tag property, or <code>null</code> if a matching asset tag property could not be found
784             * @throws SystemException if a system exception occurred
785             */
786            public AssetTagProperty fetchByCompanyId_First(long companyId,
787                    OrderByComparator orderByComparator) throws SystemException {
788                    List<AssetTagProperty> list = findByCompanyId(companyId, 0, 1,
789                                    orderByComparator);
790    
791                    if (!list.isEmpty()) {
792                            return list.get(0);
793                    }
794    
795                    return null;
796            }
797    
798            /**
799             * Returns the last asset tag property in the ordered set where companyId = &#63;.
800             *
801             * @param companyId the company ID
802             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
803             * @return the last matching asset tag property
804             * @throws com.liferay.portlet.asset.NoSuchTagPropertyException if a matching asset tag property could not be found
805             * @throws SystemException if a system exception occurred
806             */
807            public AssetTagProperty findByCompanyId_Last(long companyId,
808                    OrderByComparator orderByComparator)
809                    throws NoSuchTagPropertyException, SystemException {
810                    AssetTagProperty assetTagProperty = fetchByCompanyId_Last(companyId,
811                                    orderByComparator);
812    
813                    if (assetTagProperty != null) {
814                            return assetTagProperty;
815                    }
816    
817                    StringBundler msg = new StringBundler(4);
818    
819                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
820    
821                    msg.append("companyId=");
822                    msg.append(companyId);
823    
824                    msg.append(StringPool.CLOSE_CURLY_BRACE);
825    
826                    throw new NoSuchTagPropertyException(msg.toString());
827            }
828    
829            /**
830             * Returns the last asset tag property in the ordered set where companyId = &#63;.
831             *
832             * @param companyId the company ID
833             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
834             * @return the last matching asset tag property, or <code>null</code> if a matching asset tag property could not be found
835             * @throws SystemException if a system exception occurred
836             */
837            public AssetTagProperty fetchByCompanyId_Last(long companyId,
838                    OrderByComparator orderByComparator) throws SystemException {
839                    int count = countByCompanyId(companyId);
840    
841                    List<AssetTagProperty> list = findByCompanyId(companyId, count - 1,
842                                    count, orderByComparator);
843    
844                    if (!list.isEmpty()) {
845                            return list.get(0);
846                    }
847    
848                    return null;
849            }
850    
851            /**
852             * Returns the asset tag properties before and after the current asset tag property in the ordered set where companyId = &#63;.
853             *
854             * @param tagPropertyId the primary key of the current asset tag property
855             * @param companyId the company ID
856             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
857             * @return the previous, current, and next asset tag property
858             * @throws com.liferay.portlet.asset.NoSuchTagPropertyException if a asset tag property with the primary key could not be found
859             * @throws SystemException if a system exception occurred
860             */
861            public AssetTagProperty[] findByCompanyId_PrevAndNext(long tagPropertyId,
862                    long companyId, OrderByComparator orderByComparator)
863                    throws NoSuchTagPropertyException, SystemException {
864                    AssetTagProperty assetTagProperty = findByPrimaryKey(tagPropertyId);
865    
866                    Session session = null;
867    
868                    try {
869                            session = openSession();
870    
871                            AssetTagProperty[] array = new AssetTagPropertyImpl[3];
872    
873                            array[0] = getByCompanyId_PrevAndNext(session, assetTagProperty,
874                                            companyId, orderByComparator, true);
875    
876                            array[1] = assetTagProperty;
877    
878                            array[2] = getByCompanyId_PrevAndNext(session, assetTagProperty,
879                                            companyId, orderByComparator, false);
880    
881                            return array;
882                    }
883                    catch (Exception e) {
884                            throw processException(e);
885                    }
886                    finally {
887                            closeSession(session);
888                    }
889            }
890    
891            protected AssetTagProperty getByCompanyId_PrevAndNext(Session session,
892                    AssetTagProperty assetTagProperty, long companyId,
893                    OrderByComparator orderByComparator, boolean previous) {
894                    StringBundler query = null;
895    
896                    if (orderByComparator != null) {
897                            query = new StringBundler(6 +
898                                            (orderByComparator.getOrderByFields().length * 6));
899                    }
900                    else {
901                            query = new StringBundler(3);
902                    }
903    
904                    query.append(_SQL_SELECT_ASSETTAGPROPERTY_WHERE);
905    
906                    query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
907    
908                    if (orderByComparator != null) {
909                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
910    
911                            if (orderByConditionFields.length > 0) {
912                                    query.append(WHERE_AND);
913                            }
914    
915                            for (int i = 0; i < orderByConditionFields.length; i++) {
916                                    query.append(_ORDER_BY_ENTITY_ALIAS);
917                                    query.append(orderByConditionFields[i]);
918    
919                                    if ((i + 1) < orderByConditionFields.length) {
920                                            if (orderByComparator.isAscending() ^ previous) {
921                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
922                                            }
923                                            else {
924                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
925                                            }
926                                    }
927                                    else {
928                                            if (orderByComparator.isAscending() ^ previous) {
929                                                    query.append(WHERE_GREATER_THAN);
930                                            }
931                                            else {
932                                                    query.append(WHERE_LESSER_THAN);
933                                            }
934                                    }
935                            }
936    
937                            query.append(ORDER_BY_CLAUSE);
938    
939                            String[] orderByFields = orderByComparator.getOrderByFields();
940    
941                            for (int i = 0; i < orderByFields.length; i++) {
942                                    query.append(_ORDER_BY_ENTITY_ALIAS);
943                                    query.append(orderByFields[i]);
944    
945                                    if ((i + 1) < orderByFields.length) {
946                                            if (orderByComparator.isAscending() ^ previous) {
947                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
948                                            }
949                                            else {
950                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
951                                            }
952                                    }
953                                    else {
954                                            if (orderByComparator.isAscending() ^ previous) {
955                                                    query.append(ORDER_BY_ASC);
956                                            }
957                                            else {
958                                                    query.append(ORDER_BY_DESC);
959                                            }
960                                    }
961                            }
962                    }
963    
964                    else {
965                            query.append(AssetTagPropertyModelImpl.ORDER_BY_JPQL);
966                    }
967    
968                    String sql = query.toString();
969    
970                    Query q = session.createQuery(sql);
971    
972                    q.setFirstResult(0);
973                    q.setMaxResults(2);
974    
975                    QueryPos qPos = QueryPos.getInstance(q);
976    
977                    qPos.add(companyId);
978    
979                    if (orderByComparator != null) {
980                            Object[] values = orderByComparator.getOrderByConditionValues(assetTagProperty);
981    
982                            for (Object value : values) {
983                                    qPos.add(value);
984                            }
985                    }
986    
987                    List<AssetTagProperty> list = q.list();
988    
989                    if (list.size() == 2) {
990                            return list.get(1);
991                    }
992                    else {
993                            return null;
994                    }
995            }
996    
997            /**
998             * Returns all the asset tag properties where tagId = &#63;.
999             *
1000             * @param tagId the tag ID
1001             * @return the matching asset tag properties
1002             * @throws SystemException if a system exception occurred
1003             */
1004            public List<AssetTagProperty> findByTagId(long tagId)
1005                    throws SystemException {
1006                    return findByTagId(tagId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1007            }
1008    
1009            /**
1010             * Returns a range of all the asset tag properties where tagId = &#63;.
1011             *
1012             * <p>
1013             * 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.
1014             * </p>
1015             *
1016             * @param tagId the tag ID
1017             * @param start the lower bound of the range of asset tag properties
1018             * @param end the upper bound of the range of asset tag properties (not inclusive)
1019             * @return the range of matching asset tag properties
1020             * @throws SystemException if a system exception occurred
1021             */
1022            public List<AssetTagProperty> findByTagId(long tagId, int start, int end)
1023                    throws SystemException {
1024                    return findByTagId(tagId, start, end, null);
1025            }
1026    
1027            /**
1028             * Returns an ordered range of all the asset tag properties where tagId = &#63;.
1029             *
1030             * <p>
1031             * 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.
1032             * </p>
1033             *
1034             * @param tagId the tag ID
1035             * @param start the lower bound of the range of asset tag properties
1036             * @param end the upper bound of the range of asset tag properties (not inclusive)
1037             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1038             * @return the ordered range of matching asset tag properties
1039             * @throws SystemException if a system exception occurred
1040             */
1041            public List<AssetTagProperty> findByTagId(long tagId, int start, int end,
1042                    OrderByComparator orderByComparator) throws SystemException {
1043                    FinderPath finderPath = null;
1044                    Object[] finderArgs = null;
1045    
1046                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1047                                    (orderByComparator == null)) {
1048                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TAGID;
1049                            finderArgs = new Object[] { tagId };
1050                    }
1051                    else {
1052                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_TAGID;
1053                            finderArgs = new Object[] { tagId, start, end, orderByComparator };
1054                    }
1055    
1056                    List<AssetTagProperty> list = (List<AssetTagProperty>)FinderCacheUtil.getResult(finderPath,
1057                                    finderArgs, this);
1058    
1059                    if ((list != null) && !list.isEmpty()) {
1060                            for (AssetTagProperty assetTagProperty : list) {
1061                                    if ((tagId != assetTagProperty.getTagId())) {
1062                                            list = null;
1063    
1064                                            break;
1065                                    }
1066                            }
1067                    }
1068    
1069                    if (list == null) {
1070                            StringBundler query = null;
1071    
1072                            if (orderByComparator != null) {
1073                                    query = new StringBundler(3 +
1074                                                    (orderByComparator.getOrderByFields().length * 3));
1075                            }
1076                            else {
1077                                    query = new StringBundler(3);
1078                            }
1079    
1080                            query.append(_SQL_SELECT_ASSETTAGPROPERTY_WHERE);
1081    
1082                            query.append(_FINDER_COLUMN_TAGID_TAGID_2);
1083    
1084                            if (orderByComparator != null) {
1085                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1086                                            orderByComparator);
1087                            }
1088    
1089                            else {
1090                                    query.append(AssetTagPropertyModelImpl.ORDER_BY_JPQL);
1091                            }
1092    
1093                            String sql = query.toString();
1094    
1095                            Session session = null;
1096    
1097                            try {
1098                                    session = openSession();
1099    
1100                                    Query q = session.createQuery(sql);
1101    
1102                                    QueryPos qPos = QueryPos.getInstance(q);
1103    
1104                                    qPos.add(tagId);
1105    
1106                                    list = (List<AssetTagProperty>)QueryUtil.list(q, getDialect(),
1107                                                    start, end);
1108                            }
1109                            catch (Exception e) {
1110                                    throw processException(e);
1111                            }
1112                            finally {
1113                                    if (list == null) {
1114                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1115                                    }
1116                                    else {
1117                                            cacheResult(list);
1118    
1119                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1120                                    }
1121    
1122                                    closeSession(session);
1123                            }
1124                    }
1125    
1126                    return list;
1127            }
1128    
1129            /**
1130             * Returns the first asset tag property in the ordered set where tagId = &#63;.
1131             *
1132             * @param tagId the tag ID
1133             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1134             * @return the first matching asset tag property
1135             * @throws com.liferay.portlet.asset.NoSuchTagPropertyException if a matching asset tag property could not be found
1136             * @throws SystemException if a system exception occurred
1137             */
1138            public AssetTagProperty findByTagId_First(long tagId,
1139                    OrderByComparator orderByComparator)
1140                    throws NoSuchTagPropertyException, SystemException {
1141                    AssetTagProperty assetTagProperty = fetchByTagId_First(tagId,
1142                                    orderByComparator);
1143    
1144                    if (assetTagProperty != null) {
1145                            return assetTagProperty;
1146                    }
1147    
1148                    StringBundler msg = new StringBundler(4);
1149    
1150                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1151    
1152                    msg.append("tagId=");
1153                    msg.append(tagId);
1154    
1155                    msg.append(StringPool.CLOSE_CURLY_BRACE);
1156    
1157                    throw new NoSuchTagPropertyException(msg.toString());
1158            }
1159    
1160            /**
1161             * Returns the first asset tag property in the ordered set where tagId = &#63;.
1162             *
1163             * @param tagId the tag ID
1164             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1165             * @return the first matching asset tag property, or <code>null</code> if a matching asset tag property could not be found
1166             * @throws SystemException if a system exception occurred
1167             */
1168            public AssetTagProperty fetchByTagId_First(long tagId,
1169                    OrderByComparator orderByComparator) throws SystemException {
1170                    List<AssetTagProperty> list = findByTagId(tagId, 0, 1, orderByComparator);
1171    
1172                    if (!list.isEmpty()) {
1173                            return list.get(0);
1174                    }
1175    
1176                    return null;
1177            }
1178    
1179            /**
1180             * Returns the last asset tag property in the ordered set where tagId = &#63;.
1181             *
1182             * @param tagId the tag ID
1183             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1184             * @return the last matching asset tag property
1185             * @throws com.liferay.portlet.asset.NoSuchTagPropertyException if a matching asset tag property could not be found
1186             * @throws SystemException if a system exception occurred
1187             */
1188            public AssetTagProperty findByTagId_Last(long tagId,
1189                    OrderByComparator orderByComparator)
1190                    throws NoSuchTagPropertyException, SystemException {
1191                    AssetTagProperty assetTagProperty = fetchByTagId_Last(tagId,
1192                                    orderByComparator);
1193    
1194                    if (assetTagProperty != null) {
1195                            return assetTagProperty;
1196                    }
1197    
1198                    StringBundler msg = new StringBundler(4);
1199    
1200                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1201    
1202                    msg.append("tagId=");
1203                    msg.append(tagId);
1204    
1205                    msg.append(StringPool.CLOSE_CURLY_BRACE);
1206    
1207                    throw new NoSuchTagPropertyException(msg.toString());
1208            }
1209    
1210            /**
1211             * Returns the last asset tag property in the ordered set where tagId = &#63;.
1212             *
1213             * @param tagId the tag ID
1214             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1215             * @return the last matching asset tag property, or <code>null</code> if a matching asset tag property could not be found
1216             * @throws SystemException if a system exception occurred
1217             */
1218            public AssetTagProperty fetchByTagId_Last(long tagId,
1219                    OrderByComparator orderByComparator) throws SystemException {
1220                    int count = countByTagId(tagId);
1221    
1222                    List<AssetTagProperty> list = findByTagId(tagId, count - 1, count,
1223                                    orderByComparator);
1224    
1225                    if (!list.isEmpty()) {
1226                            return list.get(0);
1227                    }
1228    
1229                    return null;
1230            }
1231    
1232            /**
1233             * Returns the asset tag properties before and after the current asset tag property in the ordered set where tagId = &#63;.
1234             *
1235             * @param tagPropertyId the primary key of the current asset tag property
1236             * @param tagId the tag ID
1237             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1238             * @return the previous, current, and next asset tag property
1239             * @throws com.liferay.portlet.asset.NoSuchTagPropertyException if a asset tag property with the primary key could not be found
1240             * @throws SystemException if a system exception occurred
1241             */
1242            public AssetTagProperty[] findByTagId_PrevAndNext(long tagPropertyId,
1243                    long tagId, OrderByComparator orderByComparator)
1244                    throws NoSuchTagPropertyException, SystemException {
1245                    AssetTagProperty assetTagProperty = findByPrimaryKey(tagPropertyId);
1246    
1247                    Session session = null;
1248    
1249                    try {
1250                            session = openSession();
1251    
1252                            AssetTagProperty[] array = new AssetTagPropertyImpl[3];
1253    
1254                            array[0] = getByTagId_PrevAndNext(session, assetTagProperty, tagId,
1255                                            orderByComparator, true);
1256    
1257                            array[1] = assetTagProperty;
1258    
1259                            array[2] = getByTagId_PrevAndNext(session, assetTagProperty, tagId,
1260                                            orderByComparator, false);
1261    
1262                            return array;
1263                    }
1264                    catch (Exception e) {
1265                            throw processException(e);
1266                    }
1267                    finally {
1268                            closeSession(session);
1269                    }
1270            }
1271    
1272            protected AssetTagProperty getByTagId_PrevAndNext(Session session,
1273                    AssetTagProperty assetTagProperty, long tagId,
1274                    OrderByComparator orderByComparator, boolean previous) {
1275                    StringBundler query = null;
1276    
1277                    if (orderByComparator != null) {
1278                            query = new StringBundler(6 +
1279                                            (orderByComparator.getOrderByFields().length * 6));
1280                    }
1281                    else {
1282                            query = new StringBundler(3);
1283                    }
1284    
1285                    query.append(_SQL_SELECT_ASSETTAGPROPERTY_WHERE);
1286    
1287                    query.append(_FINDER_COLUMN_TAGID_TAGID_2);
1288    
1289                    if (orderByComparator != null) {
1290                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1291    
1292                            if (orderByConditionFields.length > 0) {
1293                                    query.append(WHERE_AND);
1294                            }
1295    
1296                            for (int i = 0; i < orderByConditionFields.length; i++) {
1297                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1298                                    query.append(orderByConditionFields[i]);
1299    
1300                                    if ((i + 1) < orderByConditionFields.length) {
1301                                            if (orderByComparator.isAscending() ^ previous) {
1302                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1303                                            }
1304                                            else {
1305                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1306                                            }
1307                                    }
1308                                    else {
1309                                            if (orderByComparator.isAscending() ^ previous) {
1310                                                    query.append(WHERE_GREATER_THAN);
1311                                            }
1312                                            else {
1313                                                    query.append(WHERE_LESSER_THAN);
1314                                            }
1315                                    }
1316                            }
1317    
1318                            query.append(ORDER_BY_CLAUSE);
1319    
1320                            String[] orderByFields = orderByComparator.getOrderByFields();
1321    
1322                            for (int i = 0; i < orderByFields.length; i++) {
1323                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1324                                    query.append(orderByFields[i]);
1325    
1326                                    if ((i + 1) < orderByFields.length) {
1327                                            if (orderByComparator.isAscending() ^ previous) {
1328                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1329                                            }
1330                                            else {
1331                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1332                                            }
1333                                    }
1334                                    else {
1335                                            if (orderByComparator.isAscending() ^ previous) {
1336                                                    query.append(ORDER_BY_ASC);
1337                                            }
1338                                            else {
1339                                                    query.append(ORDER_BY_DESC);
1340                                            }
1341                                    }
1342                            }
1343                    }
1344    
1345                    else {
1346                            query.append(AssetTagPropertyModelImpl.ORDER_BY_JPQL);
1347                    }
1348    
1349                    String sql = query.toString();
1350    
1351                    Query q = session.createQuery(sql);
1352    
1353                    q.setFirstResult(0);
1354                    q.setMaxResults(2);
1355    
1356                    QueryPos qPos = QueryPos.getInstance(q);
1357    
1358                    qPos.add(tagId);
1359    
1360                    if (orderByComparator != null) {
1361                            Object[] values = orderByComparator.getOrderByConditionValues(assetTagProperty);
1362    
1363                            for (Object value : values) {
1364                                    qPos.add(value);
1365                            }
1366                    }
1367    
1368                    List<AssetTagProperty> list = q.list();
1369    
1370                    if (list.size() == 2) {
1371                            return list.get(1);
1372                    }
1373                    else {
1374                            return null;
1375                    }
1376            }
1377    
1378            /**
1379             * Returns all the asset tag properties where companyId = &#63; and key = &#63;.
1380             *
1381             * @param companyId the company ID
1382             * @param key the key
1383             * @return the matching asset tag properties
1384             * @throws SystemException if a system exception occurred
1385             */
1386            public List<AssetTagProperty> findByC_K(long companyId, String key)
1387                    throws SystemException {
1388                    return findByC_K(companyId, key, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1389                            null);
1390            }
1391    
1392            /**
1393             * Returns a range of all the asset tag properties where companyId = &#63; and key = &#63;.
1394             *
1395             * <p>
1396             * 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.
1397             * </p>
1398             *
1399             * @param companyId the company ID
1400             * @param key the key
1401             * @param start the lower bound of the range of asset tag properties
1402             * @param end the upper bound of the range of asset tag properties (not inclusive)
1403             * @return the range of matching asset tag properties
1404             * @throws SystemException if a system exception occurred
1405             */
1406            public List<AssetTagProperty> findByC_K(long companyId, String key,
1407                    int start, int end) throws SystemException {
1408                    return findByC_K(companyId, key, start, end, null);
1409            }
1410    
1411            /**
1412             * Returns an ordered range of all the asset tag properties where companyId = &#63; and key = &#63;.
1413             *
1414             * <p>
1415             * 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.
1416             * </p>
1417             *
1418             * @param companyId the company ID
1419             * @param key the key
1420             * @param start the lower bound of the range of asset tag properties
1421             * @param end the upper bound of the range of asset tag properties (not inclusive)
1422             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1423             * @return the ordered range of matching asset tag properties
1424             * @throws SystemException if a system exception occurred
1425             */
1426            public List<AssetTagProperty> findByC_K(long companyId, String key,
1427                    int start, int end, OrderByComparator orderByComparator)
1428                    throws SystemException {
1429                    FinderPath finderPath = null;
1430                    Object[] finderArgs = null;
1431    
1432                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1433                                    (orderByComparator == null)) {
1434                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_K;
1435                            finderArgs = new Object[] { companyId, key };
1436                    }
1437                    else {
1438                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_K;
1439                            finderArgs = new Object[] {
1440                                            companyId, key,
1441                                            
1442                                            start, end, orderByComparator
1443                                    };
1444                    }
1445    
1446                    List<AssetTagProperty> list = (List<AssetTagProperty>)FinderCacheUtil.getResult(finderPath,
1447                                    finderArgs, this);
1448    
1449                    if ((list != null) && !list.isEmpty()) {
1450                            for (AssetTagProperty assetTagProperty : list) {
1451                                    if ((companyId != assetTagProperty.getCompanyId()) ||
1452                                                    !Validator.equals(key, assetTagProperty.getKey())) {
1453                                            list = null;
1454    
1455                                            break;
1456                                    }
1457                            }
1458                    }
1459    
1460                    if (list == null) {
1461                            StringBundler query = null;
1462    
1463                            if (orderByComparator != null) {
1464                                    query = new StringBundler(4 +
1465                                                    (orderByComparator.getOrderByFields().length * 3));
1466                            }
1467                            else {
1468                                    query = new StringBundler(4);
1469                            }
1470    
1471                            query.append(_SQL_SELECT_ASSETTAGPROPERTY_WHERE);
1472    
1473                            query.append(_FINDER_COLUMN_C_K_COMPANYID_2);
1474    
1475                            if (key == null) {
1476                                    query.append(_FINDER_COLUMN_C_K_KEY_1);
1477                            }
1478                            else {
1479                                    if (key.equals(StringPool.BLANK)) {
1480                                            query.append(_FINDER_COLUMN_C_K_KEY_3);
1481                                    }
1482                                    else {
1483                                            query.append(_FINDER_COLUMN_C_K_KEY_2);
1484                                    }
1485                            }
1486    
1487                            if (orderByComparator != null) {
1488                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1489                                            orderByComparator);
1490                            }
1491    
1492                            else {
1493                                    query.append(AssetTagPropertyModelImpl.ORDER_BY_JPQL);
1494                            }
1495    
1496                            String sql = query.toString();
1497    
1498                            Session session = null;
1499    
1500                            try {
1501                                    session = openSession();
1502    
1503                                    Query q = session.createQuery(sql);
1504    
1505                                    QueryPos qPos = QueryPos.getInstance(q);
1506    
1507                                    qPos.add(companyId);
1508    
1509                                    if (key != null) {
1510                                            qPos.add(key);
1511                                    }
1512    
1513                                    list = (List<AssetTagProperty>)QueryUtil.list(q, getDialect(),
1514                                                    start, end);
1515                            }
1516                            catch (Exception e) {
1517                                    throw processException(e);
1518                            }
1519                            finally {
1520                                    if (list == null) {
1521                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1522                                    }
1523                                    else {
1524                                            cacheResult(list);
1525    
1526                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1527                                    }
1528    
1529                                    closeSession(session);
1530                            }
1531                    }
1532    
1533                    return list;
1534            }
1535    
1536            /**
1537             * Returns the first asset tag property in the ordered set where companyId = &#63; and key = &#63;.
1538             *
1539             * @param companyId the company ID
1540             * @param key the key
1541             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1542             * @return the first matching asset tag property
1543             * @throws com.liferay.portlet.asset.NoSuchTagPropertyException if a matching asset tag property could not be found
1544             * @throws SystemException if a system exception occurred
1545             */
1546            public AssetTagProperty findByC_K_First(long companyId, String key,
1547                    OrderByComparator orderByComparator)
1548                    throws NoSuchTagPropertyException, SystemException {
1549                    AssetTagProperty assetTagProperty = fetchByC_K_First(companyId, key,
1550                                    orderByComparator);
1551    
1552                    if (assetTagProperty != null) {
1553                            return assetTagProperty;
1554                    }
1555    
1556                    StringBundler msg = new StringBundler(6);
1557    
1558                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1559    
1560                    msg.append("companyId=");
1561                    msg.append(companyId);
1562    
1563                    msg.append(", key=");
1564                    msg.append(key);
1565    
1566                    msg.append(StringPool.CLOSE_CURLY_BRACE);
1567    
1568                    throw new NoSuchTagPropertyException(msg.toString());
1569            }
1570    
1571            /**
1572             * Returns the first asset tag property in the ordered set where companyId = &#63; and key = &#63;.
1573             *
1574             * @param companyId the company ID
1575             * @param key the key
1576             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1577             * @return the first matching asset tag property, or <code>null</code> if a matching asset tag property could not be found
1578             * @throws SystemException if a system exception occurred
1579             */
1580            public AssetTagProperty fetchByC_K_First(long companyId, String key,
1581                    OrderByComparator orderByComparator) throws SystemException {
1582                    List<AssetTagProperty> list = findByC_K(companyId, key, 0, 1,
1583                                    orderByComparator);
1584    
1585                    if (!list.isEmpty()) {
1586                            return list.get(0);
1587                    }
1588    
1589                    return null;
1590            }
1591    
1592            /**
1593             * Returns the last asset tag property in the ordered set where companyId = &#63; and key = &#63;.
1594             *
1595             * @param companyId the company ID
1596             * @param key the key
1597             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1598             * @return the last matching asset tag property
1599             * @throws com.liferay.portlet.asset.NoSuchTagPropertyException if a matching asset tag property could not be found
1600             * @throws SystemException if a system exception occurred
1601             */
1602            public AssetTagProperty findByC_K_Last(long companyId, String key,
1603                    OrderByComparator orderByComparator)
1604                    throws NoSuchTagPropertyException, SystemException {
1605                    AssetTagProperty assetTagProperty = fetchByC_K_Last(companyId, key,
1606                                    orderByComparator);
1607    
1608                    if (assetTagProperty != null) {
1609                            return assetTagProperty;
1610                    }
1611    
1612                    StringBundler msg = new StringBundler(6);
1613    
1614                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1615    
1616                    msg.append("companyId=");
1617                    msg.append(companyId);
1618    
1619                    msg.append(", key=");
1620                    msg.append(key);
1621    
1622                    msg.append(StringPool.CLOSE_CURLY_BRACE);
1623    
1624                    throw new NoSuchTagPropertyException(msg.toString());
1625            }
1626    
1627            /**
1628             * Returns the last asset tag property in the ordered set where companyId = &#63; and key = &#63;.
1629             *
1630             * @param companyId the company ID
1631             * @param key the key
1632             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1633             * @return the last matching asset tag property, or <code>null</code> if a matching asset tag property could not be found
1634             * @throws SystemException if a system exception occurred
1635             */
1636            public AssetTagProperty fetchByC_K_Last(long companyId, String key,
1637                    OrderByComparator orderByComparator) throws SystemException {
1638                    int count = countByC_K(companyId, key);
1639    
1640                    List<AssetTagProperty> list = findByC_K(companyId, key, count - 1,
1641                                    count, orderByComparator);
1642    
1643                    if (!list.isEmpty()) {
1644                            return list.get(0);
1645                    }
1646    
1647                    return null;
1648            }
1649    
1650            /**
1651             * Returns the asset tag properties before and after the current asset tag property in the ordered set where companyId = &#63; and key = &#63;.
1652             *
1653             * @param tagPropertyId the primary key of the current asset tag property
1654             * @param companyId the company ID
1655             * @param key the key
1656             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1657             * @return the previous, current, and next asset tag property
1658             * @throws com.liferay.portlet.asset.NoSuchTagPropertyException if a asset tag property with the primary key could not be found
1659             * @throws SystemException if a system exception occurred
1660             */
1661            public AssetTagProperty[] findByC_K_PrevAndNext(long tagPropertyId,
1662                    long companyId, String key, OrderByComparator orderByComparator)
1663                    throws NoSuchTagPropertyException, SystemException {
1664                    AssetTagProperty assetTagProperty = findByPrimaryKey(tagPropertyId);
1665    
1666                    Session session = null;
1667    
1668                    try {
1669                            session = openSession();
1670    
1671                            AssetTagProperty[] array = new AssetTagPropertyImpl[3];
1672    
1673                            array[0] = getByC_K_PrevAndNext(session, assetTagProperty,
1674                                            companyId, key, orderByComparator, true);
1675    
1676                            array[1] = assetTagProperty;
1677    
1678                            array[2] = getByC_K_PrevAndNext(session, assetTagProperty,
1679                                            companyId, key, orderByComparator, false);
1680    
1681                            return array;
1682                    }
1683                    catch (Exception e) {
1684                            throw processException(e);
1685                    }
1686                    finally {
1687                            closeSession(session);
1688                    }
1689            }
1690    
1691            protected AssetTagProperty getByC_K_PrevAndNext(Session session,
1692                    AssetTagProperty assetTagProperty, long companyId, String key,
1693                    OrderByComparator orderByComparator, boolean previous) {
1694                    StringBundler query = null;
1695    
1696                    if (orderByComparator != null) {
1697                            query = new StringBundler(6 +
1698                                            (orderByComparator.getOrderByFields().length * 6));
1699                    }
1700                    else {
1701                            query = new StringBundler(3);
1702                    }
1703    
1704                    query.append(_SQL_SELECT_ASSETTAGPROPERTY_WHERE);
1705    
1706                    query.append(_FINDER_COLUMN_C_K_COMPANYID_2);
1707    
1708                    if (key == null) {
1709                            query.append(_FINDER_COLUMN_C_K_KEY_1);
1710                    }
1711                    else {
1712                            if (key.equals(StringPool.BLANK)) {
1713                                    query.append(_FINDER_COLUMN_C_K_KEY_3);
1714                            }
1715                            else {
1716                                    query.append(_FINDER_COLUMN_C_K_KEY_2);
1717                            }
1718                    }
1719    
1720                    if (orderByComparator != null) {
1721                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1722    
1723                            if (orderByConditionFields.length > 0) {
1724                                    query.append(WHERE_AND);
1725                            }
1726    
1727                            for (int i = 0; i < orderByConditionFields.length; i++) {
1728                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1729                                    query.append(orderByConditionFields[i]);
1730    
1731                                    if ((i + 1) < orderByConditionFields.length) {
1732                                            if (orderByComparator.isAscending() ^ previous) {
1733                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1734                                            }
1735                                            else {
1736                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1737                                            }
1738                                    }
1739                                    else {
1740                                            if (orderByComparator.isAscending() ^ previous) {
1741                                                    query.append(WHERE_GREATER_THAN);
1742                                            }
1743                                            else {
1744                                                    query.append(WHERE_LESSER_THAN);
1745                                            }
1746                                    }
1747                            }
1748    
1749                            query.append(ORDER_BY_CLAUSE);
1750    
1751                            String[] orderByFields = orderByComparator.getOrderByFields();
1752    
1753                            for (int i = 0; i < orderByFields.length; i++) {
1754                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1755                                    query.append(orderByFields[i]);
1756    
1757                                    if ((i + 1) < orderByFields.length) {
1758                                            if (orderByComparator.isAscending() ^ previous) {
1759                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1760                                            }
1761                                            else {
1762                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1763                                            }
1764                                    }
1765                                    else {
1766                                            if (orderByComparator.isAscending() ^ previous) {
1767                                                    query.append(ORDER_BY_ASC);
1768                                            }
1769                                            else {
1770                                                    query.append(ORDER_BY_DESC);
1771                                            }
1772                                    }
1773                            }
1774                    }
1775    
1776                    else {
1777                            query.append(AssetTagPropertyModelImpl.ORDER_BY_JPQL);
1778                    }
1779    
1780                    String sql = query.toString();
1781    
1782                    Query q = session.createQuery(sql);
1783    
1784                    q.setFirstResult(0);
1785                    q.setMaxResults(2);
1786    
1787                    QueryPos qPos = QueryPos.getInstance(q);
1788    
1789                    qPos.add(companyId);
1790    
1791                    if (key != null) {
1792                            qPos.add(key);
1793                    }
1794    
1795                    if (orderByComparator != null) {
1796                            Object[] values = orderByComparator.getOrderByConditionValues(assetTagProperty);
1797    
1798                            for (Object value : values) {
1799                                    qPos.add(value);
1800                            }
1801                    }
1802    
1803                    List<AssetTagProperty> list = q.list();
1804    
1805                    if (list.size() == 2) {
1806                            return list.get(1);
1807                    }
1808                    else {
1809                            return null;
1810                    }
1811            }
1812    
1813            /**
1814             * Returns the asset tag property where tagId = &#63; and key = &#63; or throws a {@link com.liferay.portlet.asset.NoSuchTagPropertyException} if it could not be found.
1815             *
1816             * @param tagId the tag ID
1817             * @param key the key
1818             * @return the matching asset tag property
1819             * @throws com.liferay.portlet.asset.NoSuchTagPropertyException if a matching asset tag property could not be found
1820             * @throws SystemException if a system exception occurred
1821             */
1822            public AssetTagProperty findByT_K(long tagId, String key)
1823                    throws NoSuchTagPropertyException, SystemException {
1824                    AssetTagProperty assetTagProperty = fetchByT_K(tagId, key);
1825    
1826                    if (assetTagProperty == null) {
1827                            StringBundler msg = new StringBundler(6);
1828    
1829                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1830    
1831                            msg.append("tagId=");
1832                            msg.append(tagId);
1833    
1834                            msg.append(", key=");
1835                            msg.append(key);
1836    
1837                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1838    
1839                            if (_log.isWarnEnabled()) {
1840                                    _log.warn(msg.toString());
1841                            }
1842    
1843                            throw new NoSuchTagPropertyException(msg.toString());
1844                    }
1845    
1846                    return assetTagProperty;
1847            }
1848    
1849            /**
1850             * Returns the asset tag property where tagId = &#63; and key = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
1851             *
1852             * @param tagId the tag ID
1853             * @param key the key
1854             * @return the matching asset tag property, or <code>null</code> if a matching asset tag property could not be found
1855             * @throws SystemException if a system exception occurred
1856             */
1857            public AssetTagProperty fetchByT_K(long tagId, String key)
1858                    throws SystemException {
1859                    return fetchByT_K(tagId, key, true);
1860            }
1861    
1862            /**
1863             * Returns the asset tag property where tagId = &#63; and key = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
1864             *
1865             * @param tagId the tag ID
1866             * @param key the key
1867             * @param retrieveFromCache whether to use the finder cache
1868             * @return the matching asset tag property, or <code>null</code> if a matching asset tag property could not be found
1869             * @throws SystemException if a system exception occurred
1870             */
1871            public AssetTagProperty fetchByT_K(long tagId, String key,
1872                    boolean retrieveFromCache) throws SystemException {
1873                    Object[] finderArgs = new Object[] { tagId, key };
1874    
1875                    Object result = null;
1876    
1877                    if (retrieveFromCache) {
1878                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_T_K,
1879                                            finderArgs, this);
1880                    }
1881    
1882                    if (result instanceof AssetTagProperty) {
1883                            AssetTagProperty assetTagProperty = (AssetTagProperty)result;
1884    
1885                            if ((tagId != assetTagProperty.getTagId()) ||
1886                                            !Validator.equals(key, assetTagProperty.getKey())) {
1887                                    result = null;
1888                            }
1889                    }
1890    
1891                    if (result == null) {
1892                            StringBundler query = new StringBundler(4);
1893    
1894                            query.append(_SQL_SELECT_ASSETTAGPROPERTY_WHERE);
1895    
1896                            query.append(_FINDER_COLUMN_T_K_TAGID_2);
1897    
1898                            if (key == null) {
1899                                    query.append(_FINDER_COLUMN_T_K_KEY_1);
1900                            }
1901                            else {
1902                                    if (key.equals(StringPool.BLANK)) {
1903                                            query.append(_FINDER_COLUMN_T_K_KEY_3);
1904                                    }
1905                                    else {
1906                                            query.append(_FINDER_COLUMN_T_K_KEY_2);
1907                                    }
1908                            }
1909    
1910                            query.append(AssetTagPropertyModelImpl.ORDER_BY_JPQL);
1911    
1912                            String sql = query.toString();
1913    
1914                            Session session = null;
1915    
1916                            try {
1917                                    session = openSession();
1918    
1919                                    Query q = session.createQuery(sql);
1920    
1921                                    QueryPos qPos = QueryPos.getInstance(q);
1922    
1923                                    qPos.add(tagId);
1924    
1925                                    if (key != null) {
1926                                            qPos.add(key);
1927                                    }
1928    
1929                                    List<AssetTagProperty> list = q.list();
1930    
1931                                    result = list;
1932    
1933                                    AssetTagProperty assetTagProperty = null;
1934    
1935                                    if (list.isEmpty()) {
1936                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_K,
1937                                                    finderArgs, list);
1938                                    }
1939                                    else {
1940                                            assetTagProperty = list.get(0);
1941    
1942                                            cacheResult(assetTagProperty);
1943    
1944                                            if ((assetTagProperty.getTagId() != tagId) ||
1945                                                            (assetTagProperty.getKey() == null) ||
1946                                                            !assetTagProperty.getKey().equals(key)) {
1947                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_K,
1948                                                            finderArgs, assetTagProperty);
1949                                            }
1950                                    }
1951    
1952                                    return assetTagProperty;
1953                            }
1954                            catch (Exception e) {
1955                                    throw processException(e);
1956                            }
1957                            finally {
1958                                    if (result == null) {
1959                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_T_K,
1960                                                    finderArgs);
1961                                    }
1962    
1963                                    closeSession(session);
1964                            }
1965                    }
1966                    else {
1967                            if (result instanceof List<?>) {
1968                                    return null;
1969                            }
1970                            else {
1971                                    return (AssetTagProperty)result;
1972                            }
1973                    }
1974            }
1975    
1976            /**
1977             * Returns all the asset tag properties.
1978             *
1979             * @return the asset tag properties
1980             * @throws SystemException if a system exception occurred
1981             */
1982            public List<AssetTagProperty> findAll() throws SystemException {
1983                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1984            }
1985    
1986            /**
1987             * Returns a range of all the asset tag properties.
1988             *
1989             * <p>
1990             * 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.
1991             * </p>
1992             *
1993             * @param start the lower bound of the range of asset tag properties
1994             * @param end the upper bound of the range of asset tag properties (not inclusive)
1995             * @return the range of asset tag properties
1996             * @throws SystemException if a system exception occurred
1997             */
1998            public List<AssetTagProperty> findAll(int start, int end)
1999                    throws SystemException {
2000                    return findAll(start, end, null);
2001            }
2002    
2003            /**
2004             * Returns an ordered range of all the asset tag properties.
2005             *
2006             * <p>
2007             * 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.
2008             * </p>
2009             *
2010             * @param start the lower bound of the range of asset tag properties
2011             * @param end the upper bound of the range of asset tag properties (not inclusive)
2012             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
2013             * @return the ordered range of asset tag properties
2014             * @throws SystemException if a system exception occurred
2015             */
2016            public List<AssetTagProperty> findAll(int start, int end,
2017                    OrderByComparator orderByComparator) throws SystemException {
2018                    FinderPath finderPath = null;
2019                    Object[] finderArgs = new Object[] { start, end, orderByComparator };
2020    
2021                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2022                                    (orderByComparator == null)) {
2023                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2024                            finderArgs = FINDER_ARGS_EMPTY;
2025                    }
2026                    else {
2027                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2028                            finderArgs = new Object[] { start, end, orderByComparator };
2029                    }
2030    
2031                    List<AssetTagProperty> list = (List<AssetTagProperty>)FinderCacheUtil.getResult(finderPath,
2032                                    finderArgs, this);
2033    
2034                    if (list == null) {
2035                            StringBundler query = null;
2036                            String sql = null;
2037    
2038                            if (orderByComparator != null) {
2039                                    query = new StringBundler(2 +
2040                                                    (orderByComparator.getOrderByFields().length * 3));
2041    
2042                                    query.append(_SQL_SELECT_ASSETTAGPROPERTY);
2043    
2044                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2045                                            orderByComparator);
2046    
2047                                    sql = query.toString();
2048                            }
2049                            else {
2050                                    sql = _SQL_SELECT_ASSETTAGPROPERTY.concat(AssetTagPropertyModelImpl.ORDER_BY_JPQL);
2051                            }
2052    
2053                            Session session = null;
2054    
2055                            try {
2056                                    session = openSession();
2057    
2058                                    Query q = session.createQuery(sql);
2059    
2060                                    if (orderByComparator == null) {
2061                                            list = (List<AssetTagProperty>)QueryUtil.list(q,
2062                                                            getDialect(), start, end, false);
2063    
2064                                            Collections.sort(list);
2065                                    }
2066                                    else {
2067                                            list = (List<AssetTagProperty>)QueryUtil.list(q,
2068                                                            getDialect(), start, end);
2069                                    }
2070                            }
2071                            catch (Exception e) {
2072                                    throw processException(e);
2073                            }
2074                            finally {
2075                                    if (list == null) {
2076                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
2077                                    }
2078                                    else {
2079                                            cacheResult(list);
2080    
2081                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
2082                                    }
2083    
2084                                    closeSession(session);
2085                            }
2086                    }
2087    
2088                    return list;
2089            }
2090    
2091            /**
2092             * Removes all the asset tag properties where companyId = &#63; from the database.
2093             *
2094             * @param companyId the company ID
2095             * @throws SystemException if a system exception occurred
2096             */
2097            public void removeByCompanyId(long companyId) throws SystemException {
2098                    for (AssetTagProperty assetTagProperty : findByCompanyId(companyId)) {
2099                            remove(assetTagProperty);
2100                    }
2101            }
2102    
2103            /**
2104             * Removes all the asset tag properties where tagId = &#63; from the database.
2105             *
2106             * @param tagId the tag ID
2107             * @throws SystemException if a system exception occurred
2108             */
2109            public void removeByTagId(long tagId) throws SystemException {
2110                    for (AssetTagProperty assetTagProperty : findByTagId(tagId)) {
2111                            remove(assetTagProperty);
2112                    }
2113            }
2114    
2115            /**
2116             * Removes all the asset tag properties where companyId = &#63; and key = &#63; from the database.
2117             *
2118             * @param companyId the company ID
2119             * @param key the key
2120             * @throws SystemException if a system exception occurred
2121             */
2122            public void removeByC_K(long companyId, String key)
2123                    throws SystemException {
2124                    for (AssetTagProperty assetTagProperty : findByC_K(companyId, key)) {
2125                            remove(assetTagProperty);
2126                    }
2127            }
2128    
2129            /**
2130             * Removes the asset tag property where tagId = &#63; and key = &#63; from the database.
2131             *
2132             * @param tagId the tag ID
2133             * @param key the key
2134             * @return the asset tag property that was removed
2135             * @throws SystemException if a system exception occurred
2136             */
2137            public AssetTagProperty removeByT_K(long tagId, String key)
2138                    throws NoSuchTagPropertyException, SystemException {
2139                    AssetTagProperty assetTagProperty = findByT_K(tagId, key);
2140    
2141                    return remove(assetTagProperty);
2142            }
2143    
2144            /**
2145             * Removes all the asset tag properties from the database.
2146             *
2147             * @throws SystemException if a system exception occurred
2148             */
2149            public void removeAll() throws SystemException {
2150                    for (AssetTagProperty assetTagProperty : findAll()) {
2151                            remove(assetTagProperty);
2152                    }
2153            }
2154    
2155            /**
2156             * Returns the number of asset tag properties where companyId = &#63;.
2157             *
2158             * @param companyId the company ID
2159             * @return the number of matching asset tag properties
2160             * @throws SystemException if a system exception occurred
2161             */
2162            public int countByCompanyId(long companyId) throws SystemException {
2163                    Object[] finderArgs = new Object[] { companyId };
2164    
2165                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
2166                                    finderArgs, this);
2167    
2168                    if (count == null) {
2169                            StringBundler query = new StringBundler(2);
2170    
2171                            query.append(_SQL_COUNT_ASSETTAGPROPERTY_WHERE);
2172    
2173                            query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2174    
2175                            String sql = query.toString();
2176    
2177                            Session session = null;
2178    
2179                            try {
2180                                    session = openSession();
2181    
2182                                    Query q = session.createQuery(sql);
2183    
2184                                    QueryPos qPos = QueryPos.getInstance(q);
2185    
2186                                    qPos.add(companyId);
2187    
2188                                    count = (Long)q.uniqueResult();
2189                            }
2190                            catch (Exception e) {
2191                                    throw processException(e);
2192                            }
2193                            finally {
2194                                    if (count == null) {
2195                                            count = Long.valueOf(0);
2196                                    }
2197    
2198                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
2199                                            finderArgs, count);
2200    
2201                                    closeSession(session);
2202                            }
2203                    }
2204    
2205                    return count.intValue();
2206            }
2207    
2208            /**
2209             * Returns the number of asset tag properties where tagId = &#63;.
2210             *
2211             * @param tagId the tag ID
2212             * @return the number of matching asset tag properties
2213             * @throws SystemException if a system exception occurred
2214             */
2215            public int countByTagId(long tagId) throws SystemException {
2216                    Object[] finderArgs = new Object[] { tagId };
2217    
2218                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_TAGID,
2219                                    finderArgs, this);
2220    
2221                    if (count == null) {
2222                            StringBundler query = new StringBundler(2);
2223    
2224                            query.append(_SQL_COUNT_ASSETTAGPROPERTY_WHERE);
2225    
2226                            query.append(_FINDER_COLUMN_TAGID_TAGID_2);
2227    
2228                            String sql = query.toString();
2229    
2230                            Session session = null;
2231    
2232                            try {
2233                                    session = openSession();
2234    
2235                                    Query q = session.createQuery(sql);
2236    
2237                                    QueryPos qPos = QueryPos.getInstance(q);
2238    
2239                                    qPos.add(tagId);
2240    
2241                                    count = (Long)q.uniqueResult();
2242                            }
2243                            catch (Exception e) {
2244                                    throw processException(e);
2245                            }
2246                            finally {
2247                                    if (count == null) {
2248                                            count = Long.valueOf(0);
2249                                    }
2250    
2251                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TAGID,
2252                                            finderArgs, count);
2253    
2254                                    closeSession(session);
2255                            }
2256                    }
2257    
2258                    return count.intValue();
2259            }
2260    
2261            /**
2262             * Returns the number of asset tag properties where companyId = &#63; and key = &#63;.
2263             *
2264             * @param companyId the company ID
2265             * @param key the key
2266             * @return the number of matching asset tag properties
2267             * @throws SystemException if a system exception occurred
2268             */
2269            public int countByC_K(long companyId, String key) throws SystemException {
2270                    Object[] finderArgs = new Object[] { companyId, key };
2271    
2272                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_K,
2273                                    finderArgs, this);
2274    
2275                    if (count == null) {
2276                            StringBundler query = new StringBundler(3);
2277    
2278                            query.append(_SQL_COUNT_ASSETTAGPROPERTY_WHERE);
2279    
2280                            query.append(_FINDER_COLUMN_C_K_COMPANYID_2);
2281    
2282                            if (key == null) {
2283                                    query.append(_FINDER_COLUMN_C_K_KEY_1);
2284                            }
2285                            else {
2286                                    if (key.equals(StringPool.BLANK)) {
2287                                            query.append(_FINDER_COLUMN_C_K_KEY_3);
2288                                    }
2289                                    else {
2290                                            query.append(_FINDER_COLUMN_C_K_KEY_2);
2291                                    }
2292                            }
2293    
2294                            String sql = query.toString();
2295    
2296                            Session session = null;
2297    
2298                            try {
2299                                    session = openSession();
2300    
2301                                    Query q = session.createQuery(sql);
2302    
2303                                    QueryPos qPos = QueryPos.getInstance(q);
2304    
2305                                    qPos.add(companyId);
2306    
2307                                    if (key != null) {
2308                                            qPos.add(key);
2309                                    }
2310    
2311                                    count = (Long)q.uniqueResult();
2312                            }
2313                            catch (Exception e) {
2314                                    throw processException(e);
2315                            }
2316                            finally {
2317                                    if (count == null) {
2318                                            count = Long.valueOf(0);
2319                                    }
2320    
2321                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_K, finderArgs,
2322                                            count);
2323    
2324                                    closeSession(session);
2325                            }
2326                    }
2327    
2328                    return count.intValue();
2329            }
2330    
2331            /**
2332             * Returns the number of asset tag properties where tagId = &#63; and key = &#63;.
2333             *
2334             * @param tagId the tag ID
2335             * @param key the key
2336             * @return the number of matching asset tag properties
2337             * @throws SystemException if a system exception occurred
2338             */
2339            public int countByT_K(long tagId, String key) throws SystemException {
2340                    Object[] finderArgs = new Object[] { tagId, key };
2341    
2342                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_T_K,
2343                                    finderArgs, this);
2344    
2345                    if (count == null) {
2346                            StringBundler query = new StringBundler(3);
2347    
2348                            query.append(_SQL_COUNT_ASSETTAGPROPERTY_WHERE);
2349    
2350                            query.append(_FINDER_COLUMN_T_K_TAGID_2);
2351    
2352                            if (key == null) {
2353                                    query.append(_FINDER_COLUMN_T_K_KEY_1);
2354                            }
2355                            else {
2356                                    if (key.equals(StringPool.BLANK)) {
2357                                            query.append(_FINDER_COLUMN_T_K_KEY_3);
2358                                    }
2359                                    else {
2360                                            query.append(_FINDER_COLUMN_T_K_KEY_2);
2361                                    }
2362                            }
2363    
2364                            String sql = query.toString();
2365    
2366                            Session session = null;
2367    
2368                            try {
2369                                    session = openSession();
2370    
2371                                    Query q = session.createQuery(sql);
2372    
2373                                    QueryPos qPos = QueryPos.getInstance(q);
2374    
2375                                    qPos.add(tagId);
2376    
2377                                    if (key != null) {
2378                                            qPos.add(key);
2379                                    }
2380    
2381                                    count = (Long)q.uniqueResult();
2382                            }
2383                            catch (Exception e) {
2384                                    throw processException(e);
2385                            }
2386                            finally {
2387                                    if (count == null) {
2388                                            count = Long.valueOf(0);
2389                                    }
2390    
2391                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_T_K, finderArgs,
2392                                            count);
2393    
2394                                    closeSession(session);
2395                            }
2396                    }
2397    
2398                    return count.intValue();
2399            }
2400    
2401            /**
2402             * Returns the number of asset tag properties.
2403             *
2404             * @return the number of asset tag properties
2405             * @throws SystemException if a system exception occurred
2406             */
2407            public int countAll() throws SystemException {
2408                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2409                                    FINDER_ARGS_EMPTY, this);
2410    
2411                    if (count == null) {
2412                            Session session = null;
2413    
2414                            try {
2415                                    session = openSession();
2416    
2417                                    Query q = session.createQuery(_SQL_COUNT_ASSETTAGPROPERTY);
2418    
2419                                    count = (Long)q.uniqueResult();
2420                            }
2421                            catch (Exception e) {
2422                                    throw processException(e);
2423                            }
2424                            finally {
2425                                    if (count == null) {
2426                                            count = Long.valueOf(0);
2427                                    }
2428    
2429                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
2430                                            FINDER_ARGS_EMPTY, count);
2431    
2432                                    closeSession(session);
2433                            }
2434                    }
2435    
2436                    return count.intValue();
2437            }
2438    
2439            /**
2440             * Initializes the asset tag property persistence.
2441             */
2442            public void afterPropertiesSet() {
2443                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2444                                            com.liferay.portal.util.PropsUtil.get(
2445                                                    "value.object.listener.com.liferay.portlet.asset.model.AssetTagProperty")));
2446    
2447                    if (listenerClassNames.length > 0) {
2448                            try {
2449                                    List<ModelListener<AssetTagProperty>> listenersList = new ArrayList<ModelListener<AssetTagProperty>>();
2450    
2451                                    for (String listenerClassName : listenerClassNames) {
2452                                            listenersList.add((ModelListener<AssetTagProperty>)InstanceFactory.newInstance(
2453                                                            listenerClassName));
2454                                    }
2455    
2456                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2457                            }
2458                            catch (Exception e) {
2459                                    _log.error(e);
2460                            }
2461                    }
2462            }
2463    
2464            public void destroy() {
2465                    EntityCacheUtil.removeCache(AssetTagPropertyImpl.class.getName());
2466                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2467                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2468            }
2469    
2470            @BeanReference(type = AssetCategoryPersistence.class)
2471            protected AssetCategoryPersistence assetCategoryPersistence;
2472            @BeanReference(type = AssetCategoryPropertyPersistence.class)
2473            protected AssetCategoryPropertyPersistence assetCategoryPropertyPersistence;
2474            @BeanReference(type = AssetEntryPersistence.class)
2475            protected AssetEntryPersistence assetEntryPersistence;
2476            @BeanReference(type = AssetLinkPersistence.class)
2477            protected AssetLinkPersistence assetLinkPersistence;
2478            @BeanReference(type = AssetTagPersistence.class)
2479            protected AssetTagPersistence assetTagPersistence;
2480            @BeanReference(type = AssetTagPropertyPersistence.class)
2481            protected AssetTagPropertyPersistence assetTagPropertyPersistence;
2482            @BeanReference(type = AssetTagStatsPersistence.class)
2483            protected AssetTagStatsPersistence assetTagStatsPersistence;
2484            @BeanReference(type = AssetVocabularyPersistence.class)
2485            protected AssetVocabularyPersistence assetVocabularyPersistence;
2486            @BeanReference(type = ResourcePersistence.class)
2487            protected ResourcePersistence resourcePersistence;
2488            @BeanReference(type = UserPersistence.class)
2489            protected UserPersistence userPersistence;
2490            private static final String _SQL_SELECT_ASSETTAGPROPERTY = "SELECT assetTagProperty FROM AssetTagProperty assetTagProperty";
2491            private static final String _SQL_SELECT_ASSETTAGPROPERTY_WHERE = "SELECT assetTagProperty FROM AssetTagProperty assetTagProperty WHERE ";
2492            private static final String _SQL_COUNT_ASSETTAGPROPERTY = "SELECT COUNT(assetTagProperty) FROM AssetTagProperty assetTagProperty";
2493            private static final String _SQL_COUNT_ASSETTAGPROPERTY_WHERE = "SELECT COUNT(assetTagProperty) FROM AssetTagProperty assetTagProperty WHERE ";
2494            private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "assetTagProperty.companyId = ?";
2495            private static final String _FINDER_COLUMN_TAGID_TAGID_2 = "assetTagProperty.tagId = ?";
2496            private static final String _FINDER_COLUMN_C_K_COMPANYID_2 = "assetTagProperty.companyId = ? AND ";
2497            private static final String _FINDER_COLUMN_C_K_KEY_1 = "assetTagProperty.key IS NULL";
2498            private static final String _FINDER_COLUMN_C_K_KEY_2 = "assetTagProperty.key = ?";
2499            private static final String _FINDER_COLUMN_C_K_KEY_3 = "(assetTagProperty.key IS NULL OR assetTagProperty.key = ?)";
2500            private static final String _FINDER_COLUMN_T_K_TAGID_2 = "assetTagProperty.tagId = ? AND ";
2501            private static final String _FINDER_COLUMN_T_K_KEY_1 = "assetTagProperty.key IS NULL";
2502            private static final String _FINDER_COLUMN_T_K_KEY_2 = "assetTagProperty.key = ?";
2503            private static final String _FINDER_COLUMN_T_K_KEY_3 = "(assetTagProperty.key IS NULL OR assetTagProperty.key = ?)";
2504            private static final String _ORDER_BY_ENTITY_ALIAS = "assetTagProperty.";
2505            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No AssetTagProperty exists with the primary key ";
2506            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No AssetTagProperty exists with the key {";
2507            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2508            private static Log _log = LogFactoryUtil.getLog(AssetTagPropertyPersistenceImpl.class);
2509            private static AssetTagProperty _nullAssetTagProperty = new AssetTagPropertyImpl() {
2510                            @Override
2511                            public Object clone() {
2512                                    return this;
2513                            }
2514    
2515                            @Override
2516                            public CacheModel<AssetTagProperty> toCacheModel() {
2517                                    return _nullAssetTagPropertyCacheModel;
2518                            }
2519                    };
2520    
2521            private static CacheModel<AssetTagProperty> _nullAssetTagPropertyCacheModel = new CacheModel<AssetTagProperty>() {
2522                            public AssetTagProperty toEntityModel() {
2523                                    return _nullAssetTagProperty;
2524                            }
2525                    };
2526    }