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