List of usage examples for com.liferay.portal.kernel.util StringPool OPEN_PARENTHESIS
String OPEN_PARENTHESIS
To view the source code for com.liferay.portal.kernel.util StringPool OPEN_PARENTHESIS.
Click Source Link
From source file:com.liferay.portlet.messageboards.service.persistence.MBThreadPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the message boards threads that the user has permission to view where groupId = ? and categoryId = any ?. * * <p>/*ww w. j a v a2 s .com*/ * 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. * </p> * * @param groupId the group ID * @param categoryIds the category IDs * @param start the lower bound of the range of message boards threads * @param end the upper bound of the range of message boards threads (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching message boards threads that the user has permission to view * @throws SystemException if a system exception occurred */ public List<MBThread> filterFindByG_C(long groupId, long[] categoryIds, int start, int end, OrderByComparator orderByComparator) throws SystemException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_C(groupId, categoryIds, start, end, orderByComparator); } StringBundler query = new StringBundler(); if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_MBTHREAD_WHERE); } else { query.append(_FILTER_SQL_SELECT_MBTHREAD_NO_INLINE_DISTINCT_WHERE_1); } boolean conjunctionable = false; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_C_GROUPID_5); conjunctionable = true; if ((categoryIds == null) || (categoryIds.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < categoryIds.length; i++) { query.append(_FINDER_COLUMN_G_C_CATEGORYID_5); if ((i + 1) < categoryIds.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } if (!getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_MBTHREAD_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else { appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE, orderByComparator); } } else { if (getDB().isSupportsInlineDistinct()) { query.append(MBThreadModelImpl.ORDER_BY_JPQL); } else { query.append(MBThreadModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(), MBThread.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, MBThreadImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, MBThreadImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (categoryIds != null) { qPos.add(categoryIds); } return (List<MBThread>) QueryUtil.list(q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
From source file:com.liferay.portlet.messageboards.service.persistence.MBThreadPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the message boards threads where groupId = ? and categoryId = any ? and status = ?. * * <p>/*from w ww. j a va 2 s.c o m*/ * 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. * </p> * * @param groupId the group ID * @param categoryIds the category IDs * @param status the status * @param start the lower bound of the range of message boards threads * @param end the upper bound of the range of message boards threads (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching message boards threads * @throws SystemException if a system exception occurred */ public List<MBThread> findByG_C_S(long groupId, long[] categoryIds, int status, int start, int end, OrderByComparator orderByComparator) throws SystemException { FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_C_S; finderArgs = new Object[] { groupId, StringUtil.merge(categoryIds), status }; } else { finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_C_S; finderArgs = new Object[] { groupId, StringUtil.merge(categoryIds), status, start, end, orderByComparator }; } List<MBThread> list = (List<MBThread>) FinderCacheUtil.getResult(finderPath, finderArgs, this); if (list == null) { StringBundler query = new StringBundler(); query.append(_SQL_SELECT_MBTHREAD_WHERE); boolean conjunctionable = false; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_C_S_GROUPID_5); conjunctionable = true; if ((categoryIds == null) || (categoryIds.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < categoryIds.length; i++) { query.append(_FINDER_COLUMN_G_C_S_CATEGORYID_5); if ((i + 1) < categoryIds.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_C_S_STATUS_5); conjunctionable = true; if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else { query.append(MBThreadModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (categoryIds != null) { qPos.add(categoryIds); } qPos.add(status); list = (List<MBThread>) QueryUtil.list(q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { if (list == null) { FinderCacheUtil.removeResult(finderPath, finderArgs); } else { cacheResult(list); FinderCacheUtil.putResult(finderPath, finderArgs, list); } closeSession(session); } } return list; }
From source file:com.liferay.portlet.messageboards.service.persistence.MBThreadPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the message boards threads that the user has permission to view where groupId = ? and categoryId = any ? and status = ?. * * <p>/*from w ww .j a v a 2 s. c o m*/ * 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. * </p> * * @param groupId the group ID * @param categoryIds the category IDs * @param status the status * @param start the lower bound of the range of message boards threads * @param end the upper bound of the range of message boards threads (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching message boards threads that the user has permission to view * @throws SystemException if a system exception occurred */ public List<MBThread> filterFindByG_C_S(long groupId, long[] categoryIds, int status, int start, int end, OrderByComparator orderByComparator) throws SystemException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_C_S(groupId, categoryIds, status, start, end, orderByComparator); } StringBundler query = new StringBundler(); if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_MBTHREAD_WHERE); } else { query.append(_FILTER_SQL_SELECT_MBTHREAD_NO_INLINE_DISTINCT_WHERE_1); } boolean conjunctionable = false; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_C_S_GROUPID_5); conjunctionable = true; if ((categoryIds == null) || (categoryIds.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < categoryIds.length; i++) { query.append(_FINDER_COLUMN_G_C_S_CATEGORYID_5); if ((i + 1) < categoryIds.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_C_S_STATUS_5); conjunctionable = true; if (!getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_MBTHREAD_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else { appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE, orderByComparator); } } else { if (getDB().isSupportsInlineDistinct()) { query.append(MBThreadModelImpl.ORDER_BY_JPQL); } else { query.append(MBThreadModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(), MBThread.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, MBThreadImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, MBThreadImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (categoryIds != null) { qPos.add(categoryIds); } qPos.add(status); return (List<MBThread>) QueryUtil.list(q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
From source file:com.liferay.portlet.messageboards.service.persistence.MBThreadPersistenceImpl.java
License:Open Source License
/** * Returns the number of message boards threads where groupId = ? and categoryId = any ?. * * @param groupId the group ID//from www .ja va2 s .co m * @param categoryIds the category IDs * @return the number of matching message boards threads * @throws SystemException if a system exception occurred */ public int countByG_C(long groupId, long[] categoryIds) throws SystemException { Object[] finderArgs = new Object[] { groupId, StringUtil.merge(categoryIds) }; Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_C, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(); query.append(_SQL_COUNT_MBTHREAD_WHERE); boolean conjunctionable = false; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_C_GROUPID_5); conjunctionable = true; if ((categoryIds == null) || (categoryIds.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < categoryIds.length; i++) { query.append(_FINDER_COLUMN_G_C_CATEGORYID_5); if ((i + 1) < categoryIds.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (categoryIds != null) { qPos.add(categoryIds); } count = (Long) q.uniqueResult(); } catch (Exception e) { throw processException(e); } finally { if (count == null) { count = Long.valueOf(0); } FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_C, finderArgs, count); closeSession(session); } } return count.intValue(); }
From source file:com.liferay.portlet.messageboards.service.persistence.MBThreadPersistenceImpl.java
License:Open Source License
/** * Returns the number of message boards threads that the user has permission to view where groupId = ? and categoryId = any ?. * * @param groupId the group ID/*w ww . j a v a 2 s.com*/ * @param categoryIds the category IDs * @return the number of matching message boards threads that the user has permission to view * @throws SystemException if a system exception occurred */ public int filterCountByG_C(long groupId, long[] categoryIds) throws SystemException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_C(groupId, categoryIds); } StringBundler query = new StringBundler(); query.append(_FILTER_SQL_COUNT_MBTHREAD_WHERE); boolean conjunctionable = false; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_C_GROUPID_5); conjunctionable = true; if ((categoryIds == null) || (categoryIds.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < categoryIds.length; i++) { query.append(_FINDER_COLUMN_G_C_CATEGORYID_5); if ((i + 1) < categoryIds.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(), MBThread.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSQLQuery(sql); q.addScalar(COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (categoryIds != null) { qPos.add(categoryIds); } Long count = (Long) q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
From source file:com.liferay.portlet.messageboards.service.persistence.MBThreadPersistenceImpl.java
License:Open Source License
/** * Returns the number of message boards threads where groupId = ? and categoryId = any ? and status = ?. * * @param groupId the group ID/*from w w w. java 2 s . com*/ * @param categoryIds the category IDs * @param status the status * @return the number of matching message boards threads * @throws SystemException if a system exception occurred */ public int countByG_C_S(long groupId, long[] categoryIds, int status) throws SystemException { Object[] finderArgs = new Object[] { groupId, StringUtil.merge(categoryIds), status }; Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_C_S, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(); query.append(_SQL_COUNT_MBTHREAD_WHERE); boolean conjunctionable = false; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_C_S_GROUPID_5); conjunctionable = true; if ((categoryIds == null) || (categoryIds.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < categoryIds.length; i++) { query.append(_FINDER_COLUMN_G_C_S_CATEGORYID_5); if ((i + 1) < categoryIds.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_C_S_STATUS_5); conjunctionable = true; String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (categoryIds != null) { qPos.add(categoryIds); } qPos.add(status); count = (Long) q.uniqueResult(); } catch (Exception e) { throw processException(e); } finally { if (count == null) { count = Long.valueOf(0); } FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_C_S, finderArgs, count); closeSession(session); } } return count.intValue(); }
From source file:com.liferay.portlet.messageboards.service.persistence.MBThreadPersistenceImpl.java
License:Open Source License
/** * Returns the number of message boards threads that the user has permission to view where groupId = ? and categoryId = any ? and status = ?. * * @param groupId the group ID//from w w w. j a va2s . c o m * @param categoryIds the category IDs * @param status the status * @return the number of matching message boards threads that the user has permission to view * @throws SystemException if a system exception occurred */ public int filterCountByG_C_S(long groupId, long[] categoryIds, int status) throws SystemException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_C_S(groupId, categoryIds, status); } StringBundler query = new StringBundler(); query.append(_FILTER_SQL_COUNT_MBTHREAD_WHERE); boolean conjunctionable = false; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_C_S_GROUPID_5); conjunctionable = true; if ((categoryIds == null) || (categoryIds.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < categoryIds.length; i++) { query.append(_FINDER_COLUMN_G_C_S_CATEGORYID_5); if ((i + 1) < categoryIds.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_C_S_STATUS_5); conjunctionable = true; String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(), MBThread.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSQLQuery(sql); q.addScalar(COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (categoryIds != null) { qPos.add(categoryIds); } qPos.add(status); Long count = (Long) q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
From source file:com.liferay.portlet.wiki.service.impl.WikiPageServiceImpl.java
License:Open Source License
protected String exportToRSS(long companyId, String name, String description, String type, double version, String displayStyle, String feedURL, String entryURL, List<WikiPage> pages, boolean diff, Locale locale) throws SystemException { SyndFeed syndFeed = new SyndFeedImpl(); syndFeed.setFeedType(RSSUtil.getFeedType(type, version)); syndFeed.setTitle(name);//from w w w. j a va 2 s . c o m syndFeed.setLink(feedURL); syndFeed.setDescription(description); List<SyndEntry> syndEntries = new ArrayList<SyndEntry>(); syndFeed.setEntries(syndEntries); WikiPage latestPage = null; StringBundler link = new StringBundler(7); for (WikiPage page : pages) { String author = HtmlUtil.escape(PortalUtil.getUserName(page.getUserId(), page.getUserName())); String title = page.getTitle() + StringPool.SPACE + page.getVersion(); if (page.isMinorEdit()) { title += StringPool.SPACE + StringPool.OPEN_PARENTHESIS + LanguageUtil.get(locale, "minor-edit") + StringPool.CLOSE_PARENTHESIS; } link.setIndex(0); link.append(entryURL); link.append(StringPool.AMPERSAND); link.append(HttpUtil.encodeURL(page.getTitle())); SyndEntry syndEntry = new SyndEntryImpl(); syndEntry.setAuthor(author); syndEntry.setTitle(title); syndEntry.setPublishedDate(page.getCreateDate()); syndEntry.setUpdatedDate(page.getModifiedDate()); SyndContent syndContent = new SyndContentImpl(); syndContent.setType(RSSUtil.ENTRY_TYPE_DEFAULT); if (diff) { if (latestPage != null) { link.append(StringPool.QUESTION); link.append(PortalUtil.getPortletNamespace(PortletKeys.WIKI)); link.append("version="); link.append(page.getVersion()); String value = getPageDiff(companyId, latestPage, page, locale); syndContent.setValue(value); syndEntry.setDescription(syndContent); syndEntries.add(syndEntry); } } else { String value = null; if (displayStyle.equals(RSSUtil.DISPLAY_STYLE_ABSTRACT)) { value = StringUtil.shorten(HtmlUtil.extractText(page.getContent()), PropsValues.WIKI_RSS_ABSTRACT_LENGTH, StringPool.BLANK); } else if (displayStyle.equals(RSSUtil.DISPLAY_STYLE_TITLE)) { value = StringPool.BLANK; } else { value = page.getContent(); } syndContent.setValue(value); syndEntry.setDescription(syndContent); syndEntries.add(syndEntry); } syndEntry.setLink(link.toString()); syndEntry.setUri(syndEntry.getLink()); latestPage = page; } try { return RSSUtil.export(syndFeed); } catch (FeedException fe) { throw new SystemException(fe); } }
From source file:com.liferay.salesforce.query.ConditionGroup.java
License:Open Source License
@Override public String toString() { StringBundler sb = new StringBundler(); for (int i = 0; i < _conditions.size(); i++) { Condition condition = _conditions.get(i); if (condition.isGroup()) { sb.append(StringPool.OPEN_PARENTHESIS); }/*from ww w . ja v a 2 s . c om*/ sb.append(condition); if (condition.isGroup()) { sb.append(StringPool.CLOSE_PARENTHESIS); } if ((i + 1) != _conditions.size()) { sb.append(StringPool.SPACE); } } return sb.toString(); }
From source file:com.liferay.service.persistence.StudentPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the students where firstName LIKE all ? and studentGender = ?. * * <p>/*w ww . ja v a 2 s. c o m*/ * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.model.impl.StudentModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param firstNames the first names * @param studentGender the student gender * @param start the lower bound of the range of students * @param end the upper bound of the range of students (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching students * @throws SystemException if a system exception occurred */ @Override public List<Student> findByFirstNameAndGender(String[] firstNames, int studentGender, int start, int end, OrderByComparator orderByComparator) throws SystemException { if ((firstNames != null) && (firstNames.length == 1)) { return findByFirstNameAndGender(firstNames[0], studentGender, start, end, orderByComparator); } boolean pagination = true; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderArgs = new Object[] { StringUtil.merge(firstNames), studentGender }; } else { finderArgs = new Object[] { StringUtil.merge(firstNames), studentGender, start, end, orderByComparator }; } List<Student> list = (List<Student>) FinderCacheUtil .getResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_FIRSTNAMEANDGENDER, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (Student student : list) { if (!ArrayUtil.contains(firstNames, student.getFirstName()) || (studentGender != student.getStudentGender())) { list = null; break; } } } if (list == null) { StringBundler query = new StringBundler(); query.append(_SQL_SELECT_STUDENT_WHERE); boolean conjunctionable = false; if ((firstNames == null) || (firstNames.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < firstNames.length; i++) { String firstName = firstNames[i]; if (firstName == null) { query.append(_FINDER_COLUMN_FIRSTNAMEANDGENDER_FIRSTNAME_4); } else if (firstName.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_FIRSTNAMEANDGENDER_FIRSTNAME_6); } else { query.append(_FINDER_COLUMN_FIRSTNAMEANDGENDER_FIRSTNAME_5); } if ((i + 1) < firstNames.length) { query.append(WHERE_AND); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_FIRSTNAMEANDGENDER_STUDENTGENDER_5); conjunctionable = true; if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(StudentModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (firstNames != null) { qPos.add(firstNames); } qPos.add(studentGender); if (!pagination) { list = (List<Student>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<Student>(list); } else { list = (List<Student>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_FIRSTNAMEANDGENDER, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_FIRSTNAMEANDGENDER, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }