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