List of usage examples for com.liferay.portal.kernel.dao.orm QueryUtil list
public static List<?> list(Query query, Dialect dialect, int start, int end, boolean unmodifiable)
From source file:br.com.prodevelopment.lapidarios.evento.service.persistence.EventoAgendaPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the evento agendas where companyId = ? and groupId = ? and localNome LIKE ? and status = ?. * * <p>//from ww w.jav a 2s. 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 br.com.prodevelopment.lapidarios.evento.model.impl.EventoAgendaModelImpl}. 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 companyId the company ID * @param groupId the group ID * @param localNome the local nome * @param status the status * @param start the lower bound of the range of evento agendas * @param end the upper bound of the range of evento agendas (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching evento agendas * @throws SystemException if a system exception occurred */ @Override public List<EventoAgenda> findByCG_LocalNome(long companyId, long groupId, String localNome, int status, int start, int end, OrderByComparator orderByComparator) throws SystemException { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_LOCALNOME; finderArgs = new Object[] { companyId, groupId, localNome, status, start, end, orderByComparator }; List<EventoAgenda> list = (List<EventoAgenda>) FinderCacheUtil.getResult(finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (EventoAgenda eventoAgenda : list) { if ((companyId != eventoAgenda.getCompanyId()) || (groupId != eventoAgenda.getGroupId()) || !StringUtil.wildcardMatches(eventoAgenda.getLocalNome(), localNome, CharPool.UNDERLINE, CharPool.PERCENT, CharPool.BACK_SLASH, true) || (status != eventoAgenda.getStatus())) { list = null; break; } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler(6 + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(6); } query.append(_SQL_SELECT_EVENTOAGENDA_WHERE); query.append(_FINDER_COLUMN_CG_LOCALNOME_COMPANYID_2); query.append(_FINDER_COLUMN_CG_LOCALNOME_GROUPID_2); boolean bindLocalNome = false; if (localNome == null) { query.append(_FINDER_COLUMN_CG_LOCALNOME_LOCALNOME_1); } else if (localNome.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_CG_LOCALNOME_LOCALNOME_3); } else { bindLocalNome = true; query.append(_FINDER_COLUMN_CG_LOCALNOME_LOCALNOME_2); } query.append(_FINDER_COLUMN_CG_LOCALNOME_STATUS_2); if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(EventoAgendaModelImpl.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(companyId); qPos.add(groupId); if (bindLocalNome) { qPos.add(localNome); } qPos.add(status); if (!pagination) { list = (List<EventoAgenda>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<EventoAgenda>(list); } else { list = (List<EventoAgenda>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(finderPath, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:br.com.prodevelopment.lapidarios.evento.service.persistence.EventoAgendaPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the evento agendas where companyId = ? and groupId = ? and localNome LIKE ? and status = any ?. * * <p>//w w w . j ava2 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 br.com.prodevelopment.lapidarios.evento.model.impl.EventoAgendaModelImpl}. 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 companyId the company ID * @param groupId the group ID * @param localNome the local nome * @param statuses the statuses * @param start the lower bound of the range of evento agendas * @param end the upper bound of the range of evento agendas (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching evento agendas * @throws SystemException if a system exception occurred */ @Override public List<EventoAgenda> findByCG_LocalNome(long companyId, long groupId, String localNome, int[] statuses, int start, int end, OrderByComparator orderByComparator) throws SystemException { if ((statuses != null) && (statuses.length == 1)) { return findByCG_LocalNome(companyId, groupId, localNome, statuses[0], 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[] { companyId, groupId, localNome, StringUtil.merge(statuses) }; } else { finderArgs = new Object[] { companyId, groupId, localNome, StringUtil.merge(statuses), start, end, orderByComparator }; } List<EventoAgenda> list = (List<EventoAgenda>) FinderCacheUtil .getResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_LOCALNOME, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (EventoAgenda eventoAgenda : list) { if ((companyId != eventoAgenda.getCompanyId()) || (groupId != eventoAgenda.getGroupId()) || !StringUtil.wildcardMatches(eventoAgenda.getLocalNome(), localNome, CharPool.UNDERLINE, CharPool.PERCENT, CharPool.BACK_SLASH, true) || !ArrayUtil.contains(statuses, eventoAgenda.getStatus())) { list = null; break; } } } if (list == null) { StringBundler query = new StringBundler(); query.append(_SQL_SELECT_EVENTOAGENDA_WHERE); boolean conjunctionable = false; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_CG_LOCALNOME_COMPANYID_5); conjunctionable = true; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_CG_LOCALNOME_GROUPID_5); conjunctionable = true; if (conjunctionable) { query.append(WHERE_AND); } boolean bindLocalNome = false; if (localNome == null) { query.append(_FINDER_COLUMN_CG_LOCALNOME_LOCALNOME_4); } else if (localNome.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_CG_LOCALNOME_LOCALNOME_6); } else { bindLocalNome = true; query.append(_FINDER_COLUMN_CG_LOCALNOME_LOCALNOME_5); } conjunctionable = true; if ((statuses == null) || (statuses.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < statuses.length; i++) { query.append(_FINDER_COLUMN_CG_LOCALNOME_STATUS_5); if ((i + 1) < statuses.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(EventoAgendaModelImpl.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(companyId); qPos.add(groupId); if (bindLocalNome) { qPos.add(localNome); } if (statuses != null) { qPos.add(statuses); } if (!pagination) { list = (List<EventoAgenda>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<EventoAgenda>(list); } else { list = (List<EventoAgenda>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_LOCALNOME, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_LOCALNOME, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:br.com.prodevelopment.lapidarios.evento.service.persistence.EventoAgendaPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the evento agendas where companyId = ? and groupId = ? and localId = ? and status = ?. * * <p>/*from w ww. j av 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 br.com.prodevelopment.lapidarios.evento.model.impl.EventoAgendaModelImpl}. 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 companyId the company ID * @param groupId the group ID * @param localId the local ID * @param status the status * @param start the lower bound of the range of evento agendas * @param end the upper bound of the range of evento agendas (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching evento agendas * @throws SystemException if a system exception occurred */ @Override public List<EventoAgenda> findByCG_LocalID(long companyId, long groupId, long localId, int status, int start, int end, OrderByComparator orderByComparator) throws SystemException { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CG_LOCALID; finderArgs = new Object[] { companyId, groupId, localId, status }; } else { finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_LOCALID; finderArgs = new Object[] { companyId, groupId, localId, status, start, end, orderByComparator }; } List<EventoAgenda> list = (List<EventoAgenda>) FinderCacheUtil.getResult(finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (EventoAgenda eventoAgenda : list) { if ((companyId != eventoAgenda.getCompanyId()) || (groupId != eventoAgenda.getGroupId()) || (localId != eventoAgenda.getLocalId()) || (status != eventoAgenda.getStatus())) { list = null; break; } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler(6 + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(6); } query.append(_SQL_SELECT_EVENTOAGENDA_WHERE); query.append(_FINDER_COLUMN_CG_LOCALID_COMPANYID_2); query.append(_FINDER_COLUMN_CG_LOCALID_GROUPID_2); query.append(_FINDER_COLUMN_CG_LOCALID_LOCALID_2); query.append(_FINDER_COLUMN_CG_LOCALID_STATUS_2); if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(EventoAgendaModelImpl.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(companyId); qPos.add(groupId); qPos.add(localId); qPos.add(status); if (!pagination) { list = (List<EventoAgenda>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<EventoAgenda>(list); } else { list = (List<EventoAgenda>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(finderPath, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:br.com.prodevelopment.lapidarios.evento.service.persistence.EventoAgendaPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the evento agendas where companyId = ? and groupId = ? and localId = ? and status = any ?. * * <p>//from w w w . 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. 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 br.com.prodevelopment.lapidarios.evento.model.impl.EventoAgendaModelImpl}. 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 companyId the company ID * @param groupId the group ID * @param localId the local ID * @param statuses the statuses * @param start the lower bound of the range of evento agendas * @param end the upper bound of the range of evento agendas (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching evento agendas * @throws SystemException if a system exception occurred */ @Override public List<EventoAgenda> findByCG_LocalID(long companyId, long groupId, long localId, int[] statuses, int start, int end, OrderByComparator orderByComparator) throws SystemException { if ((statuses != null) && (statuses.length == 1)) { return findByCG_LocalID(companyId, groupId, localId, statuses[0], 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[] { companyId, groupId, localId, StringUtil.merge(statuses) }; } else { finderArgs = new Object[] { companyId, groupId, localId, StringUtil.merge(statuses), start, end, orderByComparator }; } List<EventoAgenda> list = (List<EventoAgenda>) FinderCacheUtil .getResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_LOCALID, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (EventoAgenda eventoAgenda : list) { if ((companyId != eventoAgenda.getCompanyId()) || (groupId != eventoAgenda.getGroupId()) || (localId != eventoAgenda.getLocalId()) || !ArrayUtil.contains(statuses, eventoAgenda.getStatus())) { list = null; break; } } } if (list == null) { StringBundler query = new StringBundler(); query.append(_SQL_SELECT_EVENTOAGENDA_WHERE); boolean conjunctionable = false; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_CG_LOCALID_COMPANYID_5); conjunctionable = true; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_CG_LOCALID_GROUPID_5); conjunctionable = true; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_CG_LOCALID_LOCALID_5); conjunctionable = true; if ((statuses == null) || (statuses.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < statuses.length; i++) { query.append(_FINDER_COLUMN_CG_LOCALID_STATUS_5); if ((i + 1) < statuses.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(EventoAgendaModelImpl.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(companyId); qPos.add(groupId); qPos.add(localId); if (statuses != null) { qPos.add(statuses); } if (!pagination) { list = (List<EventoAgenda>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<EventoAgenda>(list); } else { list = (List<EventoAgenda>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_LOCALID, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_LOCALID, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:br.com.prodevelopment.lapidarios.evento.service.persistence.EventoAgendaPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the evento agendas where companyId = ? and groupId = ? and userResponsavelNome LIKE ? and status = ?. * * <p>/* w w w.j av a 2s. 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 br.com.prodevelopment.lapidarios.evento.model.impl.EventoAgendaModelImpl}. 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 companyId the company ID * @param groupId the group ID * @param userResponsavelNome the user responsavel nome * @param status the status * @param start the lower bound of the range of evento agendas * @param end the upper bound of the range of evento agendas (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching evento agendas * @throws SystemException if a system exception occurred */ @Override public List<EventoAgenda> findByCG_ResponsavelNome(long companyId, long groupId, String userResponsavelNome, int status, int start, int end, OrderByComparator orderByComparator) throws SystemException { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_RESPONSAVELNOME; finderArgs = new Object[] { companyId, groupId, userResponsavelNome, status, start, end, orderByComparator }; List<EventoAgenda> list = (List<EventoAgenda>) FinderCacheUtil.getResult(finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (EventoAgenda eventoAgenda : list) { if ((companyId != eventoAgenda.getCompanyId()) || (groupId != eventoAgenda.getGroupId()) || !StringUtil.wildcardMatches(eventoAgenda.getUserResponsavelNome(), userResponsavelNome, CharPool.UNDERLINE, CharPool.PERCENT, CharPool.BACK_SLASH, true) || (status != eventoAgenda.getStatus())) { list = null; break; } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler(6 + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(6); } query.append(_SQL_SELECT_EVENTOAGENDA_WHERE); query.append(_FINDER_COLUMN_CG_RESPONSAVELNOME_COMPANYID_2); query.append(_FINDER_COLUMN_CG_RESPONSAVELNOME_GROUPID_2); boolean bindUserResponsavelNome = false; if (userResponsavelNome == null) { query.append(_FINDER_COLUMN_CG_RESPONSAVELNOME_USERRESPONSAVELNOME_1); } else if (userResponsavelNome.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_CG_RESPONSAVELNOME_USERRESPONSAVELNOME_3); } else { bindUserResponsavelNome = true; query.append(_FINDER_COLUMN_CG_RESPONSAVELNOME_USERRESPONSAVELNOME_2); } query.append(_FINDER_COLUMN_CG_RESPONSAVELNOME_STATUS_2); if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(EventoAgendaModelImpl.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(companyId); qPos.add(groupId); if (bindUserResponsavelNome) { qPos.add(userResponsavelNome); } qPos.add(status); if (!pagination) { list = (List<EventoAgenda>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<EventoAgenda>(list); } else { list = (List<EventoAgenda>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(finderPath, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:br.com.prodevelopment.lapidarios.evento.service.persistence.EventoAgendaPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the evento agendas where companyId = ? and groupId = ? and userResponsavelNome LIKE ? and status = any ?. * * <p>//from ww w.j a v a2 s.co 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 br.com.prodevelopment.lapidarios.evento.model.impl.EventoAgendaModelImpl}. 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 companyId the company ID * @param groupId the group ID * @param userResponsavelNome the user responsavel nome * @param statuses the statuses * @param start the lower bound of the range of evento agendas * @param end the upper bound of the range of evento agendas (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching evento agendas * @throws SystemException if a system exception occurred */ @Override public List<EventoAgenda> findByCG_ResponsavelNome(long companyId, long groupId, String userResponsavelNome, int[] statuses, int start, int end, OrderByComparator orderByComparator) throws SystemException { if ((statuses != null) && (statuses.length == 1)) { return findByCG_ResponsavelNome(companyId, groupId, userResponsavelNome, statuses[0], 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[] { companyId, groupId, userResponsavelNome, StringUtil.merge(statuses) }; } else { finderArgs = new Object[] { companyId, groupId, userResponsavelNome, StringUtil.merge(statuses), start, end, orderByComparator }; } List<EventoAgenda> list = (List<EventoAgenda>) FinderCacheUtil .getResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_RESPONSAVELNOME, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (EventoAgenda eventoAgenda : list) { if ((companyId != eventoAgenda.getCompanyId()) || (groupId != eventoAgenda.getGroupId()) || !StringUtil.wildcardMatches(eventoAgenda.getUserResponsavelNome(), userResponsavelNome, CharPool.UNDERLINE, CharPool.PERCENT, CharPool.BACK_SLASH, true) || !ArrayUtil.contains(statuses, eventoAgenda.getStatus())) { list = null; break; } } } if (list == null) { StringBundler query = new StringBundler(); query.append(_SQL_SELECT_EVENTOAGENDA_WHERE); boolean conjunctionable = false; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_CG_RESPONSAVELNOME_COMPANYID_5); conjunctionable = true; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_CG_RESPONSAVELNOME_GROUPID_5); conjunctionable = true; if (conjunctionable) { query.append(WHERE_AND); } boolean bindUserResponsavelNome = false; if (userResponsavelNome == null) { query.append(_FINDER_COLUMN_CG_RESPONSAVELNOME_USERRESPONSAVELNOME_4); } else if (userResponsavelNome.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_CG_RESPONSAVELNOME_USERRESPONSAVELNOME_6); } else { bindUserResponsavelNome = true; query.append(_FINDER_COLUMN_CG_RESPONSAVELNOME_USERRESPONSAVELNOME_5); } conjunctionable = true; if ((statuses == null) || (statuses.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < statuses.length; i++) { query.append(_FINDER_COLUMN_CG_RESPONSAVELNOME_STATUS_5); if ((i + 1) < statuses.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(EventoAgendaModelImpl.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(companyId); qPos.add(groupId); if (bindUserResponsavelNome) { qPos.add(userResponsavelNome); } if (statuses != null) { qPos.add(statuses); } if (!pagination) { list = (List<EventoAgenda>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<EventoAgenda>(list); } else { list = (List<EventoAgenda>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_RESPONSAVELNOME, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_RESPONSAVELNOME, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:br.com.prodevelopment.lapidarios.evento.service.persistence.EventoAgendaPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the evento agendas where companyId = ? and groupId = ? and userResponsavelId = ? and status = ?. * * <p>/*from w w w .ja va 2s. c om*/ * 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 br.com.prodevelopment.lapidarios.evento.model.impl.EventoAgendaModelImpl}. 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 companyId the company ID * @param groupId the group ID * @param userResponsavelId the user responsavel ID * @param status the status * @param start the lower bound of the range of evento agendas * @param end the upper bound of the range of evento agendas (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching evento agendas * @throws SystemException if a system exception occurred */ @Override public List<EventoAgenda> findByCG_ResponsavelId(long companyId, long groupId, long userResponsavelId, int status, int start, int end, OrderByComparator orderByComparator) throws SystemException { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CG_RESPONSAVELID; finderArgs = new Object[] { companyId, groupId, userResponsavelId, status }; } else { finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_RESPONSAVELID; finderArgs = new Object[] { companyId, groupId, userResponsavelId, status, start, end, orderByComparator }; } List<EventoAgenda> list = (List<EventoAgenda>) FinderCacheUtil.getResult(finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (EventoAgenda eventoAgenda : list) { if ((companyId != eventoAgenda.getCompanyId()) || (groupId != eventoAgenda.getGroupId()) || (userResponsavelId != eventoAgenda.getUserResponsavelId()) || (status != eventoAgenda.getStatus())) { list = null; break; } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler(6 + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(6); } query.append(_SQL_SELECT_EVENTOAGENDA_WHERE); query.append(_FINDER_COLUMN_CG_RESPONSAVELID_COMPANYID_2); query.append(_FINDER_COLUMN_CG_RESPONSAVELID_GROUPID_2); query.append(_FINDER_COLUMN_CG_RESPONSAVELID_USERRESPONSAVELID_2); query.append(_FINDER_COLUMN_CG_RESPONSAVELID_STATUS_2); if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(EventoAgendaModelImpl.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(companyId); qPos.add(groupId); qPos.add(userResponsavelId); qPos.add(status); if (!pagination) { list = (List<EventoAgenda>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<EventoAgenda>(list); } else { list = (List<EventoAgenda>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(finderPath, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:br.com.prodevelopment.lapidarios.evento.service.persistence.EventoAgendaPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the evento agendas where companyId = ? and groupId = ? and userResponsavelId = ? and status = any ?. * * <p>//w w w.java 2s . 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 br.com.prodevelopment.lapidarios.evento.model.impl.EventoAgendaModelImpl}. 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 companyId the company ID * @param groupId the group ID * @param userResponsavelId the user responsavel ID * @param statuses the statuses * @param start the lower bound of the range of evento agendas * @param end the upper bound of the range of evento agendas (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching evento agendas * @throws SystemException if a system exception occurred */ @Override public List<EventoAgenda> findByCG_ResponsavelId(long companyId, long groupId, long userResponsavelId, int[] statuses, int start, int end, OrderByComparator orderByComparator) throws SystemException { if ((statuses != null) && (statuses.length == 1)) { return findByCG_ResponsavelId(companyId, groupId, userResponsavelId, statuses[0], 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[] { companyId, groupId, userResponsavelId, StringUtil.merge(statuses) }; } else { finderArgs = new Object[] { companyId, groupId, userResponsavelId, StringUtil.merge(statuses), start, end, orderByComparator }; } List<EventoAgenda> list = (List<EventoAgenda>) FinderCacheUtil .getResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_RESPONSAVELID, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (EventoAgenda eventoAgenda : list) { if ((companyId != eventoAgenda.getCompanyId()) || (groupId != eventoAgenda.getGroupId()) || (userResponsavelId != eventoAgenda.getUserResponsavelId()) || !ArrayUtil.contains(statuses, eventoAgenda.getStatus())) { list = null; break; } } } if (list == null) { StringBundler query = new StringBundler(); query.append(_SQL_SELECT_EVENTOAGENDA_WHERE); boolean conjunctionable = false; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_CG_RESPONSAVELID_COMPANYID_5); conjunctionable = true; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_CG_RESPONSAVELID_GROUPID_5); conjunctionable = true; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_CG_RESPONSAVELID_USERRESPONSAVELID_5); conjunctionable = true; if ((statuses == null) || (statuses.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < statuses.length; i++) { query.append(_FINDER_COLUMN_CG_RESPONSAVELID_STATUS_5); if ((i + 1) < statuses.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(EventoAgendaModelImpl.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(companyId); qPos.add(groupId); qPos.add(userResponsavelId); if (statuses != null) { qPos.add(statuses); } if (!pagination) { list = (List<EventoAgenda>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<EventoAgenda>(list); } else { list = (List<EventoAgenda>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_RESPONSAVELID, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_RESPONSAVELID, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:br.com.prodevelopment.lapidarios.evento.service.persistence.EventoAgendaPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the evento agendas. * * <p>// ww w.j a v a2 s.co 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 br.com.prodevelopment.lapidarios.evento.model.impl.EventoAgendaModelImpl}. 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 start the lower bound of the range of evento agendas * @param end the upper bound of the range of evento agendas (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of evento agendas * @throws SystemException if a system exception occurred */ @Override public List<EventoAgenda> findAll(int start, int end, OrderByComparator orderByComparator) throws SystemException { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL; finderArgs = FINDER_ARGS_EMPTY; } else { finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL; finderArgs = new Object[] { start, end, orderByComparator }; } List<EventoAgenda> list = (List<EventoAgenda>) FinderCacheUtil.getResult(finderPath, finderArgs, this); if (list == null) { StringBundler query = null; String sql = null; if (orderByComparator != null) { query = new StringBundler(2 + (orderByComparator.getOrderByFields().length * 3)); query.append(_SQL_SELECT_EVENTOAGENDA); appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); sql = query.toString(); } else { sql = _SQL_SELECT_EVENTOAGENDA; if (pagination) { sql = sql.concat(EventoAgendaModelImpl.ORDER_BY_JPQL); } } Session session = null; try { session = openSession(); Query q = session.createQuery(sql); if (!pagination) { list = (List<EventoAgenda>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<EventoAgenda>(list); } else { list = (List<EventoAgenda>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(finderPath, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:br.com.prodevelopment.lapidarios.evento.service.persistence.EventoInscricaoPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the evento inscricaos where uuid = ?. * * <p>//ww w .j ava 2s. 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 br.com.prodevelopment.lapidarios.evento.model.impl.EventoInscricaoModelImpl}. 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 uuid the uuid * @param start the lower bound of the range of evento inscricaos * @param end the upper bound of the range of evento inscricaos (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching evento inscricaos * @throws SystemException if a system exception occurred */ @Override public List<EventoInscricao> findByUuid(String uuid, int start, int end, OrderByComparator orderByComparator) throws SystemException { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID; finderArgs = new Object[] { uuid }; } else { finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID; finderArgs = new Object[] { uuid, start, end, orderByComparator }; } List<EventoInscricao> list = (List<EventoInscricao>) FinderCacheUtil.getResult(finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (EventoInscricao eventoInscricao : list) { if (!Validator.equals(uuid, eventoInscricao.getUuid())) { list = null; break; } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler(3 + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(3); } query.append(_SQL_SELECT_EVENTOINSCRICAO_WHERE); boolean bindUuid = false; if (uuid == null) { query.append(_FINDER_COLUMN_UUID_UUID_1); } else if (uuid.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_UUID_UUID_3); } else { bindUuid = true; query.append(_FINDER_COLUMN_UUID_UUID_2); } if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(EventoInscricaoModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindUuid) { qPos.add(uuid); } if (!pagination) { list = (List<EventoInscricao>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<EventoInscricao>(list); } else { list = (List<EventoInscricao>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(finderPath, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }