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