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.portlet.tasks.service.persistence;
016    
017    import com.liferay.portal.NoSuchModelException;
018    import com.liferay.portal.kernel.annotation.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.ModelListener;
037    import com.liferay.portal.service.persistence.BatchSessionUtil;
038    import com.liferay.portal.service.persistence.ResourcePersistence;
039    import com.liferay.portal.service.persistence.UserPersistence;
040    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
041    
042    import com.liferay.portlet.social.service.persistence.SocialActivityPersistence;
043    import com.liferay.portlet.tasks.NoSuchReviewException;
044    import com.liferay.portlet.tasks.model.TasksReview;
045    import com.liferay.portlet.tasks.model.impl.TasksReviewImpl;
046    import com.liferay.portlet.tasks.model.impl.TasksReviewModelImpl;
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 tasks review service.
056     *
057     * <p>
058     * Never modify or reference this class directly. Always use {@link TasksReviewUtil} to access the tasks review persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
059     * </p>
060     *
061     * <p>
062     * Caching information and settings can be found in <code>portal.properties</code>
063     * </p>
064     *
065     * @author Brian Wing Shun Chan
066     * @see TasksReviewPersistence
067     * @see TasksReviewUtil
068     * @generated
069     */
070    public class TasksReviewPersistenceImpl extends BasePersistenceImpl<TasksReview>
071            implements TasksReviewPersistence {
072            public static final String FINDER_CLASS_NAME_ENTITY = TasksReviewImpl.class.getName();
073            public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
074                    ".List";
075            public static final FinderPath FINDER_PATH_FIND_BY_USERID = new FinderPath(TasksReviewModelImpl.ENTITY_CACHE_ENABLED,
076                            TasksReviewModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
077                            "findByUserId",
078                            new String[] {
079                                    Long.class.getName(),
080                                    
081                            "java.lang.Integer", "java.lang.Integer",
082                                    "com.liferay.portal.kernel.util.OrderByComparator"
083                            });
084            public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(TasksReviewModelImpl.ENTITY_CACHE_ENABLED,
085                            TasksReviewModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
086                            "countByUserId", new String[] { Long.class.getName() });
087            public static final FinderPath FINDER_PATH_FIND_BY_PROPOSALID = new FinderPath(TasksReviewModelImpl.ENTITY_CACHE_ENABLED,
088                            TasksReviewModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
089                            "findByProposalId",
090                            new String[] {
091                                    Long.class.getName(),
092                                    
093                            "java.lang.Integer", "java.lang.Integer",
094                                    "com.liferay.portal.kernel.util.OrderByComparator"
095                            });
096            public static final FinderPath FINDER_PATH_COUNT_BY_PROPOSALID = new FinderPath(TasksReviewModelImpl.ENTITY_CACHE_ENABLED,
097                            TasksReviewModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
098                            "countByProposalId", new String[] { Long.class.getName() });
099            public static final FinderPath FINDER_PATH_FETCH_BY_U_P = new FinderPath(TasksReviewModelImpl.ENTITY_CACHE_ENABLED,
100                            TasksReviewModelImpl.FINDER_CACHE_ENABLED,
101                            FINDER_CLASS_NAME_ENTITY, "fetchByU_P",
102                            new String[] { Long.class.getName(), Long.class.getName() });
103            public static final FinderPath FINDER_PATH_COUNT_BY_U_P = new FinderPath(TasksReviewModelImpl.ENTITY_CACHE_ENABLED,
104                            TasksReviewModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
105                            "countByU_P",
106                            new String[] { Long.class.getName(), Long.class.getName() });
107            public static final FinderPath FINDER_PATH_FIND_BY_P_S = new FinderPath(TasksReviewModelImpl.ENTITY_CACHE_ENABLED,
108                            TasksReviewModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
109                            "findByP_S",
110                            new String[] {
111                                    Long.class.getName(), Integer.class.getName(),
112                                    
113                            "java.lang.Integer", "java.lang.Integer",
114                                    "com.liferay.portal.kernel.util.OrderByComparator"
115                            });
116            public static final FinderPath FINDER_PATH_COUNT_BY_P_S = new FinderPath(TasksReviewModelImpl.ENTITY_CACHE_ENABLED,
117                            TasksReviewModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
118                            "countByP_S",
119                            new String[] { Long.class.getName(), Integer.class.getName() });
120            public static final FinderPath FINDER_PATH_FIND_BY_P_S_C = new FinderPath(TasksReviewModelImpl.ENTITY_CACHE_ENABLED,
121                            TasksReviewModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
122                            "findByP_S_C",
123                            new String[] {
124                                    Long.class.getName(), Integer.class.getName(),
125                                    Boolean.class.getName(),
126                                    
127                            "java.lang.Integer", "java.lang.Integer",
128                                    "com.liferay.portal.kernel.util.OrderByComparator"
129                            });
130            public static final FinderPath FINDER_PATH_COUNT_BY_P_S_C = new FinderPath(TasksReviewModelImpl.ENTITY_CACHE_ENABLED,
131                            TasksReviewModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
132                            "countByP_S_C",
133                            new String[] {
134                                    Long.class.getName(), Integer.class.getName(),
135                                    Boolean.class.getName()
136                            });
137            public static final FinderPath FINDER_PATH_FIND_BY_P_S_C_R = new FinderPath(TasksReviewModelImpl.ENTITY_CACHE_ENABLED,
138                            TasksReviewModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
139                            "findByP_S_C_R",
140                            new String[] {
141                                    Long.class.getName(), Integer.class.getName(),
142                                    Boolean.class.getName(), Boolean.class.getName(),
143                                    
144                            "java.lang.Integer", "java.lang.Integer",
145                                    "com.liferay.portal.kernel.util.OrderByComparator"
146                            });
147            public static final FinderPath FINDER_PATH_COUNT_BY_P_S_C_R = new FinderPath(TasksReviewModelImpl.ENTITY_CACHE_ENABLED,
148                            TasksReviewModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
149                            "countByP_S_C_R",
150                            new String[] {
151                                    Long.class.getName(), Integer.class.getName(),
152                                    Boolean.class.getName(), Boolean.class.getName()
153                            });
154            public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(TasksReviewModelImpl.ENTITY_CACHE_ENABLED,
155                            TasksReviewModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
156                            "findAll", new String[0]);
157            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(TasksReviewModelImpl.ENTITY_CACHE_ENABLED,
158                            TasksReviewModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
159                            "countAll", new String[0]);
160    
161            /**
162             * Caches the tasks review in the entity cache if it is enabled.
163             *
164             * @param tasksReview the tasks review to cache
165             */
166            public void cacheResult(TasksReview tasksReview) {
167                    EntityCacheUtil.putResult(TasksReviewModelImpl.ENTITY_CACHE_ENABLED,
168                            TasksReviewImpl.class, tasksReview.getPrimaryKey(), tasksReview);
169    
170                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_P,
171                            new Object[] {
172                                    new Long(tasksReview.getUserId()),
173                                    new Long(tasksReview.getProposalId())
174                            }, tasksReview);
175            }
176    
177            /**
178             * Caches the tasks reviews in the entity cache if it is enabled.
179             *
180             * @param tasksReviews the tasks reviews to cache
181             */
182            public void cacheResult(List<TasksReview> tasksReviews) {
183                    for (TasksReview tasksReview : tasksReviews) {
184                            if (EntityCacheUtil.getResult(
185                                                    TasksReviewModelImpl.ENTITY_CACHE_ENABLED,
186                                                    TasksReviewImpl.class, tasksReview.getPrimaryKey(), this) == null) {
187                                    cacheResult(tasksReview);
188                            }
189                    }
190            }
191    
192            /**
193             * Clears the cache for all tasks reviews.
194             *
195             * <p>
196             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
197             * </p>
198             */
199            public void clearCache() {
200                    CacheRegistryUtil.clear(TasksReviewImpl.class.getName());
201                    EntityCacheUtil.clearCache(TasksReviewImpl.class.getName());
202                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
203                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
204            }
205    
206            /**
207             * Clears the cache for the tasks review.
208             *
209             * <p>
210             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
211             * </p>
212             */
213            public void clearCache(TasksReview tasksReview) {
214                    EntityCacheUtil.removeResult(TasksReviewModelImpl.ENTITY_CACHE_ENABLED,
215                            TasksReviewImpl.class, tasksReview.getPrimaryKey());
216    
217                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_U_P,
218                            new Object[] {
219                                    new Long(tasksReview.getUserId()),
220                                    new Long(tasksReview.getProposalId())
221                            });
222            }
223    
224            /**
225             * Creates a new tasks review with the primary key. Does not add the tasks review to the database.
226             *
227             * @param reviewId the primary key for the new tasks review
228             * @return the new tasks review
229             */
230            public TasksReview create(long reviewId) {
231                    TasksReview tasksReview = new TasksReviewImpl();
232    
233                    tasksReview.setNew(true);
234                    tasksReview.setPrimaryKey(reviewId);
235    
236                    return tasksReview;
237            }
238    
239            /**
240             * Removes the tasks review with the primary key from the database. Also notifies the appropriate model listeners.
241             *
242             * @param primaryKey the primary key of the tasks review to remove
243             * @return the tasks review that was removed
244             * @throws com.liferay.portal.NoSuchModelException if a tasks review with the primary key could not be found
245             * @throws SystemException if a system exception occurred
246             */
247            public TasksReview remove(Serializable primaryKey)
248                    throws NoSuchModelException, SystemException {
249                    return remove(((Long)primaryKey).longValue());
250            }
251    
252            /**
253             * Removes the tasks review with the primary key from the database. Also notifies the appropriate model listeners.
254             *
255             * @param reviewId the primary key of the tasks review to remove
256             * @return the tasks review that was removed
257             * @throws com.liferay.portlet.tasks.NoSuchReviewException if a tasks review with the primary key could not be found
258             * @throws SystemException if a system exception occurred
259             */
260            public TasksReview remove(long reviewId)
261                    throws NoSuchReviewException, SystemException {
262                    Session session = null;
263    
264                    try {
265                            session = openSession();
266    
267                            TasksReview tasksReview = (TasksReview)session.get(TasksReviewImpl.class,
268                                            new Long(reviewId));
269    
270                            if (tasksReview == null) {
271                                    if (_log.isWarnEnabled()) {
272                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + reviewId);
273                                    }
274    
275                                    throw new NoSuchReviewException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
276                                            reviewId);
277                            }
278    
279                            return remove(tasksReview);
280                    }
281                    catch (NoSuchReviewException nsee) {
282                            throw nsee;
283                    }
284                    catch (Exception e) {
285                            throw processException(e);
286                    }
287                    finally {
288                            closeSession(session);
289                    }
290            }
291    
292            protected TasksReview removeImpl(TasksReview tasksReview)
293                    throws SystemException {
294                    tasksReview = toUnwrappedModel(tasksReview);
295    
296                    Session session = null;
297    
298                    try {
299                            session = openSession();
300    
301                            if (tasksReview.isCachedModel() || BatchSessionUtil.isEnabled()) {
302                                    Object staleObject = session.get(TasksReviewImpl.class,
303                                                    tasksReview.getPrimaryKeyObj());
304    
305                                    if (staleObject != null) {
306                                            session.evict(staleObject);
307                                    }
308                            }
309    
310                            session.delete(tasksReview);
311    
312                            session.flush();
313                    }
314                    catch (Exception e) {
315                            throw processException(e);
316                    }
317                    finally {
318                            closeSession(session);
319                    }
320    
321                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
322    
323                    TasksReviewModelImpl tasksReviewModelImpl = (TasksReviewModelImpl)tasksReview;
324    
325                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_U_P,
326                            new Object[] {
327                                    new Long(tasksReviewModelImpl.getOriginalUserId()),
328                                    new Long(tasksReviewModelImpl.getOriginalProposalId())
329                            });
330    
331                    EntityCacheUtil.removeResult(TasksReviewModelImpl.ENTITY_CACHE_ENABLED,
332                            TasksReviewImpl.class, tasksReview.getPrimaryKey());
333    
334                    return tasksReview;
335            }
336    
337            public TasksReview updateImpl(
338                    com.liferay.portlet.tasks.model.TasksReview tasksReview, boolean merge)
339                    throws SystemException {
340                    tasksReview = toUnwrappedModel(tasksReview);
341    
342                    boolean isNew = tasksReview.isNew();
343    
344                    TasksReviewModelImpl tasksReviewModelImpl = (TasksReviewModelImpl)tasksReview;
345    
346                    Session session = null;
347    
348                    try {
349                            session = openSession();
350    
351                            BatchSessionUtil.update(session, tasksReview, merge);
352    
353                            tasksReview.setNew(false);
354                    }
355                    catch (Exception e) {
356                            throw processException(e);
357                    }
358                    finally {
359                            closeSession(session);
360                    }
361    
362                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
363    
364                    EntityCacheUtil.putResult(TasksReviewModelImpl.ENTITY_CACHE_ENABLED,
365                            TasksReviewImpl.class, tasksReview.getPrimaryKey(), tasksReview);
366    
367                    if (!isNew &&
368                                    ((tasksReview.getUserId() != tasksReviewModelImpl.getOriginalUserId()) ||
369                                    (tasksReview.getProposalId() != tasksReviewModelImpl.getOriginalProposalId()))) {
370                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_U_P,
371                                    new Object[] {
372                                            new Long(tasksReviewModelImpl.getOriginalUserId()),
373                                            new Long(tasksReviewModelImpl.getOriginalProposalId())
374                                    });
375                    }
376    
377                    if (isNew ||
378                                    ((tasksReview.getUserId() != tasksReviewModelImpl.getOriginalUserId()) ||
379                                    (tasksReview.getProposalId() != tasksReviewModelImpl.getOriginalProposalId()))) {
380                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_P,
381                                    new Object[] {
382                                            new Long(tasksReview.getUserId()),
383                                            new Long(tasksReview.getProposalId())
384                                    }, tasksReview);
385                    }
386    
387                    return tasksReview;
388            }
389    
390            protected TasksReview toUnwrappedModel(TasksReview tasksReview) {
391                    if (tasksReview instanceof TasksReviewImpl) {
392                            return tasksReview;
393                    }
394    
395                    TasksReviewImpl tasksReviewImpl = new TasksReviewImpl();
396    
397                    tasksReviewImpl.setNew(tasksReview.isNew());
398                    tasksReviewImpl.setPrimaryKey(tasksReview.getPrimaryKey());
399    
400                    tasksReviewImpl.setReviewId(tasksReview.getReviewId());
401                    tasksReviewImpl.setGroupId(tasksReview.getGroupId());
402                    tasksReviewImpl.setCompanyId(tasksReview.getCompanyId());
403                    tasksReviewImpl.setUserId(tasksReview.getUserId());
404                    tasksReviewImpl.setUserName(tasksReview.getUserName());
405                    tasksReviewImpl.setCreateDate(tasksReview.getCreateDate());
406                    tasksReviewImpl.setModifiedDate(tasksReview.getModifiedDate());
407                    tasksReviewImpl.setProposalId(tasksReview.getProposalId());
408                    tasksReviewImpl.setAssignedByUserId(tasksReview.getAssignedByUserId());
409                    tasksReviewImpl.setAssignedByUserName(tasksReview.getAssignedByUserName());
410                    tasksReviewImpl.setStage(tasksReview.getStage());
411                    tasksReviewImpl.setCompleted(tasksReview.isCompleted());
412                    tasksReviewImpl.setRejected(tasksReview.isRejected());
413    
414                    return tasksReviewImpl;
415            }
416    
417            /**
418             * Finds the tasks review with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
419             *
420             * @param primaryKey the primary key of the tasks review to find
421             * @return the tasks review
422             * @throws com.liferay.portal.NoSuchModelException if a tasks review with the primary key could not be found
423             * @throws SystemException if a system exception occurred
424             */
425            public TasksReview findByPrimaryKey(Serializable primaryKey)
426                    throws NoSuchModelException, SystemException {
427                    return findByPrimaryKey(((Long)primaryKey).longValue());
428            }
429    
430            /**
431             * Finds the tasks review with the primary key or throws a {@link com.liferay.portlet.tasks.NoSuchReviewException} if it could not be found.
432             *
433             * @param reviewId the primary key of the tasks review to find
434             * @return the tasks review
435             * @throws com.liferay.portlet.tasks.NoSuchReviewException if a tasks review with the primary key could not be found
436             * @throws SystemException if a system exception occurred
437             */
438            public TasksReview findByPrimaryKey(long reviewId)
439                    throws NoSuchReviewException, SystemException {
440                    TasksReview tasksReview = fetchByPrimaryKey(reviewId);
441    
442                    if (tasksReview == null) {
443                            if (_log.isWarnEnabled()) {
444                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + reviewId);
445                            }
446    
447                            throw new NoSuchReviewException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
448                                    reviewId);
449                    }
450    
451                    return tasksReview;
452            }
453    
454            /**
455             * Finds the tasks review with the primary key or returns <code>null</code> if it could not be found.
456             *
457             * @param primaryKey the primary key of the tasks review to find
458             * @return the tasks review, or <code>null</code> if a tasks review with the primary key could not be found
459             * @throws SystemException if a system exception occurred
460             */
461            public TasksReview fetchByPrimaryKey(Serializable primaryKey)
462                    throws SystemException {
463                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
464            }
465    
466            /**
467             * Finds the tasks review with the primary key or returns <code>null</code> if it could not be found.
468             *
469             * @param reviewId the primary key of the tasks review to find
470             * @return the tasks review, or <code>null</code> if a tasks review with the primary key could not be found
471             * @throws SystemException if a system exception occurred
472             */
473            public TasksReview fetchByPrimaryKey(long reviewId)
474                    throws SystemException {
475                    TasksReview tasksReview = (TasksReview)EntityCacheUtil.getResult(TasksReviewModelImpl.ENTITY_CACHE_ENABLED,
476                                    TasksReviewImpl.class, reviewId, this);
477    
478                    if (tasksReview == null) {
479                            Session session = null;
480    
481                            try {
482                                    session = openSession();
483    
484                                    tasksReview = (TasksReview)session.get(TasksReviewImpl.class,
485                                                    new Long(reviewId));
486                            }
487                            catch (Exception e) {
488                                    throw processException(e);
489                            }
490                            finally {
491                                    if (tasksReview != null) {
492                                            cacheResult(tasksReview);
493                                    }
494    
495                                    closeSession(session);
496                            }
497                    }
498    
499                    return tasksReview;
500            }
501    
502            /**
503             * Finds all the tasks reviews where userId = &#63;.
504             *
505             * @param userId the user id to search with
506             * @return the matching tasks reviews
507             * @throws SystemException if a system exception occurred
508             */
509            public List<TasksReview> findByUserId(long userId)
510                    throws SystemException {
511                    return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
512            }
513    
514            /**
515             * Finds a range of all the tasks reviews where userId = &#63;.
516             *
517             * <p>
518             * 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.
519             * </p>
520             *
521             * @param userId the user id to search with
522             * @param start the lower bound of the range of tasks reviews to return
523             * @param end the upper bound of the range of tasks reviews to return (not inclusive)
524             * @return the range of matching tasks reviews
525             * @throws SystemException if a system exception occurred
526             */
527            public List<TasksReview> findByUserId(long userId, int start, int end)
528                    throws SystemException {
529                    return findByUserId(userId, start, end, null);
530            }
531    
532            /**
533             * Finds an ordered range of all the tasks reviews where userId = &#63;.
534             *
535             * <p>
536             * 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.
537             * </p>
538             *
539             * @param userId the user id to search with
540             * @param start the lower bound of the range of tasks reviews to return
541             * @param end the upper bound of the range of tasks reviews to return (not inclusive)
542             * @param orderByComparator the comparator to order the results by
543             * @return the ordered range of matching tasks reviews
544             * @throws SystemException if a system exception occurred
545             */
546            public List<TasksReview> findByUserId(long userId, int start, int end,
547                    OrderByComparator orderByComparator) throws SystemException {
548                    Object[] finderArgs = new Object[] {
549                                    userId,
550                                    
551                                    String.valueOf(start), String.valueOf(end),
552                                    String.valueOf(orderByComparator)
553                            };
554    
555                    List<TasksReview> list = (List<TasksReview>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_USERID,
556                                    finderArgs, this);
557    
558                    if (list == null) {
559                            Session session = null;
560    
561                            try {
562                                    session = openSession();
563    
564                                    StringBundler query = null;
565    
566                                    if (orderByComparator != null) {
567                                            query = new StringBundler(3 +
568                                                            (orderByComparator.getOrderByFields().length * 3));
569                                    }
570                                    else {
571                                            query = new StringBundler(3);
572                                    }
573    
574                                    query.append(_SQL_SELECT_TASKSREVIEW_WHERE);
575    
576                                    query.append(_FINDER_COLUMN_USERID_USERID_2);
577    
578                                    if (orderByComparator != null) {
579                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
580                                                    orderByComparator);
581                                    }
582    
583                                    else {
584                                            query.append(TasksReviewModelImpl.ORDER_BY_JPQL);
585                                    }
586    
587                                    String sql = query.toString();
588    
589                                    Query q = session.createQuery(sql);
590    
591                                    QueryPos qPos = QueryPos.getInstance(q);
592    
593                                    qPos.add(userId);
594    
595                                    list = (List<TasksReview>)QueryUtil.list(q, getDialect(),
596                                                    start, end);
597                            }
598                            catch (Exception e) {
599                                    throw processException(e);
600                            }
601                            finally {
602                                    if (list == null) {
603                                            list = new ArrayList<TasksReview>();
604                                    }
605    
606                                    cacheResult(list);
607    
608                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_USERID,
609                                            finderArgs, list);
610    
611                                    closeSession(session);
612                            }
613                    }
614    
615                    return list;
616            }
617    
618            /**
619             * Finds the first tasks review in the ordered set where userId = &#63;.
620             *
621             * <p>
622             * 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.
623             * </p>
624             *
625             * @param userId the user id to search with
626             * @param orderByComparator the comparator to order the set by
627             * @return the first matching tasks review
628             * @throws com.liferay.portlet.tasks.NoSuchReviewException if a matching tasks review could not be found
629             * @throws SystemException if a system exception occurred
630             */
631            public TasksReview findByUserId_First(long userId,
632                    OrderByComparator orderByComparator)
633                    throws NoSuchReviewException, SystemException {
634                    List<TasksReview> list = findByUserId(userId, 0, 1, orderByComparator);
635    
636                    if (list.isEmpty()) {
637                            StringBundler msg = new StringBundler(4);
638    
639                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
640    
641                            msg.append("userId=");
642                            msg.append(userId);
643    
644                            msg.append(StringPool.CLOSE_CURLY_BRACE);
645    
646                            throw new NoSuchReviewException(msg.toString());
647                    }
648                    else {
649                            return list.get(0);
650                    }
651            }
652    
653            /**
654             * Finds the last tasks review in the ordered set where userId = &#63;.
655             *
656             * <p>
657             * 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.
658             * </p>
659             *
660             * @param userId the user id to search with
661             * @param orderByComparator the comparator to order the set by
662             * @return the last matching tasks review
663             * @throws com.liferay.portlet.tasks.NoSuchReviewException if a matching tasks review could not be found
664             * @throws SystemException if a system exception occurred
665             */
666            public TasksReview findByUserId_Last(long userId,
667                    OrderByComparator orderByComparator)
668                    throws NoSuchReviewException, SystemException {
669                    int count = countByUserId(userId);
670    
671                    List<TasksReview> list = findByUserId(userId, count - 1, count,
672                                    orderByComparator);
673    
674                    if (list.isEmpty()) {
675                            StringBundler msg = new StringBundler(4);
676    
677                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
678    
679                            msg.append("userId=");
680                            msg.append(userId);
681    
682                            msg.append(StringPool.CLOSE_CURLY_BRACE);
683    
684                            throw new NoSuchReviewException(msg.toString());
685                    }
686                    else {
687                            return list.get(0);
688                    }
689            }
690    
691            /**
692             * Finds the tasks reviews before and after the current tasks review in the ordered set where userId = &#63;.
693             *
694             * <p>
695             * 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.
696             * </p>
697             *
698             * @param reviewId the primary key of the current tasks review
699             * @param userId the user id to search with
700             * @param orderByComparator the comparator to order the set by
701             * @return the previous, current, and next tasks review
702             * @throws com.liferay.portlet.tasks.NoSuchReviewException if a tasks review with the primary key could not be found
703             * @throws SystemException if a system exception occurred
704             */
705            public TasksReview[] findByUserId_PrevAndNext(long reviewId, long userId,
706                    OrderByComparator orderByComparator)
707                    throws NoSuchReviewException, SystemException {
708                    TasksReview tasksReview = findByPrimaryKey(reviewId);
709    
710                    Session session = null;
711    
712                    try {
713                            session = openSession();
714    
715                            TasksReview[] array = new TasksReviewImpl[3];
716    
717                            array[0] = getByUserId_PrevAndNext(session, tasksReview, userId,
718                                            orderByComparator, true);
719    
720                            array[1] = tasksReview;
721    
722                            array[2] = getByUserId_PrevAndNext(session, tasksReview, userId,
723                                            orderByComparator, false);
724    
725                            return array;
726                    }
727                    catch (Exception e) {
728                            throw processException(e);
729                    }
730                    finally {
731                            closeSession(session);
732                    }
733            }
734    
735            protected TasksReview getByUserId_PrevAndNext(Session session,
736                    TasksReview tasksReview, long userId,
737                    OrderByComparator orderByComparator, boolean previous) {
738                    StringBundler query = null;
739    
740                    if (orderByComparator != null) {
741                            query = new StringBundler(6 +
742                                            (orderByComparator.getOrderByFields().length * 6));
743                    }
744                    else {
745                            query = new StringBundler(3);
746                    }
747    
748                    query.append(_SQL_SELECT_TASKSREVIEW_WHERE);
749    
750                    query.append(_FINDER_COLUMN_USERID_USERID_2);
751    
752                    if (orderByComparator != null) {
753                            String[] orderByFields = orderByComparator.getOrderByFields();
754    
755                            if (orderByFields.length > 0) {
756                                    query.append(WHERE_AND);
757                            }
758    
759                            for (int i = 0; i < orderByFields.length; i++) {
760                                    query.append(_ORDER_BY_ENTITY_ALIAS);
761                                    query.append(orderByFields[i]);
762    
763                                    if ((i + 1) < orderByFields.length) {
764                                            if (orderByComparator.isAscending() ^ previous) {
765                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
766                                            }
767                                            else {
768                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
769                                            }
770                                    }
771                                    else {
772                                            if (orderByComparator.isAscending() ^ previous) {
773                                                    query.append(WHERE_GREATER_THAN);
774                                            }
775                                            else {
776                                                    query.append(WHERE_LESSER_THAN);
777                                            }
778                                    }
779                            }
780    
781                            query.append(ORDER_BY_CLAUSE);
782    
783                            for (int i = 0; i < orderByFields.length; i++) {
784                                    query.append(_ORDER_BY_ENTITY_ALIAS);
785                                    query.append(orderByFields[i]);
786    
787                                    if ((i + 1) < orderByFields.length) {
788                                            if (orderByComparator.isAscending() ^ previous) {
789                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
790                                            }
791                                            else {
792                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
793                                            }
794                                    }
795                                    else {
796                                            if (orderByComparator.isAscending() ^ previous) {
797                                                    query.append(ORDER_BY_ASC);
798                                            }
799                                            else {
800                                                    query.append(ORDER_BY_DESC);
801                                            }
802                                    }
803                            }
804                    }
805    
806                    else {
807                            query.append(TasksReviewModelImpl.ORDER_BY_JPQL);
808                    }
809    
810                    String sql = query.toString();
811    
812                    Query q = session.createQuery(sql);
813    
814                    q.setFirstResult(0);
815                    q.setMaxResults(2);
816    
817                    QueryPos qPos = QueryPos.getInstance(q);
818    
819                    qPos.add(userId);
820    
821                    if (orderByComparator != null) {
822                            Object[] values = orderByComparator.getOrderByValues(tasksReview);
823    
824                            for (Object value : values) {
825                                    qPos.add(value);
826                            }
827                    }
828    
829                    List<TasksReview> list = q.list();
830    
831                    if (list.size() == 2) {
832                            return list.get(1);
833                    }
834                    else {
835                            return null;
836                    }
837            }
838    
839            /**
840             * Finds all the tasks reviews where proposalId = &#63;.
841             *
842             * @param proposalId the proposal id to search with
843             * @return the matching tasks reviews
844             * @throws SystemException if a system exception occurred
845             */
846            public List<TasksReview> findByProposalId(long proposalId)
847                    throws SystemException {
848                    return findByProposalId(proposalId, QueryUtil.ALL_POS,
849                            QueryUtil.ALL_POS, null);
850            }
851    
852            /**
853             * Finds a range of all the tasks reviews where proposalId = &#63;.
854             *
855             * <p>
856             * 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.
857             * </p>
858             *
859             * @param proposalId the proposal id to search with
860             * @param start the lower bound of the range of tasks reviews to return
861             * @param end the upper bound of the range of tasks reviews to return (not inclusive)
862             * @return the range of matching tasks reviews
863             * @throws SystemException if a system exception occurred
864             */
865            public List<TasksReview> findByProposalId(long proposalId, int start,
866                    int end) throws SystemException {
867                    return findByProposalId(proposalId, start, end, null);
868            }
869    
870            /**
871             * Finds an ordered range of all the tasks reviews where proposalId = &#63;.
872             *
873             * <p>
874             * 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.
875             * </p>
876             *
877             * @param proposalId the proposal id to search with
878             * @param start the lower bound of the range of tasks reviews to return
879             * @param end the upper bound of the range of tasks reviews to return (not inclusive)
880             * @param orderByComparator the comparator to order the results by
881             * @return the ordered range of matching tasks reviews
882             * @throws SystemException if a system exception occurred
883             */
884            public List<TasksReview> findByProposalId(long proposalId, int start,
885                    int end, OrderByComparator orderByComparator) throws SystemException {
886                    Object[] finderArgs = new Object[] {
887                                    proposalId,
888                                    
889                                    String.valueOf(start), String.valueOf(end),
890                                    String.valueOf(orderByComparator)
891                            };
892    
893                    List<TasksReview> list = (List<TasksReview>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_PROPOSALID,
894                                    finderArgs, this);
895    
896                    if (list == null) {
897                            Session session = null;
898    
899                            try {
900                                    session = openSession();
901    
902                                    StringBundler query = null;
903    
904                                    if (orderByComparator != null) {
905                                            query = new StringBundler(3 +
906                                                            (orderByComparator.getOrderByFields().length * 3));
907                                    }
908                                    else {
909                                            query = new StringBundler(3);
910                                    }
911    
912                                    query.append(_SQL_SELECT_TASKSREVIEW_WHERE);
913    
914                                    query.append(_FINDER_COLUMN_PROPOSALID_PROPOSALID_2);
915    
916                                    if (orderByComparator != null) {
917                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
918                                                    orderByComparator);
919                                    }
920    
921                                    else {
922                                            query.append(TasksReviewModelImpl.ORDER_BY_JPQL);
923                                    }
924    
925                                    String sql = query.toString();
926    
927                                    Query q = session.createQuery(sql);
928    
929                                    QueryPos qPos = QueryPos.getInstance(q);
930    
931                                    qPos.add(proposalId);
932    
933                                    list = (List<TasksReview>)QueryUtil.list(q, getDialect(),
934                                                    start, end);
935                            }
936                            catch (Exception e) {
937                                    throw processException(e);
938                            }
939                            finally {
940                                    if (list == null) {
941                                            list = new ArrayList<TasksReview>();
942                                    }
943    
944                                    cacheResult(list);
945    
946                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_PROPOSALID,
947                                            finderArgs, list);
948    
949                                    closeSession(session);
950                            }
951                    }
952    
953                    return list;
954            }
955    
956            /**
957             * Finds the first tasks review in the ordered set where proposalId = &#63;.
958             *
959             * <p>
960             * 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.
961             * </p>
962             *
963             * @param proposalId the proposal id to search with
964             * @param orderByComparator the comparator to order the set by
965             * @return the first matching tasks review
966             * @throws com.liferay.portlet.tasks.NoSuchReviewException if a matching tasks review could not be found
967             * @throws SystemException if a system exception occurred
968             */
969            public TasksReview findByProposalId_First(long proposalId,
970                    OrderByComparator orderByComparator)
971                    throws NoSuchReviewException, SystemException {
972                    List<TasksReview> list = findByProposalId(proposalId, 0, 1,
973                                    orderByComparator);
974    
975                    if (list.isEmpty()) {
976                            StringBundler msg = new StringBundler(4);
977    
978                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
979    
980                            msg.append("proposalId=");
981                            msg.append(proposalId);
982    
983                            msg.append(StringPool.CLOSE_CURLY_BRACE);
984    
985                            throw new NoSuchReviewException(msg.toString());
986                    }
987                    else {
988                            return list.get(0);
989                    }
990            }
991    
992            /**
993             * Finds the last tasks review in the ordered set where proposalId = &#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 proposalId the proposal id to search with
1000             * @param orderByComparator the comparator to order the set by
1001             * @return the last matching tasks review
1002             * @throws com.liferay.portlet.tasks.NoSuchReviewException if a matching tasks review could not be found
1003             * @throws SystemException if a system exception occurred
1004             */
1005            public TasksReview findByProposalId_Last(long proposalId,
1006                    OrderByComparator orderByComparator)
1007                    throws NoSuchReviewException, SystemException {
1008                    int count = countByProposalId(proposalId);
1009    
1010                    List<TasksReview> list = findByProposalId(proposalId, count - 1, count,
1011                                    orderByComparator);
1012    
1013                    if (list.isEmpty()) {
1014                            StringBundler msg = new StringBundler(4);
1015    
1016                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1017    
1018                            msg.append("proposalId=");
1019                            msg.append(proposalId);
1020    
1021                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1022    
1023                            throw new NoSuchReviewException(msg.toString());
1024                    }
1025                    else {
1026                            return list.get(0);
1027                    }
1028            }
1029    
1030            /**
1031             * Finds the tasks reviews before and after the current tasks review in the ordered set where proposalId = &#63;.
1032             *
1033             * <p>
1034             * 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.
1035             * </p>
1036             *
1037             * @param reviewId the primary key of the current tasks review
1038             * @param proposalId the proposal id to search with
1039             * @param orderByComparator the comparator to order the set by
1040             * @return the previous, current, and next tasks review
1041             * @throws com.liferay.portlet.tasks.NoSuchReviewException if a tasks review with the primary key could not be found
1042             * @throws SystemException if a system exception occurred
1043             */
1044            public TasksReview[] findByProposalId_PrevAndNext(long reviewId,
1045                    long proposalId, OrderByComparator orderByComparator)
1046                    throws NoSuchReviewException, SystemException {
1047                    TasksReview tasksReview = findByPrimaryKey(reviewId);
1048    
1049                    Session session = null;
1050    
1051                    try {
1052                            session = openSession();
1053    
1054                            TasksReview[] array = new TasksReviewImpl[3];
1055    
1056                            array[0] = getByProposalId_PrevAndNext(session, tasksReview,
1057                                            proposalId, orderByComparator, true);
1058    
1059                            array[1] = tasksReview;
1060    
1061                            array[2] = getByProposalId_PrevAndNext(session, tasksReview,
1062                                            proposalId, orderByComparator, false);
1063    
1064                            return array;
1065                    }
1066                    catch (Exception e) {
1067                            throw processException(e);
1068                    }
1069                    finally {
1070                            closeSession(session);
1071                    }
1072            }
1073    
1074            protected TasksReview getByProposalId_PrevAndNext(Session session,
1075                    TasksReview tasksReview, long proposalId,
1076                    OrderByComparator orderByComparator, boolean previous) {
1077                    StringBundler query = null;
1078    
1079                    if (orderByComparator != null) {
1080                            query = new StringBundler(6 +
1081                                            (orderByComparator.getOrderByFields().length * 6));
1082                    }
1083                    else {
1084                            query = new StringBundler(3);
1085                    }
1086    
1087                    query.append(_SQL_SELECT_TASKSREVIEW_WHERE);
1088    
1089                    query.append(_FINDER_COLUMN_PROPOSALID_PROPOSALID_2);
1090    
1091                    if (orderByComparator != null) {
1092                            String[] orderByFields = orderByComparator.getOrderByFields();
1093    
1094                            if (orderByFields.length > 0) {
1095                                    query.append(WHERE_AND);
1096                            }
1097    
1098                            for (int i = 0; i < orderByFields.length; i++) {
1099                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1100                                    query.append(orderByFields[i]);
1101    
1102                                    if ((i + 1) < orderByFields.length) {
1103                                            if (orderByComparator.isAscending() ^ previous) {
1104                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1105                                            }
1106                                            else {
1107                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1108                                            }
1109                                    }
1110                                    else {
1111                                            if (orderByComparator.isAscending() ^ previous) {
1112                                                    query.append(WHERE_GREATER_THAN);
1113                                            }
1114                                            else {
1115                                                    query.append(WHERE_LESSER_THAN);
1116                                            }
1117                                    }
1118                            }
1119    
1120                            query.append(ORDER_BY_CLAUSE);
1121    
1122                            for (int i = 0; i < orderByFields.length; i++) {
1123                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1124                                    query.append(orderByFields[i]);
1125    
1126                                    if ((i + 1) < orderByFields.length) {
1127                                            if (orderByComparator.isAscending() ^ previous) {
1128                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1129                                            }
1130                                            else {
1131                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1132                                            }
1133                                    }
1134                                    else {
1135                                            if (orderByComparator.isAscending() ^ previous) {
1136                                                    query.append(ORDER_BY_ASC);
1137                                            }
1138                                            else {
1139                                                    query.append(ORDER_BY_DESC);
1140                                            }
1141                                    }
1142                            }
1143                    }
1144    
1145                    else {
1146                            query.append(TasksReviewModelImpl.ORDER_BY_JPQL);
1147                    }
1148    
1149                    String sql = query.toString();
1150    
1151                    Query q = session.createQuery(sql);
1152    
1153                    q.setFirstResult(0);
1154                    q.setMaxResults(2);
1155    
1156                    QueryPos qPos = QueryPos.getInstance(q);
1157    
1158                    qPos.add(proposalId);
1159    
1160                    if (orderByComparator != null) {
1161                            Object[] values = orderByComparator.getOrderByValues(tasksReview);
1162    
1163                            for (Object value : values) {
1164                                    qPos.add(value);
1165                            }
1166                    }
1167    
1168                    List<TasksReview> list = q.list();
1169    
1170                    if (list.size() == 2) {
1171                            return list.get(1);
1172                    }
1173                    else {
1174                            return null;
1175                    }
1176            }
1177    
1178            /**
1179             * Finds the tasks review where userId = &#63; and proposalId = &#63; or throws a {@link com.liferay.portlet.tasks.NoSuchReviewException} if it could not be found.
1180             *
1181             * @param userId the user id to search with
1182             * @param proposalId the proposal id to search with
1183             * @return the matching tasks review
1184             * @throws com.liferay.portlet.tasks.NoSuchReviewException if a matching tasks review could not be found
1185             * @throws SystemException if a system exception occurred
1186             */
1187            public TasksReview findByU_P(long userId, long proposalId)
1188                    throws NoSuchReviewException, SystemException {
1189                    TasksReview tasksReview = fetchByU_P(userId, proposalId);
1190    
1191                    if (tasksReview == null) {
1192                            StringBundler msg = new StringBundler(6);
1193    
1194                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1195    
1196                            msg.append("userId=");
1197                            msg.append(userId);
1198    
1199                            msg.append(", proposalId=");
1200                            msg.append(proposalId);
1201    
1202                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1203    
1204                            if (_log.isWarnEnabled()) {
1205                                    _log.warn(msg.toString());
1206                            }
1207    
1208                            throw new NoSuchReviewException(msg.toString());
1209                    }
1210    
1211                    return tasksReview;
1212            }
1213    
1214            /**
1215             * Finds the tasks review where userId = &#63; and proposalId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
1216             *
1217             * @param userId the user id to search with
1218             * @param proposalId the proposal id to search with
1219             * @return the matching tasks review, or <code>null</code> if a matching tasks review could not be found
1220             * @throws SystemException if a system exception occurred
1221             */
1222            public TasksReview fetchByU_P(long userId, long proposalId)
1223                    throws SystemException {
1224                    return fetchByU_P(userId, proposalId, true);
1225            }
1226    
1227            /**
1228             * Finds the tasks review where userId = &#63; and proposalId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
1229             *
1230             * @param userId the user id to search with
1231             * @param proposalId the proposal id to search with
1232             * @return the matching tasks review, or <code>null</code> if a matching tasks review could not be found
1233             * @throws SystemException if a system exception occurred
1234             */
1235            public TasksReview fetchByU_P(long userId, long proposalId,
1236                    boolean retrieveFromCache) throws SystemException {
1237                    Object[] finderArgs = new Object[] { userId, proposalId };
1238    
1239                    Object result = null;
1240    
1241                    if (retrieveFromCache) {
1242                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_U_P,
1243                                            finderArgs, this);
1244                    }
1245    
1246                    if (result == null) {
1247                            Session session = null;
1248    
1249                            try {
1250                                    session = openSession();
1251    
1252                                    StringBundler query = new StringBundler(4);
1253    
1254                                    query.append(_SQL_SELECT_TASKSREVIEW_WHERE);
1255    
1256                                    query.append(_FINDER_COLUMN_U_P_USERID_2);
1257    
1258                                    query.append(_FINDER_COLUMN_U_P_PROPOSALID_2);
1259    
1260                                    query.append(TasksReviewModelImpl.ORDER_BY_JPQL);
1261    
1262                                    String sql = query.toString();
1263    
1264                                    Query q = session.createQuery(sql);
1265    
1266                                    QueryPos qPos = QueryPos.getInstance(q);
1267    
1268                                    qPos.add(userId);
1269    
1270                                    qPos.add(proposalId);
1271    
1272                                    List<TasksReview> list = q.list();
1273    
1274                                    result = list;
1275    
1276                                    TasksReview tasksReview = null;
1277    
1278                                    if (list.isEmpty()) {
1279                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_P,
1280                                                    finderArgs, list);
1281                                    }
1282                                    else {
1283                                            tasksReview = list.get(0);
1284    
1285                                            cacheResult(tasksReview);
1286    
1287                                            if ((tasksReview.getUserId() != userId) ||
1288                                                            (tasksReview.getProposalId() != proposalId)) {
1289                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_P,
1290                                                            finderArgs, tasksReview);
1291                                            }
1292                                    }
1293    
1294                                    return tasksReview;
1295                            }
1296                            catch (Exception e) {
1297                                    throw processException(e);
1298                            }
1299                            finally {
1300                                    if (result == null) {
1301                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_P,
1302                                                    finderArgs, new ArrayList<TasksReview>());
1303                                    }
1304    
1305                                    closeSession(session);
1306                            }
1307                    }
1308                    else {
1309                            if (result instanceof List<?>) {
1310                                    return null;
1311                            }
1312                            else {
1313                                    return (TasksReview)result;
1314                            }
1315                    }
1316            }
1317    
1318            /**
1319             * Finds all the tasks reviews where proposalId = &#63; and stage = &#63;.
1320             *
1321             * @param proposalId the proposal id to search with
1322             * @param stage the stage to search with
1323             * @return the matching tasks reviews
1324             * @throws SystemException if a system exception occurred
1325             */
1326            public List<TasksReview> findByP_S(long proposalId, int stage)
1327                    throws SystemException {
1328                    return findByP_S(proposalId, stage, QueryUtil.ALL_POS,
1329                            QueryUtil.ALL_POS, null);
1330            }
1331    
1332            /**
1333             * Finds a range of all the tasks reviews where proposalId = &#63; and stage = &#63;.
1334             *
1335             * <p>
1336             * 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.
1337             * </p>
1338             *
1339             * @param proposalId the proposal id to search with
1340             * @param stage the stage to search with
1341             * @param start the lower bound of the range of tasks reviews to return
1342             * @param end the upper bound of the range of tasks reviews to return (not inclusive)
1343             * @return the range of matching tasks reviews
1344             * @throws SystemException if a system exception occurred
1345             */
1346            public List<TasksReview> findByP_S(long proposalId, int stage, int start,
1347                    int end) throws SystemException {
1348                    return findByP_S(proposalId, stage, start, end, null);
1349            }
1350    
1351            /**
1352             * Finds an ordered range of all the tasks reviews where proposalId = &#63; and stage = &#63;.
1353             *
1354             * <p>
1355             * 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.
1356             * </p>
1357             *
1358             * @param proposalId the proposal id to search with
1359             * @param stage the stage to search with
1360             * @param start the lower bound of the range of tasks reviews to return
1361             * @param end the upper bound of the range of tasks reviews to return (not inclusive)
1362             * @param orderByComparator the comparator to order the results by
1363             * @return the ordered range of matching tasks reviews
1364             * @throws SystemException if a system exception occurred
1365             */
1366            public List<TasksReview> findByP_S(long proposalId, int stage, int start,
1367                    int end, OrderByComparator orderByComparator) throws SystemException {
1368                    Object[] finderArgs = new Object[] {
1369                                    proposalId, stage,
1370                                    
1371                                    String.valueOf(start), String.valueOf(end),
1372                                    String.valueOf(orderByComparator)
1373                            };
1374    
1375                    List<TasksReview> list = (List<TasksReview>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_P_S,
1376                                    finderArgs, this);
1377    
1378                    if (list == null) {
1379                            Session session = null;
1380    
1381                            try {
1382                                    session = openSession();
1383    
1384                                    StringBundler query = null;
1385    
1386                                    if (orderByComparator != null) {
1387                                            query = new StringBundler(4 +
1388                                                            (orderByComparator.getOrderByFields().length * 3));
1389                                    }
1390                                    else {
1391                                            query = new StringBundler(4);
1392                                    }
1393    
1394                                    query.append(_SQL_SELECT_TASKSREVIEW_WHERE);
1395    
1396                                    query.append(_FINDER_COLUMN_P_S_PROPOSALID_2);
1397    
1398                                    query.append(_FINDER_COLUMN_P_S_STAGE_2);
1399    
1400                                    if (orderByComparator != null) {
1401                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1402                                                    orderByComparator);
1403                                    }
1404    
1405                                    else {
1406                                            query.append(TasksReviewModelImpl.ORDER_BY_JPQL);
1407                                    }
1408    
1409                                    String sql = query.toString();
1410    
1411                                    Query q = session.createQuery(sql);
1412    
1413                                    QueryPos qPos = QueryPos.getInstance(q);
1414    
1415                                    qPos.add(proposalId);
1416    
1417                                    qPos.add(stage);
1418    
1419                                    list = (List<TasksReview>)QueryUtil.list(q, getDialect(),
1420                                                    start, end);
1421                            }
1422                            catch (Exception e) {
1423                                    throw processException(e);
1424                            }
1425                            finally {
1426                                    if (list == null) {
1427                                            list = new ArrayList<TasksReview>();
1428                                    }
1429    
1430                                    cacheResult(list);
1431    
1432                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_P_S, finderArgs,
1433                                            list);
1434    
1435                                    closeSession(session);
1436                            }
1437                    }
1438    
1439                    return list;
1440            }
1441    
1442            /**
1443             * Finds the first tasks review in the ordered set where proposalId = &#63; and stage = &#63;.
1444             *
1445             * <p>
1446             * 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.
1447             * </p>
1448             *
1449             * @param proposalId the proposal id to search with
1450             * @param stage the stage to search with
1451             * @param orderByComparator the comparator to order the set by
1452             * @return the first matching tasks review
1453             * @throws com.liferay.portlet.tasks.NoSuchReviewException if a matching tasks review could not be found
1454             * @throws SystemException if a system exception occurred
1455             */
1456            public TasksReview findByP_S_First(long proposalId, int stage,
1457                    OrderByComparator orderByComparator)
1458                    throws NoSuchReviewException, SystemException {
1459                    List<TasksReview> list = findByP_S(proposalId, stage, 0, 1,
1460                                    orderByComparator);
1461    
1462                    if (list.isEmpty()) {
1463                            StringBundler msg = new StringBundler(6);
1464    
1465                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1466    
1467                            msg.append("proposalId=");
1468                            msg.append(proposalId);
1469    
1470                            msg.append(", stage=");
1471                            msg.append(stage);
1472    
1473                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1474    
1475                            throw new NoSuchReviewException(msg.toString());
1476                    }
1477                    else {
1478                            return list.get(0);
1479                    }
1480            }
1481    
1482            /**
1483             * Finds the last tasks review in the ordered set where proposalId = &#63; and stage = &#63;.
1484             *
1485             * <p>
1486             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1487             * </p>
1488             *
1489             * @param proposalId the proposal id to search with
1490             * @param stage the stage to search with
1491             * @param orderByComparator the comparator to order the set by
1492             * @return the last matching tasks review
1493             * @throws com.liferay.portlet.tasks.NoSuchReviewException if a matching tasks review could not be found
1494             * @throws SystemException if a system exception occurred
1495             */
1496            public TasksReview findByP_S_Last(long proposalId, int stage,
1497                    OrderByComparator orderByComparator)
1498                    throws NoSuchReviewException, SystemException {
1499                    int count = countByP_S(proposalId, stage);
1500    
1501                    List<TasksReview> list = findByP_S(proposalId, stage, count - 1, count,
1502                                    orderByComparator);
1503    
1504                    if (list.isEmpty()) {
1505                            StringBundler msg = new StringBundler(6);
1506    
1507                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1508    
1509                            msg.append("proposalId=");
1510                            msg.append(proposalId);
1511    
1512                            msg.append(", stage=");
1513                            msg.append(stage);
1514    
1515                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1516    
1517                            throw new NoSuchReviewException(msg.toString());
1518                    }
1519                    else {
1520                            return list.get(0);
1521                    }
1522            }
1523    
1524            /**
1525             * Finds the tasks reviews before and after the current tasks review in the ordered set where proposalId = &#63; and stage = &#63;.
1526             *
1527             * <p>
1528             * 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.
1529             * </p>
1530             *
1531             * @param reviewId the primary key of the current tasks review
1532             * @param proposalId the proposal id to search with
1533             * @param stage the stage to search with
1534             * @param orderByComparator the comparator to order the set by
1535             * @return the previous, current, and next tasks review
1536             * @throws com.liferay.portlet.tasks.NoSuchReviewException if a tasks review with the primary key could not be found
1537             * @throws SystemException if a system exception occurred
1538             */
1539            public TasksReview[] findByP_S_PrevAndNext(long reviewId, long proposalId,
1540                    int stage, OrderByComparator orderByComparator)
1541                    throws NoSuchReviewException, SystemException {
1542                    TasksReview tasksReview = findByPrimaryKey(reviewId);
1543    
1544                    Session session = null;
1545    
1546                    try {
1547                            session = openSession();
1548    
1549                            TasksReview[] array = new TasksReviewImpl[3];
1550    
1551                            array[0] = getByP_S_PrevAndNext(session, tasksReview, proposalId,
1552                                            stage, orderByComparator, true);
1553    
1554                            array[1] = tasksReview;
1555    
1556                            array[2] = getByP_S_PrevAndNext(session, tasksReview, proposalId,
1557                                            stage, orderByComparator, false);
1558    
1559                            return array;
1560                    }
1561                    catch (Exception e) {
1562                            throw processException(e);
1563                    }
1564                    finally {
1565                            closeSession(session);
1566                    }
1567            }
1568    
1569            protected TasksReview getByP_S_PrevAndNext(Session session,
1570                    TasksReview tasksReview, long proposalId, int stage,
1571                    OrderByComparator orderByComparator, boolean previous) {
1572                    StringBundler query = null;
1573    
1574                    if (orderByComparator != null) {
1575                            query = new StringBundler(6 +
1576                                            (orderByComparator.getOrderByFields().length * 6));
1577                    }
1578                    else {
1579                            query = new StringBundler(3);
1580                    }
1581    
1582                    query.append(_SQL_SELECT_TASKSREVIEW_WHERE);
1583    
1584                    query.append(_FINDER_COLUMN_P_S_PROPOSALID_2);
1585    
1586                    query.append(_FINDER_COLUMN_P_S_STAGE_2);
1587    
1588                    if (orderByComparator != null) {
1589                            String[] orderByFields = orderByComparator.getOrderByFields();
1590    
1591                            if (orderByFields.length > 0) {
1592                                    query.append(WHERE_AND);
1593                            }
1594    
1595                            for (int i = 0; i < orderByFields.length; i++) {
1596                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1597                                    query.append(orderByFields[i]);
1598    
1599                                    if ((i + 1) < orderByFields.length) {
1600                                            if (orderByComparator.isAscending() ^ previous) {
1601                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1602                                            }
1603                                            else {
1604                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1605                                            }
1606                                    }
1607                                    else {
1608                                            if (orderByComparator.isAscending() ^ previous) {
1609                                                    query.append(WHERE_GREATER_THAN);
1610                                            }
1611                                            else {
1612                                                    query.append(WHERE_LESSER_THAN);
1613                                            }
1614                                    }
1615                            }
1616    
1617                            query.append(ORDER_BY_CLAUSE);
1618    
1619                            for (int i = 0; i < orderByFields.length; i++) {
1620                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1621                                    query.append(orderByFields[i]);
1622    
1623                                    if ((i + 1) < orderByFields.length) {
1624                                            if (orderByComparator.isAscending() ^ previous) {
1625                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1626                                            }
1627                                            else {
1628                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1629                                            }
1630                                    }
1631                                    else {
1632                                            if (orderByComparator.isAscending() ^ previous) {
1633                                                    query.append(ORDER_BY_ASC);
1634                                            }
1635                                            else {
1636                                                    query.append(ORDER_BY_DESC);
1637                                            }
1638                                    }
1639                            }
1640                    }
1641    
1642                    else {
1643                            query.append(TasksReviewModelImpl.ORDER_BY_JPQL);
1644                    }
1645    
1646                    String sql = query.toString();
1647    
1648                    Query q = session.createQuery(sql);
1649    
1650                    q.setFirstResult(0);
1651                    q.setMaxResults(2);
1652    
1653                    QueryPos qPos = QueryPos.getInstance(q);
1654    
1655                    qPos.add(proposalId);
1656    
1657                    qPos.add(stage);
1658    
1659                    if (orderByComparator != null) {
1660                            Object[] values = orderByComparator.getOrderByValues(tasksReview);
1661    
1662                            for (Object value : values) {
1663                                    qPos.add(value);
1664                            }
1665                    }
1666    
1667                    List<TasksReview> list = q.list();
1668    
1669                    if (list.size() == 2) {
1670                            return list.get(1);
1671                    }
1672                    else {
1673                            return null;
1674                    }
1675            }
1676    
1677            /**
1678             * Finds all the tasks reviews where proposalId = &#63; and stage = &#63; and completed = &#63;.
1679             *
1680             * @param proposalId the proposal id to search with
1681             * @param stage the stage to search with
1682             * @param completed the completed to search with
1683             * @return the matching tasks reviews
1684             * @throws SystemException if a system exception occurred
1685             */
1686            public List<TasksReview> findByP_S_C(long proposalId, int stage,
1687                    boolean completed) throws SystemException {
1688                    return findByP_S_C(proposalId, stage, completed, QueryUtil.ALL_POS,
1689                            QueryUtil.ALL_POS, null);
1690            }
1691    
1692            /**
1693             * Finds a range of all the tasks reviews where proposalId = &#63; and stage = &#63; and completed = &#63;.
1694             *
1695             * <p>
1696             * 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.
1697             * </p>
1698             *
1699             * @param proposalId the proposal id to search with
1700             * @param stage the stage to search with
1701             * @param completed the completed to search with
1702             * @param start the lower bound of the range of tasks reviews to return
1703             * @param end the upper bound of the range of tasks reviews to return (not inclusive)
1704             * @return the range of matching tasks reviews
1705             * @throws SystemException if a system exception occurred
1706             */
1707            public List<TasksReview> findByP_S_C(long proposalId, int stage,
1708                    boolean completed, int start, int end) throws SystemException {
1709                    return findByP_S_C(proposalId, stage, completed, start, end, null);
1710            }
1711    
1712            /**
1713             * Finds an ordered range of all the tasks reviews where proposalId = &#63; and stage = &#63; and completed = &#63;.
1714             *
1715             * <p>
1716             * 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.
1717             * </p>
1718             *
1719             * @param proposalId the proposal id to search with
1720             * @param stage the stage to search with
1721             * @param completed the completed to search with
1722             * @param start the lower bound of the range of tasks reviews to return
1723             * @param end the upper bound of the range of tasks reviews to return (not inclusive)
1724             * @param orderByComparator the comparator to order the results by
1725             * @return the ordered range of matching tasks reviews
1726             * @throws SystemException if a system exception occurred
1727             */
1728            public List<TasksReview> findByP_S_C(long proposalId, int stage,
1729                    boolean completed, int start, int end,
1730                    OrderByComparator orderByComparator) throws SystemException {
1731                    Object[] finderArgs = new Object[] {
1732                                    proposalId, stage, completed,
1733                                    
1734                                    String.valueOf(start), String.valueOf(end),
1735                                    String.valueOf(orderByComparator)
1736                            };
1737    
1738                    List<TasksReview> list = (List<TasksReview>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_P_S_C,
1739                                    finderArgs, this);
1740    
1741                    if (list == null) {
1742                            Session session = null;
1743    
1744                            try {
1745                                    session = openSession();
1746    
1747                                    StringBundler query = null;
1748    
1749                                    if (orderByComparator != null) {
1750                                            query = new StringBundler(5 +
1751                                                            (orderByComparator.getOrderByFields().length * 3));
1752                                    }
1753                                    else {
1754                                            query = new StringBundler(5);
1755                                    }
1756    
1757                                    query.append(_SQL_SELECT_TASKSREVIEW_WHERE);
1758    
1759                                    query.append(_FINDER_COLUMN_P_S_C_PROPOSALID_2);
1760    
1761                                    query.append(_FINDER_COLUMN_P_S_C_STAGE_2);
1762    
1763                                    query.append(_FINDER_COLUMN_P_S_C_COMPLETED_2);
1764    
1765                                    if (orderByComparator != null) {
1766                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1767                                                    orderByComparator);
1768                                    }
1769    
1770                                    else {
1771                                            query.append(TasksReviewModelImpl.ORDER_BY_JPQL);
1772                                    }
1773    
1774                                    String sql = query.toString();
1775    
1776                                    Query q = session.createQuery(sql);
1777    
1778                                    QueryPos qPos = QueryPos.getInstance(q);
1779    
1780                                    qPos.add(proposalId);
1781    
1782                                    qPos.add(stage);
1783    
1784                                    qPos.add(completed);
1785    
1786                                    list = (List<TasksReview>)QueryUtil.list(q, getDialect(),
1787                                                    start, end);
1788                            }
1789                            catch (Exception e) {
1790                                    throw processException(e);
1791                            }
1792                            finally {
1793                                    if (list == null) {
1794                                            list = new ArrayList<TasksReview>();
1795                                    }
1796    
1797                                    cacheResult(list);
1798    
1799                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_P_S_C,
1800                                            finderArgs, list);
1801    
1802                                    closeSession(session);
1803                            }
1804                    }
1805    
1806                    return list;
1807            }
1808    
1809            /**
1810             * Finds the first tasks review in the ordered set where proposalId = &#63; and stage = &#63; and completed = &#63;.
1811             *
1812             * <p>
1813             * 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.
1814             * </p>
1815             *
1816             * @param proposalId the proposal id to search with
1817             * @param stage the stage to search with
1818             * @param completed the completed to search with
1819             * @param orderByComparator the comparator to order the set by
1820             * @return the first matching tasks review
1821             * @throws com.liferay.portlet.tasks.NoSuchReviewException if a matching tasks review could not be found
1822             * @throws SystemException if a system exception occurred
1823             */
1824            public TasksReview findByP_S_C_First(long proposalId, int stage,
1825                    boolean completed, OrderByComparator orderByComparator)
1826                    throws NoSuchReviewException, SystemException {
1827                    List<TasksReview> list = findByP_S_C(proposalId, stage, completed, 0,
1828                                    1, orderByComparator);
1829    
1830                    if (list.isEmpty()) {
1831                            StringBundler msg = new StringBundler(8);
1832    
1833                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1834    
1835                            msg.append("proposalId=");
1836                            msg.append(proposalId);
1837    
1838                            msg.append(", stage=");
1839                            msg.append(stage);
1840    
1841                            msg.append(", completed=");
1842                            msg.append(completed);
1843    
1844                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1845    
1846                            throw new NoSuchReviewException(msg.toString());
1847                    }
1848                    else {
1849                            return list.get(0);
1850                    }
1851            }
1852    
1853            /**
1854             * Finds the last tasks review in the ordered set where proposalId = &#63; and stage = &#63; and completed = &#63;.
1855             *
1856             * <p>
1857             * 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.
1858             * </p>
1859             *
1860             * @param proposalId the proposal id to search with
1861             * @param stage the stage to search with
1862             * @param completed the completed to search with
1863             * @param orderByComparator the comparator to order the set by
1864             * @return the last matching tasks review
1865             * @throws com.liferay.portlet.tasks.NoSuchReviewException if a matching tasks review could not be found
1866             * @throws SystemException if a system exception occurred
1867             */
1868            public TasksReview findByP_S_C_Last(long proposalId, int stage,
1869                    boolean completed, OrderByComparator orderByComparator)
1870                    throws NoSuchReviewException, SystemException {
1871                    int count = countByP_S_C(proposalId, stage, completed);
1872    
1873                    List<TasksReview> list = findByP_S_C(proposalId, stage, completed,
1874                                    count - 1, count, orderByComparator);
1875    
1876                    if (list.isEmpty()) {
1877                            StringBundler msg = new StringBundler(8);
1878    
1879                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1880    
1881                            msg.append("proposalId=");
1882                            msg.append(proposalId);
1883    
1884                            msg.append(", stage=");
1885                            msg.append(stage);
1886    
1887                            msg.append(", completed=");
1888                            msg.append(completed);
1889    
1890                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1891    
1892                            throw new NoSuchReviewException(msg.toString());
1893                    }
1894                    else {
1895                            return list.get(0);
1896                    }
1897            }
1898    
1899            /**
1900             * Finds the tasks reviews before and after the current tasks review in the ordered set where proposalId = &#63; and stage = &#63; and completed = &#63;.
1901             *
1902             * <p>
1903             * 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.
1904             * </p>
1905             *
1906             * @param reviewId the primary key of the current tasks review
1907             * @param proposalId the proposal id to search with
1908             * @param stage the stage to search with
1909             * @param completed the completed to search with
1910             * @param orderByComparator the comparator to order the set by
1911             * @return the previous, current, and next tasks review
1912             * @throws com.liferay.portlet.tasks.NoSuchReviewException if a tasks review with the primary key could not be found
1913             * @throws SystemException if a system exception occurred
1914             */
1915            public TasksReview[] findByP_S_C_PrevAndNext(long reviewId,
1916                    long proposalId, int stage, boolean completed,
1917                    OrderByComparator orderByComparator)
1918                    throws NoSuchReviewException, SystemException {
1919                    TasksReview tasksReview = findByPrimaryKey(reviewId);
1920    
1921                    Session session = null;
1922    
1923                    try {
1924                            session = openSession();
1925    
1926                            TasksReview[] array = new TasksReviewImpl[3];
1927    
1928                            array[0] = getByP_S_C_PrevAndNext(session, tasksReview, proposalId,
1929                                            stage, completed, orderByComparator, true);
1930    
1931                            array[1] = tasksReview;
1932    
1933                            array[2] = getByP_S_C_PrevAndNext(session, tasksReview, proposalId,
1934                                            stage, completed, orderByComparator, false);
1935    
1936                            return array;
1937                    }
1938                    catch (Exception e) {
1939                            throw processException(e);
1940                    }
1941                    finally {
1942                            closeSession(session);
1943                    }
1944            }
1945    
1946            protected TasksReview getByP_S_C_PrevAndNext(Session session,
1947                    TasksReview tasksReview, long proposalId, int stage, boolean completed,
1948                    OrderByComparator orderByComparator, boolean previous) {
1949                    StringBundler query = null;
1950    
1951                    if (orderByComparator != null) {
1952                            query = new StringBundler(6 +
1953                                            (orderByComparator.getOrderByFields().length * 6));
1954                    }
1955                    else {
1956                            query = new StringBundler(3);
1957                    }
1958    
1959                    query.append(_SQL_SELECT_TASKSREVIEW_WHERE);
1960    
1961                    query.append(_FINDER_COLUMN_P_S_C_PROPOSALID_2);
1962    
1963                    query.append(_FINDER_COLUMN_P_S_C_STAGE_2);
1964    
1965                    query.append(_FINDER_COLUMN_P_S_C_COMPLETED_2);
1966    
1967                    if (orderByComparator != null) {
1968                            String[] orderByFields = orderByComparator.getOrderByFields();
1969    
1970                            if (orderByFields.length > 0) {
1971                                    query.append(WHERE_AND);
1972                            }
1973    
1974                            for (int i = 0; i < orderByFields.length; i++) {
1975                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1976                                    query.append(orderByFields[i]);
1977    
1978                                    if ((i + 1) < orderByFields.length) {
1979                                            if (orderByComparator.isAscending() ^ previous) {
1980                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1981                                            }
1982                                            else {
1983                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1984                                            }
1985                                    }
1986                                    else {
1987                                            if (orderByComparator.isAscending() ^ previous) {
1988                                                    query.append(WHERE_GREATER_THAN);
1989                                            }
1990                                            else {
1991                                                    query.append(WHERE_LESSER_THAN);
1992                                            }
1993                                    }
1994                            }
1995    
1996                            query.append(ORDER_BY_CLAUSE);
1997    
1998                            for (int i = 0; i < orderByFields.length; i++) {
1999                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2000                                    query.append(orderByFields[i]);
2001    
2002                                    if ((i + 1) < orderByFields.length) {
2003                                            if (orderByComparator.isAscending() ^ previous) {
2004                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
2005                                            }
2006                                            else {
2007                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
2008                                            }
2009                                    }
2010                                    else {
2011                                            if (orderByComparator.isAscending() ^ previous) {
2012                                                    query.append(ORDER_BY_ASC);
2013                                            }
2014                                            else {
2015                                                    query.append(ORDER_BY_DESC);
2016                                            }
2017                                    }
2018                            }
2019                    }
2020    
2021                    else {
2022                            query.append(TasksReviewModelImpl.ORDER_BY_JPQL);
2023                    }
2024    
2025                    String sql = query.toString();
2026    
2027                    Query q = session.createQuery(sql);
2028    
2029                    q.setFirstResult(0);
2030                    q.setMaxResults(2);
2031    
2032                    QueryPos qPos = QueryPos.getInstance(q);
2033    
2034                    qPos.add(proposalId);
2035    
2036                    qPos.add(stage);
2037    
2038                    qPos.add(completed);
2039    
2040                    if (orderByComparator != null) {
2041                            Object[] values = orderByComparator.getOrderByValues(tasksReview);
2042    
2043                            for (Object value : values) {
2044                                    qPos.add(value);
2045                            }
2046                    }
2047    
2048                    List<TasksReview> list = q.list();
2049    
2050                    if (list.size() == 2) {
2051                            return list.get(1);
2052                    }
2053                    else {
2054                            return null;
2055                    }
2056            }
2057    
2058            /**
2059             * Finds all the tasks reviews where proposalId = &#63; and stage = &#63; and completed = &#63; and rejected = &#63;.
2060             *
2061             * @param proposalId the proposal id to search with
2062             * @param stage the stage to search with
2063             * @param completed the completed to search with
2064             * @param rejected the rejected to search with
2065             * @return the matching tasks reviews
2066             * @throws SystemException if a system exception occurred
2067             */
2068            public List<TasksReview> findByP_S_C_R(long proposalId, int stage,
2069                    boolean completed, boolean rejected) throws SystemException {
2070                    return findByP_S_C_R(proposalId, stage, completed, rejected,
2071                            QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2072            }
2073    
2074            /**
2075             * Finds a range of all the tasks reviews where proposalId = &#63; and stage = &#63; and completed = &#63; and rejected = &#63;.
2076             *
2077             * <p>
2078             * 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.
2079             * </p>
2080             *
2081             * @param proposalId the proposal id to search with
2082             * @param stage the stage to search with
2083             * @param completed the completed to search with
2084             * @param rejected the rejected to search with
2085             * @param start the lower bound of the range of tasks reviews to return
2086             * @param end the upper bound of the range of tasks reviews to return (not inclusive)
2087             * @return the range of matching tasks reviews
2088             * @throws SystemException if a system exception occurred
2089             */
2090            public List<TasksReview> findByP_S_C_R(long proposalId, int stage,
2091                    boolean completed, boolean rejected, int start, int end)
2092                    throws SystemException {
2093                    return findByP_S_C_R(proposalId, stage, completed, rejected, start,
2094                            end, null);
2095            }
2096    
2097            /**
2098             * Finds an ordered range of all the tasks reviews where proposalId = &#63; and stage = &#63; and completed = &#63; and rejected = &#63;.
2099             *
2100             * <p>
2101             * 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.
2102             * </p>
2103             *
2104             * @param proposalId the proposal id to search with
2105             * @param stage the stage to search with
2106             * @param completed the completed to search with
2107             * @param rejected the rejected to search with
2108             * @param start the lower bound of the range of tasks reviews to return
2109             * @param end the upper bound of the range of tasks reviews to return (not inclusive)
2110             * @param orderByComparator the comparator to order the results by
2111             * @return the ordered range of matching tasks reviews
2112             * @throws SystemException if a system exception occurred
2113             */
2114            public List<TasksReview> findByP_S_C_R(long proposalId, int stage,
2115                    boolean completed, boolean rejected, int start, int end,
2116                    OrderByComparator orderByComparator) throws SystemException {
2117                    Object[] finderArgs = new Object[] {
2118                                    proposalId, stage, completed, rejected,
2119                                    
2120                                    String.valueOf(start), String.valueOf(end),
2121                                    String.valueOf(orderByComparator)
2122                            };
2123    
2124                    List<TasksReview> list = (List<TasksReview>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_P_S_C_R,
2125                                    finderArgs, this);
2126    
2127                    if (list == null) {
2128                            Session session = null;
2129    
2130                            try {
2131                                    session = openSession();
2132    
2133                                    StringBundler query = null;
2134    
2135                                    if (orderByComparator != null) {
2136                                            query = new StringBundler(6 +
2137                                                            (orderByComparator.getOrderByFields().length * 3));
2138                                    }
2139                                    else {
2140                                            query = new StringBundler(6);
2141                                    }
2142    
2143                                    query.append(_SQL_SELECT_TASKSREVIEW_WHERE);
2144    
2145                                    query.append(_FINDER_COLUMN_P_S_C_R_PROPOSALID_2);
2146    
2147                                    query.append(_FINDER_COLUMN_P_S_C_R_STAGE_2);
2148    
2149                                    query.append(_FINDER_COLUMN_P_S_C_R_COMPLETED_2);
2150    
2151                                    query.append(_FINDER_COLUMN_P_S_C_R_REJECTED_2);
2152    
2153                                    if (orderByComparator != null) {
2154                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2155                                                    orderByComparator);
2156                                    }
2157    
2158                                    else {
2159                                            query.append(TasksReviewModelImpl.ORDER_BY_JPQL);
2160                                    }
2161    
2162                                    String sql = query.toString();
2163    
2164                                    Query q = session.createQuery(sql);
2165    
2166                                    QueryPos qPos = QueryPos.getInstance(q);
2167    
2168                                    qPos.add(proposalId);
2169    
2170                                    qPos.add(stage);
2171    
2172                                    qPos.add(completed);
2173    
2174                                    qPos.add(rejected);
2175    
2176                                    list = (List<TasksReview>)QueryUtil.list(q, getDialect(),
2177                                                    start, end);
2178                            }
2179                            catch (Exception e) {
2180                                    throw processException(e);
2181                            }
2182                            finally {
2183                                    if (list == null) {
2184                                            list = new ArrayList<TasksReview>();
2185                                    }
2186    
2187                                    cacheResult(list);
2188    
2189                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_P_S_C_R,
2190                                            finderArgs, list);
2191    
2192                                    closeSession(session);
2193                            }
2194                    }
2195    
2196                    return list;
2197            }
2198    
2199            /**
2200             * Finds the first tasks review in the ordered set where proposalId = &#63; and stage = &#63; and completed = &#63; and rejected = &#63;.
2201             *
2202             * <p>
2203             * 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.
2204             * </p>
2205             *
2206             * @param proposalId the proposal id to search with
2207             * @param stage the stage to search with
2208             * @param completed the completed to search with
2209             * @param rejected the rejected to search with
2210             * @param orderByComparator the comparator to order the set by
2211             * @return the first matching tasks review
2212             * @throws com.liferay.portlet.tasks.NoSuchReviewException if a matching tasks review could not be found
2213             * @throws SystemException if a system exception occurred
2214             */
2215            public TasksReview findByP_S_C_R_First(long proposalId, int stage,
2216                    boolean completed, boolean rejected, OrderByComparator orderByComparator)
2217                    throws NoSuchReviewException, SystemException {
2218                    List<TasksReview> list = findByP_S_C_R(proposalId, stage, completed,
2219                                    rejected, 0, 1, orderByComparator);
2220    
2221                    if (list.isEmpty()) {
2222                            StringBundler msg = new StringBundler(10);
2223    
2224                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2225    
2226                            msg.append("proposalId=");
2227                            msg.append(proposalId);
2228    
2229                            msg.append(", stage=");
2230                            msg.append(stage);
2231    
2232                            msg.append(", completed=");
2233                            msg.append(completed);
2234    
2235                            msg.append(", rejected=");
2236                            msg.append(rejected);
2237    
2238                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2239    
2240                            throw new NoSuchReviewException(msg.toString());
2241                    }
2242                    else {
2243                            return list.get(0);
2244                    }
2245            }
2246    
2247            /**
2248             * Finds the last tasks review in the ordered set where proposalId = &#63; and stage = &#63; and completed = &#63; and rejected = &#63;.
2249             *
2250             * <p>
2251             * 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.
2252             * </p>
2253             *
2254             * @param proposalId the proposal id to search with
2255             * @param stage the stage to search with
2256             * @param completed the completed to search with
2257             * @param rejected the rejected to search with
2258             * @param orderByComparator the comparator to order the set by
2259             * @return the last matching tasks review
2260             * @throws com.liferay.portlet.tasks.NoSuchReviewException if a matching tasks review could not be found
2261             * @throws SystemException if a system exception occurred
2262             */
2263            public TasksReview findByP_S_C_R_Last(long proposalId, int stage,
2264                    boolean completed, boolean rejected, OrderByComparator orderByComparator)
2265                    throws NoSuchReviewException, SystemException {
2266                    int count = countByP_S_C_R(proposalId, stage, completed, rejected);
2267    
2268                    List<TasksReview> list = findByP_S_C_R(proposalId, stage, completed,
2269                                    rejected, count - 1, count, orderByComparator);
2270    
2271                    if (list.isEmpty()) {
2272                            StringBundler msg = new StringBundler(10);
2273    
2274                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2275    
2276                            msg.append("proposalId=");
2277                            msg.append(proposalId);
2278    
2279                            msg.append(", stage=");
2280                            msg.append(stage);
2281    
2282                            msg.append(", completed=");
2283                            msg.append(completed);
2284    
2285                            msg.append(", rejected=");
2286                            msg.append(rejected);
2287    
2288                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2289    
2290                            throw new NoSuchReviewException(msg.toString());
2291                    }
2292                    else {
2293                            return list.get(0);
2294                    }
2295            }
2296    
2297            /**
2298             * Finds the tasks reviews before and after the current tasks review in the ordered set where proposalId = &#63; and stage = &#63; and completed = &#63; and rejected = &#63;.
2299             *
2300             * <p>
2301             * 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.
2302             * </p>
2303             *
2304             * @param reviewId the primary key of the current tasks review
2305             * @param proposalId the proposal id to search with
2306             * @param stage the stage to search with
2307             * @param completed the completed to search with
2308             * @param rejected the rejected to search with
2309             * @param orderByComparator the comparator to order the set by
2310             * @return the previous, current, and next tasks review
2311             * @throws com.liferay.portlet.tasks.NoSuchReviewException if a tasks review with the primary key could not be found
2312             * @throws SystemException if a system exception occurred
2313             */
2314            public TasksReview[] findByP_S_C_R_PrevAndNext(long reviewId,
2315                    long proposalId, int stage, boolean completed, boolean rejected,
2316                    OrderByComparator orderByComparator)
2317                    throws NoSuchReviewException, SystemException {
2318                    TasksReview tasksReview = findByPrimaryKey(reviewId);
2319    
2320                    Session session = null;
2321    
2322                    try {
2323                            session = openSession();
2324    
2325                            TasksReview[] array = new TasksReviewImpl[3];
2326    
2327                            array[0] = getByP_S_C_R_PrevAndNext(session, tasksReview,
2328                                            proposalId, stage, completed, rejected, orderByComparator,
2329                                            true);
2330    
2331                            array[1] = tasksReview;
2332    
2333                            array[2] = getByP_S_C_R_PrevAndNext(session, tasksReview,
2334                                            proposalId, stage, completed, rejected, orderByComparator,
2335                                            false);
2336    
2337                            return array;
2338                    }
2339                    catch (Exception e) {
2340                            throw processException(e);
2341                    }
2342                    finally {
2343                            closeSession(session);
2344                    }
2345            }
2346    
2347            protected TasksReview getByP_S_C_R_PrevAndNext(Session session,
2348                    TasksReview tasksReview, long proposalId, int stage, boolean completed,
2349                    boolean rejected, OrderByComparator orderByComparator, boolean previous) {
2350                    StringBundler query = null;
2351    
2352                    if (orderByComparator != null) {
2353                            query = new StringBundler(6 +
2354                                            (orderByComparator.getOrderByFields().length * 6));
2355                    }
2356                    else {
2357                            query = new StringBundler(3);
2358                    }
2359    
2360                    query.append(_SQL_SELECT_TASKSREVIEW_WHERE);
2361    
2362                    query.append(_FINDER_COLUMN_P_S_C_R_PROPOSALID_2);
2363    
2364                    query.append(_FINDER_COLUMN_P_S_C_R_STAGE_2);
2365    
2366                    query.append(_FINDER_COLUMN_P_S_C_R_COMPLETED_2);
2367    
2368                    query.append(_FINDER_COLUMN_P_S_C_R_REJECTED_2);
2369    
2370                    if (orderByComparator != null) {
2371                            String[] orderByFields = orderByComparator.getOrderByFields();
2372    
2373                            if (orderByFields.length > 0) {
2374                                    query.append(WHERE_AND);
2375                            }
2376    
2377                            for (int i = 0; i < orderByFields.length; i++) {
2378                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2379                                    query.append(orderByFields[i]);
2380    
2381                                    if ((i + 1) < orderByFields.length) {
2382                                            if (orderByComparator.isAscending() ^ previous) {
2383                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
2384                                            }
2385                                            else {
2386                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
2387                                            }
2388                                    }
2389                                    else {
2390                                            if (orderByComparator.isAscending() ^ previous) {
2391                                                    query.append(WHERE_GREATER_THAN);
2392                                            }
2393                                            else {
2394                                                    query.append(WHERE_LESSER_THAN);
2395                                            }
2396                                    }
2397                            }
2398    
2399                            query.append(ORDER_BY_CLAUSE);
2400    
2401                            for (int i = 0; i < orderByFields.length; i++) {
2402                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2403                                    query.append(orderByFields[i]);
2404    
2405                                    if ((i + 1) < orderByFields.length) {
2406                                            if (orderByComparator.isAscending() ^ previous) {
2407                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
2408                                            }
2409                                            else {
2410                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
2411                                            }
2412                                    }
2413                                    else {
2414                                            if (orderByComparator.isAscending() ^ previous) {
2415                                                    query.append(ORDER_BY_ASC);
2416                                            }
2417                                            else {
2418                                                    query.append(ORDER_BY_DESC);
2419                                            }
2420                                    }
2421                            }
2422                    }
2423    
2424                    else {
2425                            query.append(TasksReviewModelImpl.ORDER_BY_JPQL);
2426                    }
2427    
2428                    String sql = query.toString();
2429    
2430                    Query q = session.createQuery(sql);
2431    
2432                    q.setFirstResult(0);
2433                    q.setMaxResults(2);
2434    
2435                    QueryPos qPos = QueryPos.getInstance(q);
2436    
2437                    qPos.add(proposalId);
2438    
2439                    qPos.add(stage);
2440    
2441                    qPos.add(completed);
2442    
2443                    qPos.add(rejected);
2444    
2445                    if (orderByComparator != null) {
2446                            Object[] values = orderByComparator.getOrderByValues(tasksReview);
2447    
2448                            for (Object value : values) {
2449                                    qPos.add(value);
2450                            }
2451                    }
2452    
2453                    List<TasksReview> list = q.list();
2454    
2455                    if (list.size() == 2) {
2456                            return list.get(1);
2457                    }
2458                    else {
2459                            return null;
2460                    }
2461            }
2462    
2463            /**
2464             * Finds all the tasks reviews.
2465             *
2466             * @return the tasks reviews
2467             * @throws SystemException if a system exception occurred
2468             */
2469            public List<TasksReview> findAll() throws SystemException {
2470                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2471            }
2472    
2473            /**
2474             * Finds a range of all the tasks reviews.
2475             *
2476             * <p>
2477             * 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.
2478             * </p>
2479             *
2480             * @param start the lower bound of the range of tasks reviews to return
2481             * @param end the upper bound of the range of tasks reviews to return (not inclusive)
2482             * @return the range of tasks reviews
2483             * @throws SystemException if a system exception occurred
2484             */
2485            public List<TasksReview> findAll(int start, int end)
2486                    throws SystemException {
2487                    return findAll(start, end, null);
2488            }
2489    
2490            /**
2491             * Finds an ordered range of all the tasks reviews.
2492             *
2493             * <p>
2494             * 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.
2495             * </p>
2496             *
2497             * @param start the lower bound of the range of tasks reviews to return
2498             * @param end the upper bound of the range of tasks reviews to return (not inclusive)
2499             * @param orderByComparator the comparator to order the results by
2500             * @return the ordered range of tasks reviews
2501             * @throws SystemException if a system exception occurred
2502             */
2503            public List<TasksReview> findAll(int start, int end,
2504                    OrderByComparator orderByComparator) throws SystemException {
2505                    Object[] finderArgs = new Object[] {
2506                                    String.valueOf(start), String.valueOf(end),
2507                                    String.valueOf(orderByComparator)
2508                            };
2509    
2510                    List<TasksReview> list = (List<TasksReview>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2511                                    finderArgs, this);
2512    
2513                    if (list == null) {
2514                            Session session = null;
2515    
2516                            try {
2517                                    session = openSession();
2518    
2519                                    StringBundler query = null;
2520                                    String sql = null;
2521    
2522                                    if (orderByComparator != null) {
2523                                            query = new StringBundler(2 +
2524                                                            (orderByComparator.getOrderByFields().length * 3));
2525    
2526                                            query.append(_SQL_SELECT_TASKSREVIEW);
2527    
2528                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2529                                                    orderByComparator);
2530    
2531                                            sql = query.toString();
2532                                    }
2533                                    else {
2534                                            sql = _SQL_SELECT_TASKSREVIEW.concat(TasksReviewModelImpl.ORDER_BY_JPQL);
2535                                    }
2536    
2537                                    Query q = session.createQuery(sql);
2538    
2539                                    if (orderByComparator == null) {
2540                                            list = (List<TasksReview>)QueryUtil.list(q, getDialect(),
2541                                                            start, end, false);
2542    
2543                                            Collections.sort(list);
2544                                    }
2545                                    else {
2546                                            list = (List<TasksReview>)QueryUtil.list(q, getDialect(),
2547                                                            start, end);
2548                                    }
2549                            }
2550                            catch (Exception e) {
2551                                    throw processException(e);
2552                            }
2553                            finally {
2554                                    if (list == null) {
2555                                            list = new ArrayList<TasksReview>();
2556                                    }
2557    
2558                                    cacheResult(list);
2559    
2560                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
2561    
2562                                    closeSession(session);
2563                            }
2564                    }
2565    
2566                    return list;
2567            }
2568    
2569            /**
2570             * Removes all the tasks reviews where userId = &#63; from the database.
2571             *
2572             * @param userId the user id to search with
2573             * @throws SystemException if a system exception occurred
2574             */
2575            public void removeByUserId(long userId) throws SystemException {
2576                    for (TasksReview tasksReview : findByUserId(userId)) {
2577                            remove(tasksReview);
2578                    }
2579            }
2580    
2581            /**
2582             * Removes all the tasks reviews where proposalId = &#63; from the database.
2583             *
2584             * @param proposalId the proposal id to search with
2585             * @throws SystemException if a system exception occurred
2586             */
2587            public void removeByProposalId(long proposalId) throws SystemException {
2588                    for (TasksReview tasksReview : findByProposalId(proposalId)) {
2589                            remove(tasksReview);
2590                    }
2591            }
2592    
2593            /**
2594             * Removes the tasks review where userId = &#63; and proposalId = &#63; from the database.
2595             *
2596             * @param userId the user id to search with
2597             * @param proposalId the proposal id to search with
2598             * @throws SystemException if a system exception occurred
2599             */
2600            public void removeByU_P(long userId, long proposalId)
2601                    throws NoSuchReviewException, SystemException {
2602                    TasksReview tasksReview = findByU_P(userId, proposalId);
2603    
2604                    remove(tasksReview);
2605            }
2606    
2607            /**
2608             * Removes all the tasks reviews where proposalId = &#63; and stage = &#63; from the database.
2609             *
2610             * @param proposalId the proposal id to search with
2611             * @param stage the stage to search with
2612             * @throws SystemException if a system exception occurred
2613             */
2614            public void removeByP_S(long proposalId, int stage)
2615                    throws SystemException {
2616                    for (TasksReview tasksReview : findByP_S(proposalId, stage)) {
2617                            remove(tasksReview);
2618                    }
2619            }
2620    
2621            /**
2622             * Removes all the tasks reviews where proposalId = &#63; and stage = &#63; and completed = &#63; from the database.
2623             *
2624             * @param proposalId the proposal id to search with
2625             * @param stage the stage to search with
2626             * @param completed the completed to search with
2627             * @throws SystemException if a system exception occurred
2628             */
2629            public void removeByP_S_C(long proposalId, int stage, boolean completed)
2630                    throws SystemException {
2631                    for (TasksReview tasksReview : findByP_S_C(proposalId, stage, completed)) {
2632                            remove(tasksReview);
2633                    }
2634            }
2635    
2636            /**
2637             * Removes all the tasks reviews where proposalId = &#63; and stage = &#63; and completed = &#63; and rejected = &#63; from the database.
2638             *
2639             * @param proposalId the proposal id to search with
2640             * @param stage the stage to search with
2641             * @param completed the completed to search with
2642             * @param rejected the rejected to search with
2643             * @throws SystemException if a system exception occurred
2644             */
2645            public void removeByP_S_C_R(long proposalId, int stage, boolean completed,
2646                    boolean rejected) throws SystemException {
2647                    for (TasksReview tasksReview : findByP_S_C_R(proposalId, stage,
2648                                    completed, rejected)) {
2649                            remove(tasksReview);
2650                    }
2651            }
2652    
2653            /**
2654             * Removes all the tasks reviews from the database.
2655             *
2656             * @throws SystemException if a system exception occurred
2657             */
2658            public void removeAll() throws SystemException {
2659                    for (TasksReview tasksReview : findAll()) {
2660                            remove(tasksReview);
2661                    }
2662            }
2663    
2664            /**
2665             * Counts all the tasks reviews where userId = &#63;.
2666             *
2667             * @param userId the user id to search with
2668             * @return the number of matching tasks reviews
2669             * @throws SystemException if a system exception occurred
2670             */
2671            public int countByUserId(long userId) throws SystemException {
2672                    Object[] finderArgs = new Object[] { userId };
2673    
2674                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
2675                                    finderArgs, this);
2676    
2677                    if (count == null) {
2678                            Session session = null;
2679    
2680                            try {
2681                                    session = openSession();
2682    
2683                                    StringBundler query = new StringBundler(2);
2684    
2685                                    query.append(_SQL_COUNT_TASKSREVIEW_WHERE);
2686    
2687                                    query.append(_FINDER_COLUMN_USERID_USERID_2);
2688    
2689                                    String sql = query.toString();
2690    
2691                                    Query q = session.createQuery(sql);
2692    
2693                                    QueryPos qPos = QueryPos.getInstance(q);
2694    
2695                                    qPos.add(userId);
2696    
2697                                    count = (Long)q.uniqueResult();
2698                            }
2699                            catch (Exception e) {
2700                                    throw processException(e);
2701                            }
2702                            finally {
2703                                    if (count == null) {
2704                                            count = Long.valueOf(0);
2705                                    }
2706    
2707                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
2708                                            finderArgs, count);
2709    
2710                                    closeSession(session);
2711                            }
2712                    }
2713    
2714                    return count.intValue();
2715            }
2716    
2717            /**
2718             * Counts all the tasks reviews where proposalId = &#63;.
2719             *
2720             * @param proposalId the proposal id to search with
2721             * @return the number of matching tasks reviews
2722             * @throws SystemException if a system exception occurred
2723             */
2724            public int countByProposalId(long proposalId) throws SystemException {
2725                    Object[] finderArgs = new Object[] { proposalId };
2726    
2727                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_PROPOSALID,
2728                                    finderArgs, this);
2729    
2730                    if (count == null) {
2731                            Session session = null;
2732    
2733                            try {
2734                                    session = openSession();
2735    
2736                                    StringBundler query = new StringBundler(2);
2737    
2738                                    query.append(_SQL_COUNT_TASKSREVIEW_WHERE);
2739    
2740                                    query.append(_FINDER_COLUMN_PROPOSALID_PROPOSALID_2);
2741    
2742                                    String sql = query.toString();
2743    
2744                                    Query q = session.createQuery(sql);
2745    
2746                                    QueryPos qPos = QueryPos.getInstance(q);
2747    
2748                                    qPos.add(proposalId);
2749    
2750                                    count = (Long)q.uniqueResult();
2751                            }
2752                            catch (Exception e) {
2753                                    throw processException(e);
2754                            }
2755                            finally {
2756                                    if (count == null) {
2757                                            count = Long.valueOf(0);
2758                                    }
2759    
2760                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_PROPOSALID,
2761                                            finderArgs, count);
2762    
2763                                    closeSession(session);
2764                            }
2765                    }
2766    
2767                    return count.intValue();
2768            }
2769    
2770            /**
2771             * Counts all the tasks reviews where userId = &#63; and proposalId = &#63;.
2772             *
2773             * @param userId the user id to search with
2774             * @param proposalId the proposal id to search with
2775             * @return the number of matching tasks reviews
2776             * @throws SystemException if a system exception occurred
2777             */
2778            public int countByU_P(long userId, long proposalId)
2779                    throws SystemException {
2780                    Object[] finderArgs = new Object[] { userId, proposalId };
2781    
2782                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_P,
2783                                    finderArgs, this);
2784    
2785                    if (count == null) {
2786                            Session session = null;
2787    
2788                            try {
2789                                    session = openSession();
2790    
2791                                    StringBundler query = new StringBundler(3);
2792    
2793                                    query.append(_SQL_COUNT_TASKSREVIEW_WHERE);
2794    
2795                                    query.append(_FINDER_COLUMN_U_P_USERID_2);
2796    
2797                                    query.append(_FINDER_COLUMN_U_P_PROPOSALID_2);
2798    
2799                                    String sql = query.toString();
2800    
2801                                    Query q = session.createQuery(sql);
2802    
2803                                    QueryPos qPos = QueryPos.getInstance(q);
2804    
2805                                    qPos.add(userId);
2806    
2807                                    qPos.add(proposalId);
2808    
2809                                    count = (Long)q.uniqueResult();
2810                            }
2811                            catch (Exception e) {
2812                                    throw processException(e);
2813                            }
2814                            finally {
2815                                    if (count == null) {
2816                                            count = Long.valueOf(0);
2817                                    }
2818    
2819                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_P, finderArgs,
2820                                            count);
2821    
2822                                    closeSession(session);
2823                            }
2824                    }
2825    
2826                    return count.intValue();
2827            }
2828    
2829            /**
2830             * Counts all the tasks reviews where proposalId = &#63; and stage = &#63;.
2831             *
2832             * @param proposalId the proposal id to search with
2833             * @param stage the stage to search with
2834             * @return the number of matching tasks reviews
2835             * @throws SystemException if a system exception occurred
2836             */
2837            public int countByP_S(long proposalId, int stage) throws SystemException {
2838                    Object[] finderArgs = new Object[] { proposalId, stage };
2839    
2840                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_P_S,
2841                                    finderArgs, this);
2842    
2843                    if (count == null) {
2844                            Session session = null;
2845    
2846                            try {
2847                                    session = openSession();
2848    
2849                                    StringBundler query = new StringBundler(3);
2850    
2851                                    query.append(_SQL_COUNT_TASKSREVIEW_WHERE);
2852    
2853                                    query.append(_FINDER_COLUMN_P_S_PROPOSALID_2);
2854    
2855                                    query.append(_FINDER_COLUMN_P_S_STAGE_2);
2856    
2857                                    String sql = query.toString();
2858    
2859                                    Query q = session.createQuery(sql);
2860    
2861                                    QueryPos qPos = QueryPos.getInstance(q);
2862    
2863                                    qPos.add(proposalId);
2864    
2865                                    qPos.add(stage);
2866    
2867                                    count = (Long)q.uniqueResult();
2868                            }
2869                            catch (Exception e) {
2870                                    throw processException(e);
2871                            }
2872                            finally {
2873                                    if (count == null) {
2874                                            count = Long.valueOf(0);
2875                                    }
2876    
2877                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_P_S, finderArgs,
2878                                            count);
2879    
2880                                    closeSession(session);
2881                            }
2882                    }
2883    
2884                    return count.intValue();
2885            }
2886    
2887            /**
2888             * Counts all the tasks reviews where proposalId = &#63; and stage = &#63; and completed = &#63;.
2889             *
2890             * @param proposalId the proposal id to search with
2891             * @param stage the stage to search with
2892             * @param completed the completed to search with
2893             * @return the number of matching tasks reviews
2894             * @throws SystemException if a system exception occurred
2895             */
2896            public int countByP_S_C(long proposalId, int stage, boolean completed)
2897                    throws SystemException {
2898                    Object[] finderArgs = new Object[] { proposalId, stage, completed };
2899    
2900                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_P_S_C,
2901                                    finderArgs, this);
2902    
2903                    if (count == null) {
2904                            Session session = null;
2905    
2906                            try {
2907                                    session = openSession();
2908    
2909                                    StringBundler query = new StringBundler(4);
2910    
2911                                    query.append(_SQL_COUNT_TASKSREVIEW_WHERE);
2912    
2913                                    query.append(_FINDER_COLUMN_P_S_C_PROPOSALID_2);
2914    
2915                                    query.append(_FINDER_COLUMN_P_S_C_STAGE_2);
2916    
2917                                    query.append(_FINDER_COLUMN_P_S_C_COMPLETED_2);
2918    
2919                                    String sql = query.toString();
2920    
2921                                    Query q = session.createQuery(sql);
2922    
2923                                    QueryPos qPos = QueryPos.getInstance(q);
2924    
2925                                    qPos.add(proposalId);
2926    
2927                                    qPos.add(stage);
2928    
2929                                    qPos.add(completed);
2930    
2931                                    count = (Long)q.uniqueResult();
2932                            }
2933                            catch (Exception e) {
2934                                    throw processException(e);
2935                            }
2936                            finally {
2937                                    if (count == null) {
2938                                            count = Long.valueOf(0);
2939                                    }
2940    
2941                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_P_S_C,
2942                                            finderArgs, count);
2943    
2944                                    closeSession(session);
2945                            }
2946                    }
2947    
2948                    return count.intValue();
2949            }
2950    
2951            /**
2952             * Counts all the tasks reviews where proposalId = &#63; and stage = &#63; and completed = &#63; and rejected = &#63;.
2953             *
2954             * @param proposalId the proposal id to search with
2955             * @param stage the stage to search with
2956             * @param completed the completed to search with
2957             * @param rejected the rejected to search with
2958             * @return the number of matching tasks reviews
2959             * @throws SystemException if a system exception occurred
2960             */
2961            public int countByP_S_C_R(long proposalId, int stage, boolean completed,
2962                    boolean rejected) throws SystemException {
2963                    Object[] finderArgs = new Object[] {
2964                                    proposalId, stage, completed, rejected
2965                            };
2966    
2967                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_P_S_C_R,
2968                                    finderArgs, this);
2969    
2970                    if (count == null) {
2971                            Session session = null;
2972    
2973                            try {
2974                                    session = openSession();
2975    
2976                                    StringBundler query = new StringBundler(5);
2977    
2978                                    query.append(_SQL_COUNT_TASKSREVIEW_WHERE);
2979    
2980                                    query.append(_FINDER_COLUMN_P_S_C_R_PROPOSALID_2);
2981    
2982                                    query.append(_FINDER_COLUMN_P_S_C_R_STAGE_2);
2983    
2984                                    query.append(_FINDER_COLUMN_P_S_C_R_COMPLETED_2);
2985    
2986                                    query.append(_FINDER_COLUMN_P_S_C_R_REJECTED_2);
2987    
2988                                    String sql = query.toString();
2989    
2990                                    Query q = session.createQuery(sql);
2991    
2992                                    QueryPos qPos = QueryPos.getInstance(q);
2993    
2994                                    qPos.add(proposalId);
2995    
2996                                    qPos.add(stage);
2997    
2998                                    qPos.add(completed);
2999    
3000                                    qPos.add(rejected);
3001    
3002                                    count = (Long)q.uniqueResult();
3003                            }
3004                            catch (Exception e) {
3005                                    throw processException(e);
3006                            }
3007                            finally {
3008                                    if (count == null) {
3009                                            count = Long.valueOf(0);
3010                                    }
3011    
3012                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_P_S_C_R,
3013                                            finderArgs, count);
3014    
3015                                    closeSession(session);
3016                            }
3017                    }
3018    
3019                    return count.intValue();
3020            }
3021    
3022            /**
3023             * Counts all the tasks reviews.
3024             *
3025             * @return the number of tasks reviews
3026             * @throws SystemException if a system exception occurred
3027             */
3028            public int countAll() throws SystemException {
3029                    Object[] finderArgs = new Object[0];
3030    
3031                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3032                                    finderArgs, this);
3033    
3034                    if (count == null) {
3035                            Session session = null;
3036    
3037                            try {
3038                                    session = openSession();
3039    
3040                                    Query q = session.createQuery(_SQL_COUNT_TASKSREVIEW);
3041    
3042                                    count = (Long)q.uniqueResult();
3043                            }
3044                            catch (Exception e) {
3045                                    throw processException(e);
3046                            }
3047                            finally {
3048                                    if (count == null) {
3049                                            count = Long.valueOf(0);
3050                                    }
3051    
3052                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
3053                                            count);
3054    
3055                                    closeSession(session);
3056                            }
3057                    }
3058    
3059                    return count.intValue();
3060            }
3061    
3062            /**
3063             * Initializes the tasks review persistence.
3064             */
3065            public void afterPropertiesSet() {
3066                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3067                                            com.liferay.portal.util.PropsUtil.get(
3068                                                    "value.object.listener.com.liferay.portlet.tasks.model.TasksReview")));
3069    
3070                    if (listenerClassNames.length > 0) {
3071                            try {
3072                                    List<ModelListener<TasksReview>> listenersList = new ArrayList<ModelListener<TasksReview>>();
3073    
3074                                    for (String listenerClassName : listenerClassNames) {
3075                                            listenersList.add((ModelListener<TasksReview>)InstanceFactory.newInstance(
3076                                                            listenerClassName));
3077                                    }
3078    
3079                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3080                            }
3081                            catch (Exception e) {
3082                                    _log.error(e);
3083                            }
3084                    }
3085            }
3086    
3087            @BeanReference(type = TasksProposalPersistence.class)
3088            protected TasksProposalPersistence tasksProposalPersistence;
3089            @BeanReference(type = TasksReviewPersistence.class)
3090            protected TasksReviewPersistence tasksReviewPersistence;
3091            @BeanReference(type = ResourcePersistence.class)
3092            protected ResourcePersistence resourcePersistence;
3093            @BeanReference(type = UserPersistence.class)
3094            protected UserPersistence userPersistence;
3095            @BeanReference(type = SocialActivityPersistence.class)
3096            protected SocialActivityPersistence socialActivityPersistence;
3097            private static final String _SQL_SELECT_TASKSREVIEW = "SELECT tasksReview FROM TasksReview tasksReview";
3098            private static final String _SQL_SELECT_TASKSREVIEW_WHERE = "SELECT tasksReview FROM TasksReview tasksReview WHERE ";
3099            private static final String _SQL_COUNT_TASKSREVIEW = "SELECT COUNT(tasksReview) FROM TasksReview tasksReview";
3100            private static final String _SQL_COUNT_TASKSREVIEW_WHERE = "SELECT COUNT(tasksReview) FROM TasksReview tasksReview WHERE ";
3101            private static final String _FINDER_COLUMN_USERID_USERID_2 = "tasksReview.userId = ?";
3102            private static final String _FINDER_COLUMN_PROPOSALID_PROPOSALID_2 = "tasksReview.proposalId = ?";
3103            private static final String _FINDER_COLUMN_U_P_USERID_2 = "tasksReview.userId = ? AND ";
3104            private static final String _FINDER_COLUMN_U_P_PROPOSALID_2 = "tasksReview.proposalId = ?";
3105            private static final String _FINDER_COLUMN_P_S_PROPOSALID_2 = "tasksReview.proposalId = ? AND ";
3106            private static final String _FINDER_COLUMN_P_S_STAGE_2 = "tasksReview.stage = ?";
3107            private static final String _FINDER_COLUMN_P_S_C_PROPOSALID_2 = "tasksReview.proposalId = ? AND ";
3108            private static final String _FINDER_COLUMN_P_S_C_STAGE_2 = "tasksReview.stage = ? AND ";
3109            private static final String _FINDER_COLUMN_P_S_C_COMPLETED_2 = "tasksReview.completed = ?";
3110            private static final String _FINDER_COLUMN_P_S_C_R_PROPOSALID_2 = "tasksReview.proposalId = ? AND ";
3111            private static final String _FINDER_COLUMN_P_S_C_R_STAGE_2 = "tasksReview.stage = ? AND ";
3112            private static final String _FINDER_COLUMN_P_S_C_R_COMPLETED_2 = "tasksReview.completed = ? AND ";
3113            private static final String _FINDER_COLUMN_P_S_C_R_REJECTED_2 = "tasksReview.rejected = ?";
3114            private static final String _ORDER_BY_ENTITY_ALIAS = "tasksReview.";
3115            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No TasksReview exists with the primary key ";
3116            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No TasksReview exists with the key {";
3117            private static Log _log = LogFactoryUtil.getLog(TasksReviewPersistenceImpl.class);
3118    }