001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.persistence;
016    
017    import com.liferay.portal.NoSuchModelException;
018    import com.liferay.portal.NoSuchWebDAVPropsException;
019    import com.liferay.portal.kernel.annotation.BeanReference;
020    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023    import com.liferay.portal.kernel.dao.orm.FinderPath;
024    import com.liferay.portal.kernel.dao.orm.Query;
025    import com.liferay.portal.kernel.dao.orm.QueryPos;
026    import com.liferay.portal.kernel.dao.orm.QueryUtil;
027    import com.liferay.portal.kernel.dao.orm.Session;
028    import com.liferay.portal.kernel.exception.SystemException;
029    import com.liferay.portal.kernel.log.Log;
030    import com.liferay.portal.kernel.log.LogFactoryUtil;
031    import com.liferay.portal.kernel.util.GetterUtil;
032    import com.liferay.portal.kernel.util.InstanceFactory;
033    import com.liferay.portal.kernel.util.OrderByComparator;
034    import com.liferay.portal.kernel.util.StringBundler;
035    import com.liferay.portal.kernel.util.StringPool;
036    import com.liferay.portal.kernel.util.StringUtil;
037    import com.liferay.portal.model.ModelListener;
038    import com.liferay.portal.model.WebDAVProps;
039    import com.liferay.portal.model.impl.WebDAVPropsImpl;
040    import com.liferay.portal.model.impl.WebDAVPropsModelImpl;
041    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
042    
043    import java.io.Serializable;
044    
045    import java.util.ArrayList;
046    import java.util.Collections;
047    import java.util.List;
048    
049    /**
050     * The persistence implementation for the web d a v props service.
051     *
052     * <p>
053     * Never modify or reference this class directly. Always use {@link WebDAVPropsUtil} to access the web d a v props persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
054     * </p>
055     *
056     * <p>
057     * Caching information and settings can be found in <code>portal.properties</code>
058     * </p>
059     *
060     * @author Brian Wing Shun Chan
061     * @see WebDAVPropsPersistence
062     * @see WebDAVPropsUtil
063     * @generated
064     */
065    public class WebDAVPropsPersistenceImpl extends BasePersistenceImpl<WebDAVProps>
066            implements WebDAVPropsPersistence {
067            public static final String FINDER_CLASS_NAME_ENTITY = WebDAVPropsImpl.class.getName();
068            public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
069                    ".List";
070            public static final FinderPath FINDER_PATH_FETCH_BY_C_C = new FinderPath(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
071                            WebDAVPropsModelImpl.FINDER_CACHE_ENABLED,
072                            FINDER_CLASS_NAME_ENTITY, "fetchByC_C",
073                            new String[] { Long.class.getName(), Long.class.getName() });
074            public static final FinderPath FINDER_PATH_COUNT_BY_C_C = new FinderPath(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
075                            WebDAVPropsModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
076                            "countByC_C",
077                            new String[] { Long.class.getName(), Long.class.getName() });
078            public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
079                            WebDAVPropsModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
080                            "findAll", new String[0]);
081            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
082                            WebDAVPropsModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
083                            "countAll", new String[0]);
084    
085            /**
086             * Caches the web d a v props in the entity cache if it is enabled.
087             *
088             * @param webDAVProps the web d a v props to cache
089             */
090            public void cacheResult(WebDAVProps webDAVProps) {
091                    EntityCacheUtil.putResult(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
092                            WebDAVPropsImpl.class, webDAVProps.getPrimaryKey(), webDAVProps);
093    
094                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
095                            new Object[] {
096                                    new Long(webDAVProps.getClassNameId()),
097                                    new Long(webDAVProps.getClassPK())
098                            }, webDAVProps);
099            }
100    
101            /**
102             * Caches the web d a v propses in the entity cache if it is enabled.
103             *
104             * @param webDAVPropses the web d a v propses to cache
105             */
106            public void cacheResult(List<WebDAVProps> webDAVPropses) {
107                    for (WebDAVProps webDAVProps : webDAVPropses) {
108                            if (EntityCacheUtil.getResult(
109                                                    WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
110                                                    WebDAVPropsImpl.class, webDAVProps.getPrimaryKey(), this) == null) {
111                                    cacheResult(webDAVProps);
112                            }
113                    }
114            }
115    
116            /**
117             * Clears the cache for all web d a v propses.
118             *
119             * <p>
120             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
121             * </p>
122             */
123            public void clearCache() {
124                    CacheRegistryUtil.clear(WebDAVPropsImpl.class.getName());
125                    EntityCacheUtil.clearCache(WebDAVPropsImpl.class.getName());
126                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
127                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
128            }
129    
130            /**
131             * Clears the cache for the web d a v props.
132             *
133             * <p>
134             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
135             * </p>
136             */
137            public void clearCache(WebDAVProps webDAVProps) {
138                    EntityCacheUtil.removeResult(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
139                            WebDAVPropsImpl.class, webDAVProps.getPrimaryKey());
140    
141                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
142                            new Object[] {
143                                    new Long(webDAVProps.getClassNameId()),
144                                    new Long(webDAVProps.getClassPK())
145                            });
146            }
147    
148            /**
149             * Creates a new web d a v props with the primary key. Does not add the web d a v props to the database.
150             *
151             * @param webDavPropsId the primary key for the new web d a v props
152             * @return the new web d a v props
153             */
154            public WebDAVProps create(long webDavPropsId) {
155                    WebDAVProps webDAVProps = new WebDAVPropsImpl();
156    
157                    webDAVProps.setNew(true);
158                    webDAVProps.setPrimaryKey(webDavPropsId);
159    
160                    return webDAVProps;
161            }
162    
163            /**
164             * Removes the web d a v props with the primary key from the database. Also notifies the appropriate model listeners.
165             *
166             * @param primaryKey the primary key of the web d a v props to remove
167             * @return the web d a v props that was removed
168             * @throws com.liferay.portal.NoSuchModelException if a web d a v props with the primary key could not be found
169             * @throws SystemException if a system exception occurred
170             */
171            public WebDAVProps remove(Serializable primaryKey)
172                    throws NoSuchModelException, SystemException {
173                    return remove(((Long)primaryKey).longValue());
174            }
175    
176            /**
177             * Removes the web d a v props with the primary key from the database. Also notifies the appropriate model listeners.
178             *
179             * @param webDavPropsId the primary key of the web d a v props to remove
180             * @return the web d a v props that was removed
181             * @throws com.liferay.portal.NoSuchWebDAVPropsException if a web d a v props with the primary key could not be found
182             * @throws SystemException if a system exception occurred
183             */
184            public WebDAVProps remove(long webDavPropsId)
185                    throws NoSuchWebDAVPropsException, SystemException {
186                    Session session = null;
187    
188                    try {
189                            session = openSession();
190    
191                            WebDAVProps webDAVProps = (WebDAVProps)session.get(WebDAVPropsImpl.class,
192                                            new Long(webDavPropsId));
193    
194                            if (webDAVProps == null) {
195                                    if (_log.isWarnEnabled()) {
196                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + webDavPropsId);
197                                    }
198    
199                                    throw new NoSuchWebDAVPropsException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
200                                            webDavPropsId);
201                            }
202    
203                            return remove(webDAVProps);
204                    }
205                    catch (NoSuchWebDAVPropsException nsee) {
206                            throw nsee;
207                    }
208                    catch (Exception e) {
209                            throw processException(e);
210                    }
211                    finally {
212                            closeSession(session);
213                    }
214            }
215    
216            protected WebDAVProps removeImpl(WebDAVProps webDAVProps)
217                    throws SystemException {
218                    webDAVProps = toUnwrappedModel(webDAVProps);
219    
220                    Session session = null;
221    
222                    try {
223                            session = openSession();
224    
225                            if (webDAVProps.isCachedModel() || BatchSessionUtil.isEnabled()) {
226                                    Object staleObject = session.get(WebDAVPropsImpl.class,
227                                                    webDAVProps.getPrimaryKeyObj());
228    
229                                    if (staleObject != null) {
230                                            session.evict(staleObject);
231                                    }
232                            }
233    
234                            session.delete(webDAVProps);
235    
236                            session.flush();
237                    }
238                    catch (Exception e) {
239                            throw processException(e);
240                    }
241                    finally {
242                            closeSession(session);
243                    }
244    
245                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
246    
247                    WebDAVPropsModelImpl webDAVPropsModelImpl = (WebDAVPropsModelImpl)webDAVProps;
248    
249                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
250                            new Object[] {
251                                    new Long(webDAVPropsModelImpl.getOriginalClassNameId()),
252                                    new Long(webDAVPropsModelImpl.getOriginalClassPK())
253                            });
254    
255                    EntityCacheUtil.removeResult(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
256                            WebDAVPropsImpl.class, webDAVProps.getPrimaryKey());
257    
258                    return webDAVProps;
259            }
260    
261            public WebDAVProps updateImpl(
262                    com.liferay.portal.model.WebDAVProps webDAVProps, boolean merge)
263                    throws SystemException {
264                    webDAVProps = toUnwrappedModel(webDAVProps);
265    
266                    boolean isNew = webDAVProps.isNew();
267    
268                    WebDAVPropsModelImpl webDAVPropsModelImpl = (WebDAVPropsModelImpl)webDAVProps;
269    
270                    Session session = null;
271    
272                    try {
273                            session = openSession();
274    
275                            BatchSessionUtil.update(session, webDAVProps, merge);
276    
277                            webDAVProps.setNew(false);
278                    }
279                    catch (Exception e) {
280                            throw processException(e);
281                    }
282                    finally {
283                            closeSession(session);
284                    }
285    
286                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
287    
288                    EntityCacheUtil.putResult(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
289                            WebDAVPropsImpl.class, webDAVProps.getPrimaryKey(), webDAVProps);
290    
291                    if (!isNew &&
292                                    ((webDAVProps.getClassNameId() != webDAVPropsModelImpl.getOriginalClassNameId()) ||
293                                    (webDAVProps.getClassPK() != webDAVPropsModelImpl.getOriginalClassPK()))) {
294                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
295                                    new Object[] {
296                                            new Long(webDAVPropsModelImpl.getOriginalClassNameId()),
297                                            new Long(webDAVPropsModelImpl.getOriginalClassPK())
298                                    });
299                    }
300    
301                    if (isNew ||
302                                    ((webDAVProps.getClassNameId() != webDAVPropsModelImpl.getOriginalClassNameId()) ||
303                                    (webDAVProps.getClassPK() != webDAVPropsModelImpl.getOriginalClassPK()))) {
304                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
305                                    new Object[] {
306                                            new Long(webDAVProps.getClassNameId()),
307                                            new Long(webDAVProps.getClassPK())
308                                    }, webDAVProps);
309                    }
310    
311                    return webDAVProps;
312            }
313    
314            protected WebDAVProps toUnwrappedModel(WebDAVProps webDAVProps) {
315                    if (webDAVProps instanceof WebDAVPropsImpl) {
316                            return webDAVProps;
317                    }
318    
319                    WebDAVPropsImpl webDAVPropsImpl = new WebDAVPropsImpl();
320    
321                    webDAVPropsImpl.setNew(webDAVProps.isNew());
322                    webDAVPropsImpl.setPrimaryKey(webDAVProps.getPrimaryKey());
323    
324                    webDAVPropsImpl.setWebDavPropsId(webDAVProps.getWebDavPropsId());
325                    webDAVPropsImpl.setCompanyId(webDAVProps.getCompanyId());
326                    webDAVPropsImpl.setCreateDate(webDAVProps.getCreateDate());
327                    webDAVPropsImpl.setModifiedDate(webDAVProps.getModifiedDate());
328                    webDAVPropsImpl.setClassNameId(webDAVProps.getClassNameId());
329                    webDAVPropsImpl.setClassPK(webDAVProps.getClassPK());
330                    webDAVPropsImpl.setProps(webDAVProps.getProps());
331    
332                    return webDAVPropsImpl;
333            }
334    
335            /**
336             * Finds the web d a v props with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
337             *
338             * @param primaryKey the primary key of the web d a v props to find
339             * @return the web d a v props
340             * @throws com.liferay.portal.NoSuchModelException if a web d a v props with the primary key could not be found
341             * @throws SystemException if a system exception occurred
342             */
343            public WebDAVProps findByPrimaryKey(Serializable primaryKey)
344                    throws NoSuchModelException, SystemException {
345                    return findByPrimaryKey(((Long)primaryKey).longValue());
346            }
347    
348            /**
349             * Finds the web d a v props with the primary key or throws a {@link com.liferay.portal.NoSuchWebDAVPropsException} if it could not be found.
350             *
351             * @param webDavPropsId the primary key of the web d a v props to find
352             * @return the web d a v props
353             * @throws com.liferay.portal.NoSuchWebDAVPropsException if a web d a v props with the primary key could not be found
354             * @throws SystemException if a system exception occurred
355             */
356            public WebDAVProps findByPrimaryKey(long webDavPropsId)
357                    throws NoSuchWebDAVPropsException, SystemException {
358                    WebDAVProps webDAVProps = fetchByPrimaryKey(webDavPropsId);
359    
360                    if (webDAVProps == null) {
361                            if (_log.isWarnEnabled()) {
362                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + webDavPropsId);
363                            }
364    
365                            throw new NoSuchWebDAVPropsException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
366                                    webDavPropsId);
367                    }
368    
369                    return webDAVProps;
370            }
371    
372            /**
373             * Finds the web d a v props with the primary key or returns <code>null</code> if it could not be found.
374             *
375             * @param primaryKey the primary key of the web d a v props to find
376             * @return the web d a v props, or <code>null</code> if a web d a v props with the primary key could not be found
377             * @throws SystemException if a system exception occurred
378             */
379            public WebDAVProps fetchByPrimaryKey(Serializable primaryKey)
380                    throws SystemException {
381                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
382            }
383    
384            /**
385             * Finds the web d a v props with the primary key or returns <code>null</code> if it could not be found.
386             *
387             * @param webDavPropsId the primary key of the web d a v props to find
388             * @return the web d a v props, or <code>null</code> if a web d a v props with the primary key could not be found
389             * @throws SystemException if a system exception occurred
390             */
391            public WebDAVProps fetchByPrimaryKey(long webDavPropsId)
392                    throws SystemException {
393                    WebDAVProps webDAVProps = (WebDAVProps)EntityCacheUtil.getResult(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
394                                    WebDAVPropsImpl.class, webDavPropsId, this);
395    
396                    if (webDAVProps == null) {
397                            Session session = null;
398    
399                            try {
400                                    session = openSession();
401    
402                                    webDAVProps = (WebDAVProps)session.get(WebDAVPropsImpl.class,
403                                                    new Long(webDavPropsId));
404                            }
405                            catch (Exception e) {
406                                    throw processException(e);
407                            }
408                            finally {
409                                    if (webDAVProps != null) {
410                                            cacheResult(webDAVProps);
411                                    }
412    
413                                    closeSession(session);
414                            }
415                    }
416    
417                    return webDAVProps;
418            }
419    
420            /**
421             * Finds the web d a v props where classNameId = &#63; and classPK = &#63; or throws a {@link com.liferay.portal.NoSuchWebDAVPropsException} if it could not be found.
422             *
423             * @param classNameId the class name id to search with
424             * @param classPK the class p k to search with
425             * @return the matching web d a v props
426             * @throws com.liferay.portal.NoSuchWebDAVPropsException if a matching web d a v props could not be found
427             * @throws SystemException if a system exception occurred
428             */
429            public WebDAVProps findByC_C(long classNameId, long classPK)
430                    throws NoSuchWebDAVPropsException, SystemException {
431                    WebDAVProps webDAVProps = fetchByC_C(classNameId, classPK);
432    
433                    if (webDAVProps == null) {
434                            StringBundler msg = new StringBundler(6);
435    
436                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
437    
438                            msg.append("classNameId=");
439                            msg.append(classNameId);
440    
441                            msg.append(", classPK=");
442                            msg.append(classPK);
443    
444                            msg.append(StringPool.CLOSE_CURLY_BRACE);
445    
446                            if (_log.isWarnEnabled()) {
447                                    _log.warn(msg.toString());
448                            }
449    
450                            throw new NoSuchWebDAVPropsException(msg.toString());
451                    }
452    
453                    return webDAVProps;
454            }
455    
456            /**
457             * Finds the web d a v props where classNameId = &#63; and classPK = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
458             *
459             * @param classNameId the class name id to search with
460             * @param classPK the class p k to search with
461             * @return the matching web d a v props, or <code>null</code> if a matching web d a v props could not be found
462             * @throws SystemException if a system exception occurred
463             */
464            public WebDAVProps fetchByC_C(long classNameId, long classPK)
465                    throws SystemException {
466                    return fetchByC_C(classNameId, classPK, true);
467            }
468    
469            /**
470             * Finds the web d a v props where classNameId = &#63; and classPK = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
471             *
472             * @param classNameId the class name id to search with
473             * @param classPK the class p k to search with
474             * @return the matching web d a v props, or <code>null</code> if a matching web d a v props could not be found
475             * @throws SystemException if a system exception occurred
476             */
477            public WebDAVProps fetchByC_C(long classNameId, long classPK,
478                    boolean retrieveFromCache) throws SystemException {
479                    Object[] finderArgs = new Object[] { classNameId, classPK };
480    
481                    Object result = null;
482    
483                    if (retrieveFromCache) {
484                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_C,
485                                            finderArgs, this);
486                    }
487    
488                    if (result == null) {
489                            Session session = null;
490    
491                            try {
492                                    session = openSession();
493    
494                                    StringBundler query = new StringBundler(3);
495    
496                                    query.append(_SQL_SELECT_WEBDAVPROPS_WHERE);
497    
498                                    query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
499    
500                                    query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
501    
502                                    String sql = query.toString();
503    
504                                    Query q = session.createQuery(sql);
505    
506                                    QueryPos qPos = QueryPos.getInstance(q);
507    
508                                    qPos.add(classNameId);
509    
510                                    qPos.add(classPK);
511    
512                                    List<WebDAVProps> list = q.list();
513    
514                                    result = list;
515    
516                                    WebDAVProps webDAVProps = null;
517    
518                                    if (list.isEmpty()) {
519                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
520                                                    finderArgs, list);
521                                    }
522                                    else {
523                                            webDAVProps = list.get(0);
524    
525                                            cacheResult(webDAVProps);
526    
527                                            if ((webDAVProps.getClassNameId() != classNameId) ||
528                                                            (webDAVProps.getClassPK() != classPK)) {
529                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
530                                                            finderArgs, webDAVProps);
531                                            }
532                                    }
533    
534                                    return webDAVProps;
535                            }
536                            catch (Exception e) {
537                                    throw processException(e);
538                            }
539                            finally {
540                                    if (result == null) {
541                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
542                                                    finderArgs, new ArrayList<WebDAVProps>());
543                                    }
544    
545                                    closeSession(session);
546                            }
547                    }
548                    else {
549                            if (result instanceof List<?>) {
550                                    return null;
551                            }
552                            else {
553                                    return (WebDAVProps)result;
554                            }
555                    }
556            }
557    
558            /**
559             * Finds all the web d a v propses.
560             *
561             * @return the web d a v propses
562             * @throws SystemException if a system exception occurred
563             */
564            public List<WebDAVProps> findAll() throws SystemException {
565                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
566            }
567    
568            /**
569             * Finds a range of all the web d a v propses.
570             *
571             * <p>
572             * 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.
573             * </p>
574             *
575             * @param start the lower bound of the range of web d a v propses to return
576             * @param end the upper bound of the range of web d a v propses to return (not inclusive)
577             * @return the range of web d a v propses
578             * @throws SystemException if a system exception occurred
579             */
580            public List<WebDAVProps> findAll(int start, int end)
581                    throws SystemException {
582                    return findAll(start, end, null);
583            }
584    
585            /**
586             * Finds an ordered range of all the web d a v propses.
587             *
588             * <p>
589             * 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.
590             * </p>
591             *
592             * @param start the lower bound of the range of web d a v propses to return
593             * @param end the upper bound of the range of web d a v propses to return (not inclusive)
594             * @param orderByComparator the comparator to order the results by
595             * @return the ordered range of web d a v propses
596             * @throws SystemException if a system exception occurred
597             */
598            public List<WebDAVProps> findAll(int start, int end,
599                    OrderByComparator orderByComparator) throws SystemException {
600                    Object[] finderArgs = new Object[] {
601                                    String.valueOf(start), String.valueOf(end),
602                                    String.valueOf(orderByComparator)
603                            };
604    
605                    List<WebDAVProps> list = (List<WebDAVProps>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
606                                    finderArgs, this);
607    
608                    if (list == null) {
609                            Session session = null;
610    
611                            try {
612                                    session = openSession();
613    
614                                    StringBundler query = null;
615                                    String sql = null;
616    
617                                    if (orderByComparator != null) {
618                                            query = new StringBundler(2 +
619                                                            (orderByComparator.getOrderByFields().length * 3));
620    
621                                            query.append(_SQL_SELECT_WEBDAVPROPS);
622    
623                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
624                                                    orderByComparator);
625    
626                                            sql = query.toString();
627                                    }
628                                    else {
629                                            sql = _SQL_SELECT_WEBDAVPROPS;
630                                    }
631    
632                                    Query q = session.createQuery(sql);
633    
634                                    if (orderByComparator == null) {
635                                            list = (List<WebDAVProps>)QueryUtil.list(q, getDialect(),
636                                                            start, end, false);
637    
638                                            Collections.sort(list);
639                                    }
640                                    else {
641                                            list = (List<WebDAVProps>)QueryUtil.list(q, getDialect(),
642                                                            start, end);
643                                    }
644                            }
645                            catch (Exception e) {
646                                    throw processException(e);
647                            }
648                            finally {
649                                    if (list == null) {
650                                            list = new ArrayList<WebDAVProps>();
651                                    }
652    
653                                    cacheResult(list);
654    
655                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
656    
657                                    closeSession(session);
658                            }
659                    }
660    
661                    return list;
662            }
663    
664            /**
665             * Removes the web d a v props where classNameId = &#63; and classPK = &#63; from the database.
666             *
667             * @param classNameId the class name id to search with
668             * @param classPK the class p k to search with
669             * @throws SystemException if a system exception occurred
670             */
671            public void removeByC_C(long classNameId, long classPK)
672                    throws NoSuchWebDAVPropsException, SystemException {
673                    WebDAVProps webDAVProps = findByC_C(classNameId, classPK);
674    
675                    remove(webDAVProps);
676            }
677    
678            /**
679             * Removes all the web d a v propses from the database.
680             *
681             * @throws SystemException if a system exception occurred
682             */
683            public void removeAll() throws SystemException {
684                    for (WebDAVProps webDAVProps : findAll()) {
685                            remove(webDAVProps);
686                    }
687            }
688    
689            /**
690             * Counts all the web d a v propses where classNameId = &#63; and classPK = &#63;.
691             *
692             * @param classNameId the class name id to search with
693             * @param classPK the class p k to search with
694             * @return the number of matching web d a v propses
695             * @throws SystemException if a system exception occurred
696             */
697            public int countByC_C(long classNameId, long classPK)
698                    throws SystemException {
699                    Object[] finderArgs = new Object[] { classNameId, classPK };
700    
701                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
702                                    finderArgs, this);
703    
704                    if (count == null) {
705                            Session session = null;
706    
707                            try {
708                                    session = openSession();
709    
710                                    StringBundler query = new StringBundler(3);
711    
712                                    query.append(_SQL_COUNT_WEBDAVPROPS_WHERE);
713    
714                                    query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
715    
716                                    query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
717    
718                                    String sql = query.toString();
719    
720                                    Query q = session.createQuery(sql);
721    
722                                    QueryPos qPos = QueryPos.getInstance(q);
723    
724                                    qPos.add(classNameId);
725    
726                                    qPos.add(classPK);
727    
728                                    count = (Long)q.uniqueResult();
729                            }
730                            catch (Exception e) {
731                                    throw processException(e);
732                            }
733                            finally {
734                                    if (count == null) {
735                                            count = Long.valueOf(0);
736                                    }
737    
738                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
739                                            count);
740    
741                                    closeSession(session);
742                            }
743                    }
744    
745                    return count.intValue();
746            }
747    
748            /**
749             * Counts all the web d a v propses.
750             *
751             * @return the number of web d a v propses
752             * @throws SystemException if a system exception occurred
753             */
754            public int countAll() throws SystemException {
755                    Object[] finderArgs = new Object[0];
756    
757                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
758                                    finderArgs, this);
759    
760                    if (count == null) {
761                            Session session = null;
762    
763                            try {
764                                    session = openSession();
765    
766                                    Query q = session.createQuery(_SQL_COUNT_WEBDAVPROPS);
767    
768                                    count = (Long)q.uniqueResult();
769                            }
770                            catch (Exception e) {
771                                    throw processException(e);
772                            }
773                            finally {
774                                    if (count == null) {
775                                            count = Long.valueOf(0);
776                                    }
777    
778                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
779                                            count);
780    
781                                    closeSession(session);
782                            }
783                    }
784    
785                    return count.intValue();
786            }
787    
788            /**
789             * Initializes the web d a v props persistence.
790             */
791            public void afterPropertiesSet() {
792                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
793                                            com.liferay.portal.util.PropsUtil.get(
794                                                    "value.object.listener.com.liferay.portal.model.WebDAVProps")));
795    
796                    if (listenerClassNames.length > 0) {
797                            try {
798                                    List<ModelListener<WebDAVProps>> listenersList = new ArrayList<ModelListener<WebDAVProps>>();
799    
800                                    for (String listenerClassName : listenerClassNames) {
801                                            listenersList.add((ModelListener<WebDAVProps>)InstanceFactory.newInstance(
802                                                            listenerClassName));
803                                    }
804    
805                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
806                            }
807                            catch (Exception e) {
808                                    _log.error(e);
809                            }
810                    }
811            }
812    
813            @BeanReference(type = AccountPersistence.class)
814            protected AccountPersistence accountPersistence;
815            @BeanReference(type = AddressPersistence.class)
816            protected AddressPersistence addressPersistence;
817            @BeanReference(type = BrowserTrackerPersistence.class)
818            protected BrowserTrackerPersistence browserTrackerPersistence;
819            @BeanReference(type = ClassNamePersistence.class)
820            protected ClassNamePersistence classNamePersistence;
821            @BeanReference(type = ClusterGroupPersistence.class)
822            protected ClusterGroupPersistence clusterGroupPersistence;
823            @BeanReference(type = CompanyPersistence.class)
824            protected CompanyPersistence companyPersistence;
825            @BeanReference(type = ContactPersistence.class)
826            protected ContactPersistence contactPersistence;
827            @BeanReference(type = CountryPersistence.class)
828            protected CountryPersistence countryPersistence;
829            @BeanReference(type = EmailAddressPersistence.class)
830            protected EmailAddressPersistence emailAddressPersistence;
831            @BeanReference(type = GroupPersistence.class)
832            protected GroupPersistence groupPersistence;
833            @BeanReference(type = ImagePersistence.class)
834            protected ImagePersistence imagePersistence;
835            @BeanReference(type = LayoutPersistence.class)
836            protected LayoutPersistence layoutPersistence;
837            @BeanReference(type = LayoutPrototypePersistence.class)
838            protected LayoutPrototypePersistence layoutPrototypePersistence;
839            @BeanReference(type = LayoutSetPersistence.class)
840            protected LayoutSetPersistence layoutSetPersistence;
841            @BeanReference(type = LayoutSetPrototypePersistence.class)
842            protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
843            @BeanReference(type = ListTypePersistence.class)
844            protected ListTypePersistence listTypePersistence;
845            @BeanReference(type = LockPersistence.class)
846            protected LockPersistence lockPersistence;
847            @BeanReference(type = MembershipRequestPersistence.class)
848            protected MembershipRequestPersistence membershipRequestPersistence;
849            @BeanReference(type = OrganizationPersistence.class)
850            protected OrganizationPersistence organizationPersistence;
851            @BeanReference(type = OrgGroupPermissionPersistence.class)
852            protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
853            @BeanReference(type = OrgGroupRolePersistence.class)
854            protected OrgGroupRolePersistence orgGroupRolePersistence;
855            @BeanReference(type = OrgLaborPersistence.class)
856            protected OrgLaborPersistence orgLaborPersistence;
857            @BeanReference(type = PasswordPolicyPersistence.class)
858            protected PasswordPolicyPersistence passwordPolicyPersistence;
859            @BeanReference(type = PasswordPolicyRelPersistence.class)
860            protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
861            @BeanReference(type = PasswordTrackerPersistence.class)
862            protected PasswordTrackerPersistence passwordTrackerPersistence;
863            @BeanReference(type = PermissionPersistence.class)
864            protected PermissionPersistence permissionPersistence;
865            @BeanReference(type = PhonePersistence.class)
866            protected PhonePersistence phonePersistence;
867            @BeanReference(type = PluginSettingPersistence.class)
868            protected PluginSettingPersistence pluginSettingPersistence;
869            @BeanReference(type = PortletPersistence.class)
870            protected PortletPersistence portletPersistence;
871            @BeanReference(type = PortletItemPersistence.class)
872            protected PortletItemPersistence portletItemPersistence;
873            @BeanReference(type = PortletPreferencesPersistence.class)
874            protected PortletPreferencesPersistence portletPreferencesPersistence;
875            @BeanReference(type = RegionPersistence.class)
876            protected RegionPersistence regionPersistence;
877            @BeanReference(type = ReleasePersistence.class)
878            protected ReleasePersistence releasePersistence;
879            @BeanReference(type = ResourcePersistence.class)
880            protected ResourcePersistence resourcePersistence;
881            @BeanReference(type = ResourceActionPersistence.class)
882            protected ResourceActionPersistence resourceActionPersistence;
883            @BeanReference(type = ResourceCodePersistence.class)
884            protected ResourceCodePersistence resourceCodePersistence;
885            @BeanReference(type = ResourcePermissionPersistence.class)
886            protected ResourcePermissionPersistence resourcePermissionPersistence;
887            @BeanReference(type = RolePersistence.class)
888            protected RolePersistence rolePersistence;
889            @BeanReference(type = ServiceComponentPersistence.class)
890            protected ServiceComponentPersistence serviceComponentPersistence;
891            @BeanReference(type = ShardPersistence.class)
892            protected ShardPersistence shardPersistence;
893            @BeanReference(type = SubscriptionPersistence.class)
894            protected SubscriptionPersistence subscriptionPersistence;
895            @BeanReference(type = TicketPersistence.class)
896            protected TicketPersistence ticketPersistence;
897            @BeanReference(type = TeamPersistence.class)
898            protected TeamPersistence teamPersistence;
899            @BeanReference(type = UserPersistence.class)
900            protected UserPersistence userPersistence;
901            @BeanReference(type = UserGroupPersistence.class)
902            protected UserGroupPersistence userGroupPersistence;
903            @BeanReference(type = UserGroupGroupRolePersistence.class)
904            protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
905            @BeanReference(type = UserGroupRolePersistence.class)
906            protected UserGroupRolePersistence userGroupRolePersistence;
907            @BeanReference(type = UserIdMapperPersistence.class)
908            protected UserIdMapperPersistence userIdMapperPersistence;
909            @BeanReference(type = UserTrackerPersistence.class)
910            protected UserTrackerPersistence userTrackerPersistence;
911            @BeanReference(type = UserTrackerPathPersistence.class)
912            protected UserTrackerPathPersistence userTrackerPathPersistence;
913            @BeanReference(type = WebDAVPropsPersistence.class)
914            protected WebDAVPropsPersistence webDAVPropsPersistence;
915            @BeanReference(type = WebsitePersistence.class)
916            protected WebsitePersistence websitePersistence;
917            @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
918            protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
919            @BeanReference(type = WorkflowInstanceLinkPersistence.class)
920            protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
921            private static final String _SQL_SELECT_WEBDAVPROPS = "SELECT webDAVProps FROM WebDAVProps webDAVProps";
922            private static final String _SQL_SELECT_WEBDAVPROPS_WHERE = "SELECT webDAVProps FROM WebDAVProps webDAVProps WHERE ";
923            private static final String _SQL_COUNT_WEBDAVPROPS = "SELECT COUNT(webDAVProps) FROM WebDAVProps webDAVProps";
924            private static final String _SQL_COUNT_WEBDAVPROPS_WHERE = "SELECT COUNT(webDAVProps) FROM WebDAVProps webDAVProps WHERE ";
925            private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "webDAVProps.classNameId = ? AND ";
926            private static final String _FINDER_COLUMN_C_C_CLASSPK_2 = "webDAVProps.classPK = ?";
927            private static final String _ORDER_BY_ENTITY_ALIAS = "webDAVProps.";
928            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No WebDAVProps exists with the primary key ";
929            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No WebDAVProps exists with the key {";
930            private static Log _log = LogFactoryUtil.getLog(WebDAVPropsPersistenceImpl.class);
931    }