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