001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.polls.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.SQLQuery;
027    import com.liferay.portal.kernel.dao.orm.Session;
028    import com.liferay.portal.kernel.exception.SystemException;
029    import com.liferay.portal.kernel.log.Log;
030    import com.liferay.portal.kernel.log.LogFactoryUtil;
031    import com.liferay.portal.kernel.util.GetterUtil;
032    import com.liferay.portal.kernel.util.InstanceFactory;
033    import com.liferay.portal.kernel.util.OrderByComparator;
034    import com.liferay.portal.kernel.util.StringBundler;
035    import com.liferay.portal.kernel.util.StringPool;
036    import com.liferay.portal.kernel.util.StringUtil;
037    import com.liferay.portal.kernel.util.Validator;
038    import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
039    import com.liferay.portal.model.ModelListener;
040    import com.liferay.portal.security.permission.InlineSQLHelperUtil;
041    import com.liferay.portal.service.persistence.BatchSessionUtil;
042    import com.liferay.portal.service.persistence.ResourcePersistence;
043    import com.liferay.portal.service.persistence.UserPersistence;
044    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
045    
046    import com.liferay.portlet.polls.NoSuchQuestionException;
047    import com.liferay.portlet.polls.model.PollsQuestion;
048    import com.liferay.portlet.polls.model.impl.PollsQuestionImpl;
049    import com.liferay.portlet.polls.model.impl.PollsQuestionModelImpl;
050    
051    import java.io.Serializable;
052    
053    import java.util.ArrayList;
054    import java.util.Collections;
055    import java.util.List;
056    
057    /**
058     * The persistence implementation for the polls question service.
059     *
060     * <p>
061     * Never modify or reference this class directly. Always use {@link PollsQuestionUtil} to access the polls question persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
062     * </p>
063     *
064     * <p>
065     * Caching information and settings can be found in <code>portal.properties</code>
066     * </p>
067     *
068     * @author Brian Wing Shun Chan
069     * @see PollsQuestionPersistence
070     * @see PollsQuestionUtil
071     * @generated
072     */
073    public class PollsQuestionPersistenceImpl extends BasePersistenceImpl<PollsQuestion>
074            implements PollsQuestionPersistence {
075            public static final String FINDER_CLASS_NAME_ENTITY = PollsQuestionImpl.class.getName();
076            public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
077                    ".List";
078            public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
079                            PollsQuestionModelImpl.FINDER_CACHE_ENABLED,
080                            FINDER_CLASS_NAME_LIST, "findByUuid",
081                            new String[] {
082                                    String.class.getName(),
083                                    
084                            "java.lang.Integer", "java.lang.Integer",
085                                    "com.liferay.portal.kernel.util.OrderByComparator"
086                            });
087            public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
088                            PollsQuestionModelImpl.FINDER_CACHE_ENABLED,
089                            FINDER_CLASS_NAME_LIST, "countByUuid",
090                            new String[] { String.class.getName() });
091            public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
092                            PollsQuestionModelImpl.FINDER_CACHE_ENABLED,
093                            FINDER_CLASS_NAME_ENTITY, "fetchByUUID_G",
094                            new String[] { String.class.getName(), Long.class.getName() });
095            public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
096                            PollsQuestionModelImpl.FINDER_CACHE_ENABLED,
097                            FINDER_CLASS_NAME_LIST, "countByUUID_G",
098                            new String[] { String.class.getName(), Long.class.getName() });
099            public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
100                            PollsQuestionModelImpl.FINDER_CACHE_ENABLED,
101                            FINDER_CLASS_NAME_LIST, "findByGroupId",
102                            new String[] {
103                                    Long.class.getName(),
104                                    
105                            "java.lang.Integer", "java.lang.Integer",
106                                    "com.liferay.portal.kernel.util.OrderByComparator"
107                            });
108            public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
109                            PollsQuestionModelImpl.FINDER_CACHE_ENABLED,
110                            FINDER_CLASS_NAME_LIST, "countByGroupId",
111                            new String[] { Long.class.getName() });
112            public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
113                            PollsQuestionModelImpl.FINDER_CACHE_ENABLED,
114                            FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
115            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
116                            PollsQuestionModelImpl.FINDER_CACHE_ENABLED,
117                            FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
118    
119            /**
120             * Caches the polls question in the entity cache if it is enabled.
121             *
122             * @param pollsQuestion the polls question to cache
123             */
124            public void cacheResult(PollsQuestion pollsQuestion) {
125                    EntityCacheUtil.putResult(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
126                            PollsQuestionImpl.class, pollsQuestion.getPrimaryKey(),
127                            pollsQuestion);
128    
129                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
130                            new Object[] {
131                                    pollsQuestion.getUuid(), new Long(pollsQuestion.getGroupId())
132                            }, pollsQuestion);
133            }
134    
135            /**
136             * Caches the polls questions in the entity cache if it is enabled.
137             *
138             * @param pollsQuestions the polls questions to cache
139             */
140            public void cacheResult(List<PollsQuestion> pollsQuestions) {
141                    for (PollsQuestion pollsQuestion : pollsQuestions) {
142                            if (EntityCacheUtil.getResult(
143                                                    PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
144                                                    PollsQuestionImpl.class, pollsQuestion.getPrimaryKey(),
145                                                    this) == null) {
146                                    cacheResult(pollsQuestion);
147                            }
148                    }
149            }
150    
151            /**
152             * Clears the cache for all polls questions.
153             *
154             * <p>
155             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
156             * </p>
157             */
158            public void clearCache() {
159                    CacheRegistryUtil.clear(PollsQuestionImpl.class.getName());
160                    EntityCacheUtil.clearCache(PollsQuestionImpl.class.getName());
161                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
162                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
163            }
164    
165            /**
166             * Clears the cache for the polls question.
167             *
168             * <p>
169             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
170             * </p>
171             */
172            public void clearCache(PollsQuestion pollsQuestion) {
173                    EntityCacheUtil.removeResult(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
174                            PollsQuestionImpl.class, pollsQuestion.getPrimaryKey());
175    
176                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
177                            new Object[] {
178                                    pollsQuestion.getUuid(), new Long(pollsQuestion.getGroupId())
179                            });
180            }
181    
182            /**
183             * Creates a new polls question with the primary key. Does not add the polls question to the database.
184             *
185             * @param questionId the primary key for the new polls question
186             * @return the new polls question
187             */
188            public PollsQuestion create(long questionId) {
189                    PollsQuestion pollsQuestion = new PollsQuestionImpl();
190    
191                    pollsQuestion.setNew(true);
192                    pollsQuestion.setPrimaryKey(questionId);
193    
194                    String uuid = PortalUUIDUtil.generate();
195    
196                    pollsQuestion.setUuid(uuid);
197    
198                    return pollsQuestion;
199            }
200    
201            /**
202             * Removes the polls question with the primary key from the database. Also notifies the appropriate model listeners.
203             *
204             * @param primaryKey the primary key of the polls question to remove
205             * @return the polls question that was removed
206             * @throws com.liferay.portal.NoSuchModelException if a polls question with the primary key could not be found
207             * @throws SystemException if a system exception occurred
208             */
209            public PollsQuestion remove(Serializable primaryKey)
210                    throws NoSuchModelException, SystemException {
211                    return remove(((Long)primaryKey).longValue());
212            }
213    
214            /**
215             * Removes the polls question with the primary key from the database. Also notifies the appropriate model listeners.
216             *
217             * @param questionId the primary key of the polls question to remove
218             * @return the polls question that was removed
219             * @throws com.liferay.portlet.polls.NoSuchQuestionException if a polls question with the primary key could not be found
220             * @throws SystemException if a system exception occurred
221             */
222            public PollsQuestion remove(long questionId)
223                    throws NoSuchQuestionException, SystemException {
224                    Session session = null;
225    
226                    try {
227                            session = openSession();
228    
229                            PollsQuestion pollsQuestion = (PollsQuestion)session.get(PollsQuestionImpl.class,
230                                            new Long(questionId));
231    
232                            if (pollsQuestion == null) {
233                                    if (_log.isWarnEnabled()) {
234                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + questionId);
235                                    }
236    
237                                    throw new NoSuchQuestionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
238                                            questionId);
239                            }
240    
241                            return remove(pollsQuestion);
242                    }
243                    catch (NoSuchQuestionException nsee) {
244                            throw nsee;
245                    }
246                    catch (Exception e) {
247                            throw processException(e);
248                    }
249                    finally {
250                            closeSession(session);
251                    }
252            }
253    
254            protected PollsQuestion removeImpl(PollsQuestion pollsQuestion)
255                    throws SystemException {
256                    pollsQuestion = toUnwrappedModel(pollsQuestion);
257    
258                    Session session = null;
259    
260                    try {
261                            session = openSession();
262    
263                            if (pollsQuestion.isCachedModel() || BatchSessionUtil.isEnabled()) {
264                                    Object staleObject = session.get(PollsQuestionImpl.class,
265                                                    pollsQuestion.getPrimaryKeyObj());
266    
267                                    if (staleObject != null) {
268                                            session.evict(staleObject);
269                                    }
270                            }
271    
272                            session.delete(pollsQuestion);
273    
274                            session.flush();
275                    }
276                    catch (Exception e) {
277                            throw processException(e);
278                    }
279                    finally {
280                            closeSession(session);
281                    }
282    
283                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
284    
285                    PollsQuestionModelImpl pollsQuestionModelImpl = (PollsQuestionModelImpl)pollsQuestion;
286    
287                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
288                            new Object[] {
289                                    pollsQuestionModelImpl.getOriginalUuid(),
290                                    new Long(pollsQuestionModelImpl.getOriginalGroupId())
291                            });
292    
293                    EntityCacheUtil.removeResult(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
294                            PollsQuestionImpl.class, pollsQuestion.getPrimaryKey());
295    
296                    return pollsQuestion;
297            }
298    
299            public PollsQuestion updateImpl(
300                    com.liferay.portlet.polls.model.PollsQuestion pollsQuestion,
301                    boolean merge) throws SystemException {
302                    pollsQuestion = toUnwrappedModel(pollsQuestion);
303    
304                    boolean isNew = pollsQuestion.isNew();
305    
306                    PollsQuestionModelImpl pollsQuestionModelImpl = (PollsQuestionModelImpl)pollsQuestion;
307    
308                    if (Validator.isNull(pollsQuestion.getUuid())) {
309                            String uuid = PortalUUIDUtil.generate();
310    
311                            pollsQuestion.setUuid(uuid);
312                    }
313    
314                    Session session = null;
315    
316                    try {
317                            session = openSession();
318    
319                            BatchSessionUtil.update(session, pollsQuestion, merge);
320    
321                            pollsQuestion.setNew(false);
322                    }
323                    catch (Exception e) {
324                            throw processException(e);
325                    }
326                    finally {
327                            closeSession(session);
328                    }
329    
330                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
331    
332                    EntityCacheUtil.putResult(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
333                            PollsQuestionImpl.class, pollsQuestion.getPrimaryKey(),
334                            pollsQuestion);
335    
336                    if (!isNew &&
337                                    (!Validator.equals(pollsQuestion.getUuid(),
338                                            pollsQuestionModelImpl.getOriginalUuid()) ||
339                                    (pollsQuestion.getGroupId() != pollsQuestionModelImpl.getOriginalGroupId()))) {
340                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
341                                    new Object[] {
342                                            pollsQuestionModelImpl.getOriginalUuid(),
343                                            new Long(pollsQuestionModelImpl.getOriginalGroupId())
344                                    });
345                    }
346    
347                    if (isNew ||
348                                    (!Validator.equals(pollsQuestion.getUuid(),
349                                            pollsQuestionModelImpl.getOriginalUuid()) ||
350                                    (pollsQuestion.getGroupId() != pollsQuestionModelImpl.getOriginalGroupId()))) {
351                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
352                                    new Object[] {
353                                            pollsQuestion.getUuid(),
354                                            new Long(pollsQuestion.getGroupId())
355                                    }, pollsQuestion);
356                    }
357    
358                    return pollsQuestion;
359            }
360    
361            protected PollsQuestion toUnwrappedModel(PollsQuestion pollsQuestion) {
362                    if (pollsQuestion instanceof PollsQuestionImpl) {
363                            return pollsQuestion;
364                    }
365    
366                    PollsQuestionImpl pollsQuestionImpl = new PollsQuestionImpl();
367    
368                    pollsQuestionImpl.setNew(pollsQuestion.isNew());
369                    pollsQuestionImpl.setPrimaryKey(pollsQuestion.getPrimaryKey());
370    
371                    pollsQuestionImpl.setUuid(pollsQuestion.getUuid());
372                    pollsQuestionImpl.setQuestionId(pollsQuestion.getQuestionId());
373                    pollsQuestionImpl.setGroupId(pollsQuestion.getGroupId());
374                    pollsQuestionImpl.setCompanyId(pollsQuestion.getCompanyId());
375                    pollsQuestionImpl.setUserId(pollsQuestion.getUserId());
376                    pollsQuestionImpl.setUserName(pollsQuestion.getUserName());
377                    pollsQuestionImpl.setCreateDate(pollsQuestion.getCreateDate());
378                    pollsQuestionImpl.setModifiedDate(pollsQuestion.getModifiedDate());
379                    pollsQuestionImpl.setTitle(pollsQuestion.getTitle());
380                    pollsQuestionImpl.setDescription(pollsQuestion.getDescription());
381                    pollsQuestionImpl.setExpirationDate(pollsQuestion.getExpirationDate());
382                    pollsQuestionImpl.setLastVoteDate(pollsQuestion.getLastVoteDate());
383    
384                    return pollsQuestionImpl;
385            }
386    
387            /**
388             * Finds the polls question with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
389             *
390             * @param primaryKey the primary key of the polls question to find
391             * @return the polls question
392             * @throws com.liferay.portal.NoSuchModelException if a polls question with the primary key could not be found
393             * @throws SystemException if a system exception occurred
394             */
395            public PollsQuestion findByPrimaryKey(Serializable primaryKey)
396                    throws NoSuchModelException, SystemException {
397                    return findByPrimaryKey(((Long)primaryKey).longValue());
398            }
399    
400            /**
401             * Finds the polls question with the primary key or throws a {@link com.liferay.portlet.polls.NoSuchQuestionException} if it could not be found.
402             *
403             * @param questionId the primary key of the polls question to find
404             * @return the polls question
405             * @throws com.liferay.portlet.polls.NoSuchQuestionException if a polls question with the primary key could not be found
406             * @throws SystemException if a system exception occurred
407             */
408            public PollsQuestion findByPrimaryKey(long questionId)
409                    throws NoSuchQuestionException, SystemException {
410                    PollsQuestion pollsQuestion = fetchByPrimaryKey(questionId);
411    
412                    if (pollsQuestion == null) {
413                            if (_log.isWarnEnabled()) {
414                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + questionId);
415                            }
416    
417                            throw new NoSuchQuestionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
418                                    questionId);
419                    }
420    
421                    return pollsQuestion;
422            }
423    
424            /**
425             * Finds the polls question with the primary key or returns <code>null</code> if it could not be found.
426             *
427             * @param primaryKey the primary key of the polls question to find
428             * @return the polls question, or <code>null</code> if a polls question with the primary key could not be found
429             * @throws SystemException if a system exception occurred
430             */
431            public PollsQuestion fetchByPrimaryKey(Serializable primaryKey)
432                    throws SystemException {
433                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
434            }
435    
436            /**
437             * Finds the polls question with the primary key or returns <code>null</code> if it could not be found.
438             *
439             * @param questionId the primary key of the polls question to find
440             * @return the polls question, or <code>null</code> if a polls question with the primary key could not be found
441             * @throws SystemException if a system exception occurred
442             */
443            public PollsQuestion fetchByPrimaryKey(long questionId)
444                    throws SystemException {
445                    PollsQuestion pollsQuestion = (PollsQuestion)EntityCacheUtil.getResult(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
446                                    PollsQuestionImpl.class, questionId, this);
447    
448                    if (pollsQuestion == null) {
449                            Session session = null;
450    
451                            try {
452                                    session = openSession();
453    
454                                    pollsQuestion = (PollsQuestion)session.get(PollsQuestionImpl.class,
455                                                    new Long(questionId));
456                            }
457                            catch (Exception e) {
458                                    throw processException(e);
459                            }
460                            finally {
461                                    if (pollsQuestion != null) {
462                                            cacheResult(pollsQuestion);
463                                    }
464    
465                                    closeSession(session);
466                            }
467                    }
468    
469                    return pollsQuestion;
470            }
471    
472            /**
473             * Finds all the polls questions where uuid = &#63;.
474             *
475             * @param uuid the uuid to search with
476             * @return the matching polls questions
477             * @throws SystemException if a system exception occurred
478             */
479            public List<PollsQuestion> findByUuid(String uuid)
480                    throws SystemException {
481                    return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
482            }
483    
484            /**
485             * Finds a range of all the polls questions where uuid = &#63;.
486             *
487             * <p>
488             * 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.
489             * </p>
490             *
491             * @param uuid the uuid to search with
492             * @param start the lower bound of the range of polls questions to return
493             * @param end the upper bound of the range of polls questions to return (not inclusive)
494             * @return the range of matching polls questions
495             * @throws SystemException if a system exception occurred
496             */
497            public List<PollsQuestion> findByUuid(String uuid, int start, int end)
498                    throws SystemException {
499                    return findByUuid(uuid, start, end, null);
500            }
501    
502            /**
503             * Finds an ordered range of all the polls questions where uuid = &#63;.
504             *
505             * <p>
506             * 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.
507             * </p>
508             *
509             * @param uuid the uuid to search with
510             * @param start the lower bound of the range of polls questions to return
511             * @param end the upper bound of the range of polls questions to return (not inclusive)
512             * @param orderByComparator the comparator to order the results by
513             * @return the ordered range of matching polls questions
514             * @throws SystemException if a system exception occurred
515             */
516            public List<PollsQuestion> findByUuid(String uuid, int start, int end,
517                    OrderByComparator orderByComparator) throws SystemException {
518                    Object[] finderArgs = new Object[] {
519                                    uuid,
520                                    
521                                    String.valueOf(start), String.valueOf(end),
522                                    String.valueOf(orderByComparator)
523                            };
524    
525                    List<PollsQuestion> list = (List<PollsQuestion>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
526                                    finderArgs, this);
527    
528                    if (list == null) {
529                            Session session = null;
530    
531                            try {
532                                    session = openSession();
533    
534                                    StringBundler query = null;
535    
536                                    if (orderByComparator != null) {
537                                            query = new StringBundler(3 +
538                                                            (orderByComparator.getOrderByFields().length * 3));
539                                    }
540                                    else {
541                                            query = new StringBundler(3);
542                                    }
543    
544                                    query.append(_SQL_SELECT_POLLSQUESTION_WHERE);
545    
546                                    if (uuid == null) {
547                                            query.append(_FINDER_COLUMN_UUID_UUID_1);
548                                    }
549                                    else {
550                                            if (uuid.equals(StringPool.BLANK)) {
551                                                    query.append(_FINDER_COLUMN_UUID_UUID_3);
552                                            }
553                                            else {
554                                                    query.append(_FINDER_COLUMN_UUID_UUID_2);
555                                            }
556                                    }
557    
558                                    if (orderByComparator != null) {
559                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
560                                                    orderByComparator);
561                                    }
562    
563                                    else {
564                                            query.append(PollsQuestionModelImpl.ORDER_BY_JPQL);
565                                    }
566    
567                                    String sql = query.toString();
568    
569                                    Query q = session.createQuery(sql);
570    
571                                    QueryPos qPos = QueryPos.getInstance(q);
572    
573                                    if (uuid != null) {
574                                            qPos.add(uuid);
575                                    }
576    
577                                    list = (List<PollsQuestion>)QueryUtil.list(q, getDialect(),
578                                                    start, end);
579                            }
580                            catch (Exception e) {
581                                    throw processException(e);
582                            }
583                            finally {
584                                    if (list == null) {
585                                            list = new ArrayList<PollsQuestion>();
586                                    }
587    
588                                    cacheResult(list);
589    
590                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
591                                            list);
592    
593                                    closeSession(session);
594                            }
595                    }
596    
597                    return list;
598            }
599    
600            /**
601             * Finds the first polls question in the ordered set where uuid = &#63;.
602             *
603             * <p>
604             * 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.
605             * </p>
606             *
607             * @param uuid the uuid to search with
608             * @param orderByComparator the comparator to order the set by
609             * @return the first matching polls question
610             * @throws com.liferay.portlet.polls.NoSuchQuestionException if a matching polls question could not be found
611             * @throws SystemException if a system exception occurred
612             */
613            public PollsQuestion findByUuid_First(String uuid,
614                    OrderByComparator orderByComparator)
615                    throws NoSuchQuestionException, SystemException {
616                    List<PollsQuestion> list = findByUuid(uuid, 0, 1, orderByComparator);
617    
618                    if (list.isEmpty()) {
619                            StringBundler msg = new StringBundler(4);
620    
621                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
622    
623                            msg.append("uuid=");
624                            msg.append(uuid);
625    
626                            msg.append(StringPool.CLOSE_CURLY_BRACE);
627    
628                            throw new NoSuchQuestionException(msg.toString());
629                    }
630                    else {
631                            return list.get(0);
632                    }
633            }
634    
635            /**
636             * Finds the last polls question in the ordered set where uuid = &#63;.
637             *
638             * <p>
639             * 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.
640             * </p>
641             *
642             * @param uuid the uuid to search with
643             * @param orderByComparator the comparator to order the set by
644             * @return the last matching polls question
645             * @throws com.liferay.portlet.polls.NoSuchQuestionException if a matching polls question could not be found
646             * @throws SystemException if a system exception occurred
647             */
648            public PollsQuestion findByUuid_Last(String uuid,
649                    OrderByComparator orderByComparator)
650                    throws NoSuchQuestionException, SystemException {
651                    int count = countByUuid(uuid);
652    
653                    List<PollsQuestion> list = findByUuid(uuid, count - 1, count,
654                                    orderByComparator);
655    
656                    if (list.isEmpty()) {
657                            StringBundler msg = new StringBundler(4);
658    
659                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
660    
661                            msg.append("uuid=");
662                            msg.append(uuid);
663    
664                            msg.append(StringPool.CLOSE_CURLY_BRACE);
665    
666                            throw new NoSuchQuestionException(msg.toString());
667                    }
668                    else {
669                            return list.get(0);
670                    }
671            }
672    
673            /**
674             * Finds the polls questions before and after the current polls question in the ordered set where uuid = &#63;.
675             *
676             * <p>
677             * 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.
678             * </p>
679             *
680             * @param questionId the primary key of the current polls question
681             * @param uuid the uuid to search with
682             * @param orderByComparator the comparator to order the set by
683             * @return the previous, current, and next polls question
684             * @throws com.liferay.portlet.polls.NoSuchQuestionException if a polls question with the primary key could not be found
685             * @throws SystemException if a system exception occurred
686             */
687            public PollsQuestion[] findByUuid_PrevAndNext(long questionId, String uuid,
688                    OrderByComparator orderByComparator)
689                    throws NoSuchQuestionException, SystemException {
690                    PollsQuestion pollsQuestion = findByPrimaryKey(questionId);
691    
692                    Session session = null;
693    
694                    try {
695                            session = openSession();
696    
697                            PollsQuestion[] array = new PollsQuestionImpl[3];
698    
699                            array[0] = getByUuid_PrevAndNext(session, pollsQuestion, uuid,
700                                            orderByComparator, true);
701    
702                            array[1] = pollsQuestion;
703    
704                            array[2] = getByUuid_PrevAndNext(session, pollsQuestion, uuid,
705                                            orderByComparator, false);
706    
707                            return array;
708                    }
709                    catch (Exception e) {
710                            throw processException(e);
711                    }
712                    finally {
713                            closeSession(session);
714                    }
715            }
716    
717            protected PollsQuestion getByUuid_PrevAndNext(Session session,
718                    PollsQuestion pollsQuestion, String uuid,
719                    OrderByComparator orderByComparator, boolean previous) {
720                    StringBundler query = null;
721    
722                    if (orderByComparator != null) {
723                            query = new StringBundler(6 +
724                                            (orderByComparator.getOrderByFields().length * 6));
725                    }
726                    else {
727                            query = new StringBundler(3);
728                    }
729    
730                    query.append(_SQL_SELECT_POLLSQUESTION_WHERE);
731    
732                    if (uuid == null) {
733                            query.append(_FINDER_COLUMN_UUID_UUID_1);
734                    }
735                    else {
736                            if (uuid.equals(StringPool.BLANK)) {
737                                    query.append(_FINDER_COLUMN_UUID_UUID_3);
738                            }
739                            else {
740                                    query.append(_FINDER_COLUMN_UUID_UUID_2);
741                            }
742                    }
743    
744                    if (orderByComparator != null) {
745                            String[] orderByFields = orderByComparator.getOrderByFields();
746    
747                            if (orderByFields.length > 0) {
748                                    query.append(WHERE_AND);
749                            }
750    
751                            for (int i = 0; i < orderByFields.length; i++) {
752                                    query.append(_ORDER_BY_ENTITY_ALIAS);
753                                    query.append(orderByFields[i]);
754    
755                                    if ((i + 1) < orderByFields.length) {
756                                            if (orderByComparator.isAscending() ^ previous) {
757                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
758                                            }
759                                            else {
760                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
761                                            }
762                                    }
763                                    else {
764                                            if (orderByComparator.isAscending() ^ previous) {
765                                                    query.append(WHERE_GREATER_THAN);
766                                            }
767                                            else {
768                                                    query.append(WHERE_LESSER_THAN);
769                                            }
770                                    }
771                            }
772    
773                            query.append(ORDER_BY_CLAUSE);
774    
775                            for (int i = 0; i < orderByFields.length; i++) {
776                                    query.append(_ORDER_BY_ENTITY_ALIAS);
777                                    query.append(orderByFields[i]);
778    
779                                    if ((i + 1) < orderByFields.length) {
780                                            if (orderByComparator.isAscending() ^ previous) {
781                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
782                                            }
783                                            else {
784                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
785                                            }
786                                    }
787                                    else {
788                                            if (orderByComparator.isAscending() ^ previous) {
789                                                    query.append(ORDER_BY_ASC);
790                                            }
791                                            else {
792                                                    query.append(ORDER_BY_DESC);
793                                            }
794                                    }
795                            }
796                    }
797    
798                    else {
799                            query.append(PollsQuestionModelImpl.ORDER_BY_JPQL);
800                    }
801    
802                    String sql = query.toString();
803    
804                    Query q = session.createQuery(sql);
805    
806                    q.setFirstResult(0);
807                    q.setMaxResults(2);
808    
809                    QueryPos qPos = QueryPos.getInstance(q);
810    
811                    if (uuid != null) {
812                            qPos.add(uuid);
813                    }
814    
815                    if (orderByComparator != null) {
816                            Object[] values = orderByComparator.getOrderByValues(pollsQuestion);
817    
818                            for (Object value : values) {
819                                    qPos.add(value);
820                            }
821                    }
822    
823                    List<PollsQuestion> list = q.list();
824    
825                    if (list.size() == 2) {
826                            return list.get(1);
827                    }
828                    else {
829                            return null;
830                    }
831            }
832    
833            /**
834             * Finds the polls question where uuid = &#63; and groupId = &#63; or throws a {@link com.liferay.portlet.polls.NoSuchQuestionException} if it could not be found.
835             *
836             * @param uuid the uuid to search with
837             * @param groupId the group id to search with
838             * @return the matching polls question
839             * @throws com.liferay.portlet.polls.NoSuchQuestionException if a matching polls question could not be found
840             * @throws SystemException if a system exception occurred
841             */
842            public PollsQuestion findByUUID_G(String uuid, long groupId)
843                    throws NoSuchQuestionException, SystemException {
844                    PollsQuestion pollsQuestion = fetchByUUID_G(uuid, groupId);
845    
846                    if (pollsQuestion == null) {
847                            StringBundler msg = new StringBundler(6);
848    
849                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
850    
851                            msg.append("uuid=");
852                            msg.append(uuid);
853    
854                            msg.append(", groupId=");
855                            msg.append(groupId);
856    
857                            msg.append(StringPool.CLOSE_CURLY_BRACE);
858    
859                            if (_log.isWarnEnabled()) {
860                                    _log.warn(msg.toString());
861                            }
862    
863                            throw new NoSuchQuestionException(msg.toString());
864                    }
865    
866                    return pollsQuestion;
867            }
868    
869            /**
870             * Finds the polls question where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
871             *
872             * @param uuid the uuid to search with
873             * @param groupId the group id to search with
874             * @return the matching polls question, or <code>null</code> if a matching polls question could not be found
875             * @throws SystemException if a system exception occurred
876             */
877            public PollsQuestion fetchByUUID_G(String uuid, long groupId)
878                    throws SystemException {
879                    return fetchByUUID_G(uuid, groupId, true);
880            }
881    
882            /**
883             * Finds the polls question where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
884             *
885             * @param uuid the uuid to search with
886             * @param groupId the group id to search with
887             * @return the matching polls question, or <code>null</code> if a matching polls question could not be found
888             * @throws SystemException if a system exception occurred
889             */
890            public PollsQuestion fetchByUUID_G(String uuid, long groupId,
891                    boolean retrieveFromCache) throws SystemException {
892                    Object[] finderArgs = new Object[] { uuid, groupId };
893    
894                    Object result = null;
895    
896                    if (retrieveFromCache) {
897                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
898                                            finderArgs, this);
899                    }
900    
901                    if (result == null) {
902                            Session session = null;
903    
904                            try {
905                                    session = openSession();
906    
907                                    StringBundler query = new StringBundler(4);
908    
909                                    query.append(_SQL_SELECT_POLLSQUESTION_WHERE);
910    
911                                    if (uuid == null) {
912                                            query.append(_FINDER_COLUMN_UUID_G_UUID_1);
913                                    }
914                                    else {
915                                            if (uuid.equals(StringPool.BLANK)) {
916                                                    query.append(_FINDER_COLUMN_UUID_G_UUID_3);
917                                            }
918                                            else {
919                                                    query.append(_FINDER_COLUMN_UUID_G_UUID_2);
920                                            }
921                                    }
922    
923                                    query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
924    
925                                    query.append(PollsQuestionModelImpl.ORDER_BY_JPQL);
926    
927                                    String sql = query.toString();
928    
929                                    Query q = session.createQuery(sql);
930    
931                                    QueryPos qPos = QueryPos.getInstance(q);
932    
933                                    if (uuid != null) {
934                                            qPos.add(uuid);
935                                    }
936    
937                                    qPos.add(groupId);
938    
939                                    List<PollsQuestion> list = q.list();
940    
941                                    result = list;
942    
943                                    PollsQuestion pollsQuestion = null;
944    
945                                    if (list.isEmpty()) {
946                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
947                                                    finderArgs, list);
948                                    }
949                                    else {
950                                            pollsQuestion = list.get(0);
951    
952                                            cacheResult(pollsQuestion);
953    
954                                            if ((pollsQuestion.getUuid() == null) ||
955                                                            !pollsQuestion.getUuid().equals(uuid) ||
956                                                            (pollsQuestion.getGroupId() != groupId)) {
957                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
958                                                            finderArgs, pollsQuestion);
959                                            }
960                                    }
961    
962                                    return pollsQuestion;
963                            }
964                            catch (Exception e) {
965                                    throw processException(e);
966                            }
967                            finally {
968                                    if (result == null) {
969                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
970                                                    finderArgs, new ArrayList<PollsQuestion>());
971                                    }
972    
973                                    closeSession(session);
974                            }
975                    }
976                    else {
977                            if (result instanceof List<?>) {
978                                    return null;
979                            }
980                            else {
981                                    return (PollsQuestion)result;
982                            }
983                    }
984            }
985    
986            /**
987             * Finds all the polls questions where groupId = &#63;.
988             *
989             * @param groupId the group id to search with
990             * @return the matching polls questions
991             * @throws SystemException if a system exception occurred
992             */
993            public List<PollsQuestion> findByGroupId(long groupId)
994                    throws SystemException {
995                    return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
996            }
997    
998            /**
999             * Finds a range of all the polls questions where groupId = &#63;.
1000             *
1001             * <p>
1002             * 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.
1003             * </p>
1004             *
1005             * @param groupId the group id to search with
1006             * @param start the lower bound of the range of polls questions to return
1007             * @param end the upper bound of the range of polls questions to return (not inclusive)
1008             * @return the range of matching polls questions
1009             * @throws SystemException if a system exception occurred
1010             */
1011            public List<PollsQuestion> findByGroupId(long groupId, int start, int end)
1012                    throws SystemException {
1013                    return findByGroupId(groupId, start, end, null);
1014            }
1015    
1016            /**
1017             * Finds an ordered range of all the polls questions where groupId = &#63;.
1018             *
1019             * <p>
1020             * 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.
1021             * </p>
1022             *
1023             * @param groupId the group id to search with
1024             * @param start the lower bound of the range of polls questions to return
1025             * @param end the upper bound of the range of polls questions to return (not inclusive)
1026             * @param orderByComparator the comparator to order the results by
1027             * @return the ordered range of matching polls questions
1028             * @throws SystemException if a system exception occurred
1029             */
1030            public List<PollsQuestion> findByGroupId(long groupId, int start, int end,
1031                    OrderByComparator orderByComparator) throws SystemException {
1032                    Object[] finderArgs = new Object[] {
1033                                    groupId,
1034                                    
1035                                    String.valueOf(start), String.valueOf(end),
1036                                    String.valueOf(orderByComparator)
1037                            };
1038    
1039                    List<PollsQuestion> list = (List<PollsQuestion>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
1040                                    finderArgs, this);
1041    
1042                    if (list == null) {
1043                            Session session = null;
1044    
1045                            try {
1046                                    session = openSession();
1047    
1048                                    StringBundler query = null;
1049    
1050                                    if (orderByComparator != null) {
1051                                            query = new StringBundler(3 +
1052                                                            (orderByComparator.getOrderByFields().length * 3));
1053                                    }
1054                                    else {
1055                                            query = new StringBundler(3);
1056                                    }
1057    
1058                                    query.append(_SQL_SELECT_POLLSQUESTION_WHERE);
1059    
1060                                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1061    
1062                                    if (orderByComparator != null) {
1063                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1064                                                    orderByComparator);
1065                                    }
1066    
1067                                    else {
1068                                            query.append(PollsQuestionModelImpl.ORDER_BY_JPQL);
1069                                    }
1070    
1071                                    String sql = query.toString();
1072    
1073                                    Query q = session.createQuery(sql);
1074    
1075                                    QueryPos qPos = QueryPos.getInstance(q);
1076    
1077                                    qPos.add(groupId);
1078    
1079                                    list = (List<PollsQuestion>)QueryUtil.list(q, getDialect(),
1080                                                    start, end);
1081                            }
1082                            catch (Exception e) {
1083                                    throw processException(e);
1084                            }
1085                            finally {
1086                                    if (list == null) {
1087                                            list = new ArrayList<PollsQuestion>();
1088                                    }
1089    
1090                                    cacheResult(list);
1091    
1092                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
1093                                            finderArgs, list);
1094    
1095                                    closeSession(session);
1096                            }
1097                    }
1098    
1099                    return list;
1100            }
1101    
1102            /**
1103             * Finds the first polls question in the ordered set where groupId = &#63;.
1104             *
1105             * <p>
1106             * 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.
1107             * </p>
1108             *
1109             * @param groupId the group id to search with
1110             * @param orderByComparator the comparator to order the set by
1111             * @return the first matching polls question
1112             * @throws com.liferay.portlet.polls.NoSuchQuestionException if a matching polls question could not be found
1113             * @throws SystemException if a system exception occurred
1114             */
1115            public PollsQuestion findByGroupId_First(long groupId,
1116                    OrderByComparator orderByComparator)
1117                    throws NoSuchQuestionException, SystemException {
1118                    List<PollsQuestion> list = findByGroupId(groupId, 0, 1,
1119                                    orderByComparator);
1120    
1121                    if (list.isEmpty()) {
1122                            StringBundler msg = new StringBundler(4);
1123    
1124                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1125    
1126                            msg.append("groupId=");
1127                            msg.append(groupId);
1128    
1129                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1130    
1131                            throw new NoSuchQuestionException(msg.toString());
1132                    }
1133                    else {
1134                            return list.get(0);
1135                    }
1136            }
1137    
1138            /**
1139             * Finds the last polls question in the ordered set where groupId = &#63;.
1140             *
1141             * <p>
1142             * 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.
1143             * </p>
1144             *
1145             * @param groupId the group id to search with
1146             * @param orderByComparator the comparator to order the set by
1147             * @return the last matching polls question
1148             * @throws com.liferay.portlet.polls.NoSuchQuestionException if a matching polls question could not be found
1149             * @throws SystemException if a system exception occurred
1150             */
1151            public PollsQuestion findByGroupId_Last(long groupId,
1152                    OrderByComparator orderByComparator)
1153                    throws NoSuchQuestionException, SystemException {
1154                    int count = countByGroupId(groupId);
1155    
1156                    List<PollsQuestion> list = findByGroupId(groupId, count - 1, count,
1157                                    orderByComparator);
1158    
1159                    if (list.isEmpty()) {
1160                            StringBundler msg = new StringBundler(4);
1161    
1162                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1163    
1164                            msg.append("groupId=");
1165                            msg.append(groupId);
1166    
1167                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1168    
1169                            throw new NoSuchQuestionException(msg.toString());
1170                    }
1171                    else {
1172                            return list.get(0);
1173                    }
1174            }
1175    
1176            /**
1177             * Finds the polls questions before and after the current polls question in the ordered set where groupId = &#63;.
1178             *
1179             * <p>
1180             * 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.
1181             * </p>
1182             *
1183             * @param questionId the primary key of the current polls question
1184             * @param groupId the group id to search with
1185             * @param orderByComparator the comparator to order the set by
1186             * @return the previous, current, and next polls question
1187             * @throws com.liferay.portlet.polls.NoSuchQuestionException if a polls question with the primary key could not be found
1188             * @throws SystemException if a system exception occurred
1189             */
1190            public PollsQuestion[] findByGroupId_PrevAndNext(long questionId,
1191                    long groupId, OrderByComparator orderByComparator)
1192                    throws NoSuchQuestionException, SystemException {
1193                    PollsQuestion pollsQuestion = findByPrimaryKey(questionId);
1194    
1195                    Session session = null;
1196    
1197                    try {
1198                            session = openSession();
1199    
1200                            PollsQuestion[] array = new PollsQuestionImpl[3];
1201    
1202                            array[0] = getByGroupId_PrevAndNext(session, pollsQuestion,
1203                                            groupId, orderByComparator, true);
1204    
1205                            array[1] = pollsQuestion;
1206    
1207                            array[2] = getByGroupId_PrevAndNext(session, pollsQuestion,
1208                                            groupId, orderByComparator, false);
1209    
1210                            return array;
1211                    }
1212                    catch (Exception e) {
1213                            throw processException(e);
1214                    }
1215                    finally {
1216                            closeSession(session);
1217                    }
1218            }
1219    
1220            protected PollsQuestion getByGroupId_PrevAndNext(Session session,
1221                    PollsQuestion pollsQuestion, long groupId,
1222                    OrderByComparator orderByComparator, boolean previous) {
1223                    StringBundler query = null;
1224    
1225                    if (orderByComparator != null) {
1226                            query = new StringBundler(6 +
1227                                            (orderByComparator.getOrderByFields().length * 6));
1228                    }
1229                    else {
1230                            query = new StringBundler(3);
1231                    }
1232    
1233                    query.append(_SQL_SELECT_POLLSQUESTION_WHERE);
1234    
1235                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1236    
1237                    if (orderByComparator != null) {
1238                            String[] orderByFields = orderByComparator.getOrderByFields();
1239    
1240                            if (orderByFields.length > 0) {
1241                                    query.append(WHERE_AND);
1242                            }
1243    
1244                            for (int i = 0; i < orderByFields.length; i++) {
1245                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1246                                    query.append(orderByFields[i]);
1247    
1248                                    if ((i + 1) < orderByFields.length) {
1249                                            if (orderByComparator.isAscending() ^ previous) {
1250                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1251                                            }
1252                                            else {
1253                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1254                                            }
1255                                    }
1256                                    else {
1257                                            if (orderByComparator.isAscending() ^ previous) {
1258                                                    query.append(WHERE_GREATER_THAN);
1259                                            }
1260                                            else {
1261                                                    query.append(WHERE_LESSER_THAN);
1262                                            }
1263                                    }
1264                            }
1265    
1266                            query.append(ORDER_BY_CLAUSE);
1267    
1268                            for (int i = 0; i < orderByFields.length; i++) {
1269                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1270                                    query.append(orderByFields[i]);
1271    
1272                                    if ((i + 1) < orderByFields.length) {
1273                                            if (orderByComparator.isAscending() ^ previous) {
1274                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1275                                            }
1276                                            else {
1277                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1278                                            }
1279                                    }
1280                                    else {
1281                                            if (orderByComparator.isAscending() ^ previous) {
1282                                                    query.append(ORDER_BY_ASC);
1283                                            }
1284                                            else {
1285                                                    query.append(ORDER_BY_DESC);
1286                                            }
1287                                    }
1288                            }
1289                    }
1290    
1291                    else {
1292                            query.append(PollsQuestionModelImpl.ORDER_BY_JPQL);
1293                    }
1294    
1295                    String sql = query.toString();
1296    
1297                    Query q = session.createQuery(sql);
1298    
1299                    q.setFirstResult(0);
1300                    q.setMaxResults(2);
1301    
1302                    QueryPos qPos = QueryPos.getInstance(q);
1303    
1304                    qPos.add(groupId);
1305    
1306                    if (orderByComparator != null) {
1307                            Object[] values = orderByComparator.getOrderByValues(pollsQuestion);
1308    
1309                            for (Object value : values) {
1310                                    qPos.add(value);
1311                            }
1312                    }
1313    
1314                    List<PollsQuestion> list = q.list();
1315    
1316                    if (list.size() == 2) {
1317                            return list.get(1);
1318                    }
1319                    else {
1320                            return null;
1321                    }
1322            }
1323    
1324            /**
1325             * Filters by the user's permissions and finds all the polls questions where groupId = &#63;.
1326             *
1327             * @param groupId the group id to search with
1328             * @return the matching polls questions that the user has permission to view
1329             * @throws SystemException if a system exception occurred
1330             */
1331            public List<PollsQuestion> filterFindByGroupId(long groupId)
1332                    throws SystemException {
1333                    return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1334                            QueryUtil.ALL_POS, null);
1335            }
1336    
1337            /**
1338             * Filters by the user's permissions and finds a range of all the polls questions where groupId = &#63;.
1339             *
1340             * <p>
1341             * 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.
1342             * </p>
1343             *
1344             * @param groupId the group id to search with
1345             * @param start the lower bound of the range of polls questions to return
1346             * @param end the upper bound of the range of polls questions to return (not inclusive)
1347             * @return the range of matching polls questions that the user has permission to view
1348             * @throws SystemException if a system exception occurred
1349             */
1350            public List<PollsQuestion> filterFindByGroupId(long groupId, int start,
1351                    int end) throws SystemException {
1352                    return filterFindByGroupId(groupId, start, end, null);
1353            }
1354    
1355            /**
1356             * Filters by the user's permissions and finds an ordered range of all the polls questions where groupId = &#63;.
1357             *
1358             * <p>
1359             * 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.
1360             * </p>
1361             *
1362             * @param groupId the group id to search with
1363             * @param start the lower bound of the range of polls questions to return
1364             * @param end the upper bound of the range of polls questions to return (not inclusive)
1365             * @param orderByComparator the comparator to order the results by
1366             * @return the ordered range of matching polls questions that the user has permission to view
1367             * @throws SystemException if a system exception occurred
1368             */
1369            public List<PollsQuestion> filterFindByGroupId(long groupId, int start,
1370                    int end, OrderByComparator orderByComparator) throws SystemException {
1371                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1372                            return findByGroupId(groupId, start, end, orderByComparator);
1373                    }
1374    
1375                    Session session = null;
1376    
1377                    try {
1378                            session = openSession();
1379    
1380                            StringBundler query = null;
1381    
1382                            if (orderByComparator != null) {
1383                                    query = new StringBundler(3 +
1384                                                    (orderByComparator.getOrderByFields().length * 3));
1385                            }
1386                            else {
1387                                    query = new StringBundler(3);
1388                            }
1389    
1390                            query.append(_FILTER_SQL_SELECT_POLLSQUESTION_WHERE);
1391    
1392                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1393    
1394                            if (orderByComparator != null) {
1395                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1396                                            orderByComparator);
1397                            }
1398    
1399                            else {
1400                                    query.append(PollsQuestionModelImpl.ORDER_BY_JPQL);
1401                            }
1402    
1403                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1404                                            PollsQuestion.class.getName(), _FILTER_COLUMN_PK,
1405                                            _FILTER_COLUMN_USERID, groupId);
1406    
1407                            SQLQuery q = session.createSQLQuery(sql);
1408    
1409                            q.addEntity(_FILTER_ENTITY_ALIAS, PollsQuestionImpl.class);
1410    
1411                            QueryPos qPos = QueryPos.getInstance(q);
1412    
1413                            qPos.add(groupId);
1414    
1415                            return (List<PollsQuestion>)QueryUtil.list(q, getDialect(), start,
1416                                    end);
1417                    }
1418                    catch (Exception e) {
1419                            throw processException(e);
1420                    }
1421                    finally {
1422                            closeSession(session);
1423                    }
1424            }
1425    
1426            /**
1427             * Finds all the polls questions.
1428             *
1429             * @return the polls questions
1430             * @throws SystemException if a system exception occurred
1431             */
1432            public List<PollsQuestion> findAll() throws SystemException {
1433                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1434            }
1435    
1436            /**
1437             * Finds a range of all the polls questions.
1438             *
1439             * <p>
1440             * 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.
1441             * </p>
1442             *
1443             * @param start the lower bound of the range of polls questions to return
1444             * @param end the upper bound of the range of polls questions to return (not inclusive)
1445             * @return the range of polls questions
1446             * @throws SystemException if a system exception occurred
1447             */
1448            public List<PollsQuestion> findAll(int start, int end)
1449                    throws SystemException {
1450                    return findAll(start, end, null);
1451            }
1452    
1453            /**
1454             * Finds an ordered range of all the polls questions.
1455             *
1456             * <p>
1457             * 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.
1458             * </p>
1459             *
1460             * @param start the lower bound of the range of polls questions to return
1461             * @param end the upper bound of the range of polls questions to return (not inclusive)
1462             * @param orderByComparator the comparator to order the results by
1463             * @return the ordered range of polls questions
1464             * @throws SystemException if a system exception occurred
1465             */
1466            public List<PollsQuestion> findAll(int start, int end,
1467                    OrderByComparator orderByComparator) throws SystemException {
1468                    Object[] finderArgs = new Object[] {
1469                                    String.valueOf(start), String.valueOf(end),
1470                                    String.valueOf(orderByComparator)
1471                            };
1472    
1473                    List<PollsQuestion> list = (List<PollsQuestion>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1474                                    finderArgs, this);
1475    
1476                    if (list == null) {
1477                            Session session = null;
1478    
1479                            try {
1480                                    session = openSession();
1481    
1482                                    StringBundler query = null;
1483                                    String sql = null;
1484    
1485                                    if (orderByComparator != null) {
1486                                            query = new StringBundler(2 +
1487                                                            (orderByComparator.getOrderByFields().length * 3));
1488    
1489                                            query.append(_SQL_SELECT_POLLSQUESTION);
1490    
1491                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1492                                                    orderByComparator);
1493    
1494                                            sql = query.toString();
1495                                    }
1496                                    else {
1497                                            sql = _SQL_SELECT_POLLSQUESTION.concat(PollsQuestionModelImpl.ORDER_BY_JPQL);
1498                                    }
1499    
1500                                    Query q = session.createQuery(sql);
1501    
1502                                    if (orderByComparator == null) {
1503                                            list = (List<PollsQuestion>)QueryUtil.list(q, getDialect(),
1504                                                            start, end, false);
1505    
1506                                            Collections.sort(list);
1507                                    }
1508                                    else {
1509                                            list = (List<PollsQuestion>)QueryUtil.list(q, getDialect(),
1510                                                            start, end);
1511                                    }
1512                            }
1513                            catch (Exception e) {
1514                                    throw processException(e);
1515                            }
1516                            finally {
1517                                    if (list == null) {
1518                                            list = new ArrayList<PollsQuestion>();
1519                                    }
1520    
1521                                    cacheResult(list);
1522    
1523                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1524    
1525                                    closeSession(session);
1526                            }
1527                    }
1528    
1529                    return list;
1530            }
1531    
1532            /**
1533             * Removes all the polls questions where uuid = &#63; from the database.
1534             *
1535             * @param uuid the uuid to search with
1536             * @throws SystemException if a system exception occurred
1537             */
1538            public void removeByUuid(String uuid) throws SystemException {
1539                    for (PollsQuestion pollsQuestion : findByUuid(uuid)) {
1540                            remove(pollsQuestion);
1541                    }
1542            }
1543    
1544            /**
1545             * Removes the polls question where uuid = &#63; and groupId = &#63; from the database.
1546             *
1547             * @param uuid the uuid to search with
1548             * @param groupId the group id to search with
1549             * @throws SystemException if a system exception occurred
1550             */
1551            public void removeByUUID_G(String uuid, long groupId)
1552                    throws NoSuchQuestionException, SystemException {
1553                    PollsQuestion pollsQuestion = findByUUID_G(uuid, groupId);
1554    
1555                    remove(pollsQuestion);
1556            }
1557    
1558            /**
1559             * Removes all the polls questions where groupId = &#63; from the database.
1560             *
1561             * @param groupId the group id to search with
1562             * @throws SystemException if a system exception occurred
1563             */
1564            public void removeByGroupId(long groupId) throws SystemException {
1565                    for (PollsQuestion pollsQuestion : findByGroupId(groupId)) {
1566                            remove(pollsQuestion);
1567                    }
1568            }
1569    
1570            /**
1571             * Removes all the polls questions from the database.
1572             *
1573             * @throws SystemException if a system exception occurred
1574             */
1575            public void removeAll() throws SystemException {
1576                    for (PollsQuestion pollsQuestion : findAll()) {
1577                            remove(pollsQuestion);
1578                    }
1579            }
1580    
1581            /**
1582             * Counts all the polls questions where uuid = &#63;.
1583             *
1584             * @param uuid the uuid to search with
1585             * @return the number of matching polls questions
1586             * @throws SystemException if a system exception occurred
1587             */
1588            public int countByUuid(String uuid) throws SystemException {
1589                    Object[] finderArgs = new Object[] { uuid };
1590    
1591                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
1592                                    finderArgs, this);
1593    
1594                    if (count == null) {
1595                            Session session = null;
1596    
1597                            try {
1598                                    session = openSession();
1599    
1600                                    StringBundler query = new StringBundler(2);
1601    
1602                                    query.append(_SQL_COUNT_POLLSQUESTION_WHERE);
1603    
1604                                    if (uuid == null) {
1605                                            query.append(_FINDER_COLUMN_UUID_UUID_1);
1606                                    }
1607                                    else {
1608                                            if (uuid.equals(StringPool.BLANK)) {
1609                                                    query.append(_FINDER_COLUMN_UUID_UUID_3);
1610                                            }
1611                                            else {
1612                                                    query.append(_FINDER_COLUMN_UUID_UUID_2);
1613                                            }
1614                                    }
1615    
1616                                    String sql = query.toString();
1617    
1618                                    Query q = session.createQuery(sql);
1619    
1620                                    QueryPos qPos = QueryPos.getInstance(q);
1621    
1622                                    if (uuid != null) {
1623                                            qPos.add(uuid);
1624                                    }
1625    
1626                                    count = (Long)q.uniqueResult();
1627                            }
1628                            catch (Exception e) {
1629                                    throw processException(e);
1630                            }
1631                            finally {
1632                                    if (count == null) {
1633                                            count = Long.valueOf(0);
1634                                    }
1635    
1636                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
1637                                            finderArgs, count);
1638    
1639                                    closeSession(session);
1640                            }
1641                    }
1642    
1643                    return count.intValue();
1644            }
1645    
1646            /**
1647             * Counts all the polls questions where uuid = &#63; and groupId = &#63;.
1648             *
1649             * @param uuid the uuid to search with
1650             * @param groupId the group id to search with
1651             * @return the number of matching polls questions
1652             * @throws SystemException if a system exception occurred
1653             */
1654            public int countByUUID_G(String uuid, long groupId)
1655                    throws SystemException {
1656                    Object[] finderArgs = new Object[] { uuid, groupId };
1657    
1658                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
1659                                    finderArgs, this);
1660    
1661                    if (count == null) {
1662                            Session session = null;
1663    
1664                            try {
1665                                    session = openSession();
1666    
1667                                    StringBundler query = new StringBundler(3);
1668    
1669                                    query.append(_SQL_COUNT_POLLSQUESTION_WHERE);
1670    
1671                                    if (uuid == null) {
1672                                            query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1673                                    }
1674                                    else {
1675                                            if (uuid.equals(StringPool.BLANK)) {
1676                                                    query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1677                                            }
1678                                            else {
1679                                                    query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1680                                            }
1681                                    }
1682    
1683                                    query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1684    
1685                                    String sql = query.toString();
1686    
1687                                    Query q = session.createQuery(sql);
1688    
1689                                    QueryPos qPos = QueryPos.getInstance(q);
1690    
1691                                    if (uuid != null) {
1692                                            qPos.add(uuid);
1693                                    }
1694    
1695                                    qPos.add(groupId);
1696    
1697                                    count = (Long)q.uniqueResult();
1698                            }
1699                            catch (Exception e) {
1700                                    throw processException(e);
1701                            }
1702                            finally {
1703                                    if (count == null) {
1704                                            count = Long.valueOf(0);
1705                                    }
1706    
1707                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
1708                                            finderArgs, count);
1709    
1710                                    closeSession(session);
1711                            }
1712                    }
1713    
1714                    return count.intValue();
1715            }
1716    
1717            /**
1718             * Counts all the polls questions where groupId = &#63;.
1719             *
1720             * @param groupId the group id to search with
1721             * @return the number of matching polls questions
1722             * @throws SystemException if a system exception occurred
1723             */
1724            public int countByGroupId(long groupId) throws SystemException {
1725                    Object[] finderArgs = new Object[] { groupId };
1726    
1727                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
1728                                    finderArgs, this);
1729    
1730                    if (count == null) {
1731                            Session session = null;
1732    
1733                            try {
1734                                    session = openSession();
1735    
1736                                    StringBundler query = new StringBundler(2);
1737    
1738                                    query.append(_SQL_COUNT_POLLSQUESTION_WHERE);
1739    
1740                                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1741    
1742                                    String sql = query.toString();
1743    
1744                                    Query q = session.createQuery(sql);
1745    
1746                                    QueryPos qPos = QueryPos.getInstance(q);
1747    
1748                                    qPos.add(groupId);
1749    
1750                                    count = (Long)q.uniqueResult();
1751                            }
1752                            catch (Exception e) {
1753                                    throw processException(e);
1754                            }
1755                            finally {
1756                                    if (count == null) {
1757                                            count = Long.valueOf(0);
1758                                    }
1759    
1760                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
1761                                            finderArgs, count);
1762    
1763                                    closeSession(session);
1764                            }
1765                    }
1766    
1767                    return count.intValue();
1768            }
1769    
1770            /**
1771             * Filters by the user's permissions and counts all the polls questions where groupId = &#63;.
1772             *
1773             * @param groupId the group id to search with
1774             * @return the number of matching polls questions that the user has permission to view
1775             * @throws SystemException if a system exception occurred
1776             */
1777            public int filterCountByGroupId(long groupId) throws SystemException {
1778                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1779                            return countByGroupId(groupId);
1780                    }
1781    
1782                    Session session = null;
1783    
1784                    try {
1785                            session = openSession();
1786    
1787                            StringBundler query = new StringBundler(2);
1788    
1789                            query.append(_FILTER_SQL_COUNT_POLLSQUESTION_WHERE);
1790    
1791                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1792    
1793                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1794                                            PollsQuestion.class.getName(), _FILTER_COLUMN_PK,
1795                                            _FILTER_COLUMN_USERID, groupId);
1796    
1797                            SQLQuery q = session.createSQLQuery(sql);
1798    
1799                            q.addScalar(COUNT_COLUMN_NAME,
1800                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
1801    
1802                            QueryPos qPos = QueryPos.getInstance(q);
1803    
1804                            qPos.add(groupId);
1805    
1806                            Long count = (Long)q.uniqueResult();
1807    
1808                            return count.intValue();
1809                    }
1810                    catch (Exception e) {
1811                            throw processException(e);
1812                    }
1813                    finally {
1814                            closeSession(session);
1815                    }
1816            }
1817    
1818            /**
1819             * Counts all the polls questions.
1820             *
1821             * @return the number of polls questions
1822             * @throws SystemException if a system exception occurred
1823             */
1824            public int countAll() throws SystemException {
1825                    Object[] finderArgs = new Object[0];
1826    
1827                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1828                                    finderArgs, this);
1829    
1830                    if (count == null) {
1831                            Session session = null;
1832    
1833                            try {
1834                                    session = openSession();
1835    
1836                                    Query q = session.createQuery(_SQL_COUNT_POLLSQUESTION);
1837    
1838                                    count = (Long)q.uniqueResult();
1839                            }
1840                            catch (Exception e) {
1841                                    throw processException(e);
1842                            }
1843                            finally {
1844                                    if (count == null) {
1845                                            count = Long.valueOf(0);
1846                                    }
1847    
1848                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1849                                            count);
1850    
1851                                    closeSession(session);
1852                            }
1853                    }
1854    
1855                    return count.intValue();
1856            }
1857    
1858            /**
1859             * Initializes the polls question persistence.
1860             */
1861            public void afterPropertiesSet() {
1862                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1863                                            com.liferay.portal.util.PropsUtil.get(
1864                                                    "value.object.listener.com.liferay.portlet.polls.model.PollsQuestion")));
1865    
1866                    if (listenerClassNames.length > 0) {
1867                            try {
1868                                    List<ModelListener<PollsQuestion>> listenersList = new ArrayList<ModelListener<PollsQuestion>>();
1869    
1870                                    for (String listenerClassName : listenerClassNames) {
1871                                            listenersList.add((ModelListener<PollsQuestion>)InstanceFactory.newInstance(
1872                                                            listenerClassName));
1873                                    }
1874    
1875                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1876                            }
1877                            catch (Exception e) {
1878                                    _log.error(e);
1879                            }
1880                    }
1881            }
1882    
1883            @BeanReference(type = PollsChoicePersistence.class)
1884            protected PollsChoicePersistence pollsChoicePersistence;
1885            @BeanReference(type = PollsQuestionPersistence.class)
1886            protected PollsQuestionPersistence pollsQuestionPersistence;
1887            @BeanReference(type = PollsVotePersistence.class)
1888            protected PollsVotePersistence pollsVotePersistence;
1889            @BeanReference(type = ResourcePersistence.class)
1890            protected ResourcePersistence resourcePersistence;
1891            @BeanReference(type = UserPersistence.class)
1892            protected UserPersistence userPersistence;
1893            private static final String _SQL_SELECT_POLLSQUESTION = "SELECT pollsQuestion FROM PollsQuestion pollsQuestion";
1894            private static final String _SQL_SELECT_POLLSQUESTION_WHERE = "SELECT pollsQuestion FROM PollsQuestion pollsQuestion WHERE ";
1895            private static final String _SQL_COUNT_POLLSQUESTION = "SELECT COUNT(pollsQuestion) FROM PollsQuestion pollsQuestion";
1896            private static final String _SQL_COUNT_POLLSQUESTION_WHERE = "SELECT COUNT(pollsQuestion) FROM PollsQuestion pollsQuestion WHERE ";
1897            private static final String _FINDER_COLUMN_UUID_UUID_1 = "pollsQuestion.uuid IS NULL";
1898            private static final String _FINDER_COLUMN_UUID_UUID_2 = "pollsQuestion.uuid = ?";
1899            private static final String _FINDER_COLUMN_UUID_UUID_3 = "(pollsQuestion.uuid IS NULL OR pollsQuestion.uuid = ?)";
1900            private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "pollsQuestion.uuid IS NULL AND ";
1901            private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "pollsQuestion.uuid = ? AND ";
1902            private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(pollsQuestion.uuid IS NULL OR pollsQuestion.uuid = ?) AND ";
1903            private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "pollsQuestion.groupId = ?";
1904            private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "pollsQuestion.groupId = ?";
1905            private static final String _FILTER_SQL_SELECT_POLLSQUESTION_WHERE = "SELECT DISTINCT {pollsQuestion.*} FROM PollsQuestion pollsQuestion WHERE ";
1906            private static final String _FILTER_SQL_COUNT_POLLSQUESTION_WHERE = "SELECT COUNT(DISTINCT pollsQuestion.questionId) AS COUNT_VALUE FROM PollsQuestion pollsQuestion WHERE ";
1907            private static final String _FILTER_COLUMN_PK = "pollsQuestion.questionId";
1908            private static final String _FILTER_COLUMN_USERID = "pollsQuestion.userId";
1909            private static final String _FILTER_ENTITY_ALIAS = "pollsQuestion";
1910            private static final String _ORDER_BY_ENTITY_ALIAS = "pollsQuestion.";
1911            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No PollsQuestion exists with the primary key ";
1912            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No PollsQuestion exists with the key {";
1913            private static Log _log = LogFactoryUtil.getLog(PollsQuestionPersistenceImpl.class);
1914    }