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