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