Example usage for com.liferay.portal.kernel.util ArrayUtil contains

List of usage examples for com.liferay.portal.kernel.util ArrayUtil contains

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util ArrayUtil contains.

Prototype

public static boolean contains(short[] array, short value) 

Source Link

Usage

From source file:au.com.permeance.liferay.portal.documentlibrary.util.DLFileNameNormalizerImpl.java

License:Open Source License

public String normalize(String fileName, char[] replaceChars) {
    if (Validator.isNull(fileName)) {
        return fileName;
    }//from   w w  w  . j  a v  a2  s  .c  om

    fileName = GetterUtil.getString(fileName);
    fileName = fileName.toLowerCase();
    fileName = Normalizer.normalizeToAscii(fileName);

    StringBuilder sb = null;

    int index = 0;

    for (int i = 0; i < fileName.length(); i++) {
        char c = fileName.charAt(i);

        if ((Arrays.binarySearch(_REPLACE_CHARS, c) >= 0)
                || ((replaceChars != null) && ArrayUtil.contains(replaceChars, c))) {

            if (sb == null) {
                sb = new StringBuilder();
            }

            if (i > index) {
                sb.append(fileName.substring(index, i));
            }

            sb.append(CharPool.DASH);
            // sb.append(CharPool.UNDERLINE);

            index = i + 1;
        }
    }

    if (sb != null) {
        if (index < fileName.length()) {
            sb.append(fileName.substring(index));
        }

        fileName = sb.toString();
    }

    while (fileName.indexOf(StringPool.DOUBLE_DASH) >= 0) {
        fileName = StringUtil.replace(fileName, StringPool.DOUBLE_DASH, StringPool.DASH);
    }

    return fileName;
}

From source file:br.com.petrobras.ddm.type.region.internal.RegionDDMFormFieldContextHelper.java

License:Open Source License

protected boolean isSelected(String optionValue) {
    if (ArrayUtil.isEmpty(_values)) {
        return ArrayUtil.contains(_predefinedValues, optionValue);
    }//from w w w  .  j  a v a2 s. co  m

    if (ArrayUtil.contains(_values, optionValue)) {
        return true;
    }

    return false;
}

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 = &#63; and groupId = &#63; and status = any &#63;.
 *
 * <p>//from   w w w . ja  va2  s. 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 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(long companyId, long groupId, int[] statuses, int start, int end,
        OrderByComparator orderByComparator) throws SystemException {
    if ((statuses != null) && (statuses.length == 1)) {
        return findByCG(companyId, groupId, 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, StringUtil.merge(statuses) };
    } else {
        finderArgs = new Object[] { companyId, groupId, StringUtil.merge(statuses),

                start, end, orderByComparator };
    }

    List<EventoAgenda> list = (List<EventoAgenda>) FinderCacheUtil
            .getResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_CG, finderArgs, this);

    if ((list != null) && !list.isEmpty()) {
        for (EventoAgenda eventoAgenda : list) {
            if ((companyId != eventoAgenda.getCompanyId()) || (groupId != eventoAgenda.getGroupId())
                    || !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_COMPANYID_5);

        conjunctionable = true;

        if (conjunctionable) {
            query.append(WHERE_AND);
        }

        query.append(_FINDER_COLUMN_CG_GROUPID_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_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 (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, finderArgs, list);
        } catch (Exception e) {
            FinderCacheUtil.removeResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_CG, 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 = &#63; and groupId = &#63; and dataEvento = &#63; and status = any &#63;.
 *
 * <p>/*from  w  w  w .  j a v  a2  s  .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 dataEvento the data evento
 * @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_Data(long companyId, long groupId, Date dataEvento, int[] statuses,
        int start, int end, OrderByComparator orderByComparator) throws SystemException {
    if ((statuses != null) && (statuses.length == 1)) {
        return findByCG_Data(companyId, groupId, dataEvento, 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, dataEvento, StringUtil.merge(statuses) };
    } else {
        finderArgs = new Object[] { companyId, groupId, dataEvento, StringUtil.merge(statuses),

                start, end, orderByComparator };
    }

    List<EventoAgenda> list = (List<EventoAgenda>) FinderCacheUtil
            .getResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_DATA, finderArgs, this);

    if ((list != null) && !list.isEmpty()) {
        for (EventoAgenda eventoAgenda : list) {
            if ((companyId != eventoAgenda.getCompanyId()) || (groupId != eventoAgenda.getGroupId())
                    || !Validator.equals(dataEvento, eventoAgenda.getDataEvento())
                    || !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_DATA_COMPANYID_5);

        conjunctionable = true;

        if (conjunctionable) {
            query.append(WHERE_AND);
        }

        query.append(_FINDER_COLUMN_CG_DATA_GROUPID_5);

        conjunctionable = true;

        if (conjunctionable) {
            query.append(WHERE_AND);
        }

        boolean bindDataEvento = false;

        if (dataEvento == null) {
            query.append(_FINDER_COLUMN_CG_DATA_DATAEVENTO_4);
        } else {
            bindDataEvento = true;

            query.append(_FINDER_COLUMN_CG_DATA_DATAEVENTO_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_DATA_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 (bindDataEvento) {
                qPos.add(CalendarUtil.getTimestamp(dataEvento));
            }

            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_DATA, finderArgs, list);
        } catch (Exception e) {
            FinderCacheUtil.removeResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_DATA, 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 = &#63; and groupId = &#63; and eventoId = &#63; and dataEvento = &#63; and status = any &#63;.
 *
 * <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. 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 eventoId the evento ID
 * @param dataEvento the data evento
 * @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_Evento_Data(long companyId, long groupId, long eventoId, Date dataEvento,
        int[] statuses, int start, int end, OrderByComparator orderByComparator) throws SystemException {
    if ((statuses != null) && (statuses.length == 1)) {
        return findByCG_Evento_Data(companyId, groupId, eventoId, dataEvento, 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, eventoId, dataEvento, StringUtil.merge(statuses) };
    } else {
        finderArgs = new Object[] { companyId, groupId, eventoId, dataEvento, StringUtil.merge(statuses),

                start, end, orderByComparator };
    }

    List<EventoAgenda> list = (List<EventoAgenda>) FinderCacheUtil
            .getResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_EVENTO_DATA, finderArgs, this);

    if ((list != null) && !list.isEmpty()) {
        for (EventoAgenda eventoAgenda : list) {
            if ((companyId != eventoAgenda.getCompanyId()) || (groupId != eventoAgenda.getGroupId())
                    || (eventoId != eventoAgenda.getEventoId())
                    || !Validator.equals(dataEvento, eventoAgenda.getDataEvento())
                    || !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_EVENTO_DATA_COMPANYID_5);

        conjunctionable = true;

        if (conjunctionable) {
            query.append(WHERE_AND);
        }

        query.append(_FINDER_COLUMN_CG_EVENTO_DATA_GROUPID_5);

        conjunctionable = true;

        if (conjunctionable) {
            query.append(WHERE_AND);
        }

        query.append(_FINDER_COLUMN_CG_EVENTO_DATA_EVENTOID_5);

        conjunctionable = true;

        if (conjunctionable) {
            query.append(WHERE_AND);
        }

        boolean bindDataEvento = false;

        if (dataEvento == null) {
            query.append(_FINDER_COLUMN_CG_EVENTO_DATA_DATAEVENTO_4);
        } else {
            bindDataEvento = true;

            query.append(_FINDER_COLUMN_CG_EVENTO_DATA_DATAEVENTO_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_EVENTO_DATA_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(eventoId);

            if (bindDataEvento) {
                qPos.add(CalendarUtil.getTimestamp(dataEvento));
            }

            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_EVENTO_DATA, finderArgs, list);
        } catch (Exception e) {
            FinderCacheUtil.removeResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_EVENTO_DATA, 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 = &#63; and groupId = &#63; and eventoNome LIKE &#63; and status = any &#63;.
 *
 * <p>//from   w  ww  .  j av a  2 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 eventoNome the evento 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_EventoNome(long companyId, long groupId, String eventoNome, int[] statuses,
        int start, int end, OrderByComparator orderByComparator) throws SystemException {
    if ((statuses != null) && (statuses.length == 1)) {
        return findByCG_EventoNome(companyId, groupId, eventoNome, 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, eventoNome, StringUtil.merge(statuses) };
    } else {
        finderArgs = new Object[] { companyId, groupId, eventoNome, StringUtil.merge(statuses),

                start, end, orderByComparator };
    }

    List<EventoAgenda> list = (List<EventoAgenda>) FinderCacheUtil
            .getResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_EVENTONOME, finderArgs, this);

    if ((list != null) && !list.isEmpty()) {
        for (EventoAgenda eventoAgenda : list) {
            if ((companyId != eventoAgenda.getCompanyId()) || (groupId != eventoAgenda.getGroupId())
                    || !StringUtil.wildcardMatches(eventoAgenda.getEventoNome(), eventoNome, 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_EVENTONOME_COMPANYID_5);

        conjunctionable = true;

        if (conjunctionable) {
            query.append(WHERE_AND);
        }

        query.append(_FINDER_COLUMN_CG_EVENTONOME_GROUPID_5);

        conjunctionable = true;

        if (conjunctionable) {
            query.append(WHERE_AND);
        }

        boolean bindEventoNome = false;

        if (eventoNome == null) {
            query.append(_FINDER_COLUMN_CG_EVENTONOME_EVENTONOME_4);
        } else if (eventoNome.equals(StringPool.BLANK)) {
            query.append(_FINDER_COLUMN_CG_EVENTONOME_EVENTONOME_6);
        } else {
            bindEventoNome = true;

            query.append(_FINDER_COLUMN_CG_EVENTONOME_EVENTONOME_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_EVENTONOME_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 (bindEventoNome) {
                qPos.add(eventoNome);
            }

            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_EVENTONOME, finderArgs, list);
        } catch (Exception e) {
            FinderCacheUtil.removeResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_EVENTONOME, 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 = &#63; and groupId = &#63; and eventoId = &#63; and status = any &#63;.
 *
 * <p>/*from   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 eventoId the evento 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_EventoID(long companyId, long groupId, long eventoId, int[] statuses,
        int start, int end, OrderByComparator orderByComparator) throws SystemException {
    if ((statuses != null) && (statuses.length == 1)) {
        return findByCG_EventoID(companyId, groupId, eventoId, 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, eventoId, StringUtil.merge(statuses) };
    } else {
        finderArgs = new Object[] { companyId, groupId, eventoId, StringUtil.merge(statuses),

                start, end, orderByComparator };
    }

    List<EventoAgenda> list = (List<EventoAgenda>) FinderCacheUtil
            .getResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_EVENTOID, finderArgs, this);

    if ((list != null) && !list.isEmpty()) {
        for (EventoAgenda eventoAgenda : list) {
            if ((companyId != eventoAgenda.getCompanyId()) || (groupId != eventoAgenda.getGroupId())
                    || (eventoId != eventoAgenda.getEventoId())
                    || !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_EVENTOID_COMPANYID_5);

        conjunctionable = true;

        if (conjunctionable) {
            query.append(WHERE_AND);
        }

        query.append(_FINDER_COLUMN_CG_EVENTOID_GROUPID_5);

        conjunctionable = true;

        if (conjunctionable) {
            query.append(WHERE_AND);
        }

        query.append(_FINDER_COLUMN_CG_EVENTOID_EVENTOID_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_EVENTOID_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(eventoId);

            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_EVENTOID, finderArgs, list);
        } catch (Exception e) {
            FinderCacheUtil.removeResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_CG_EVENTOID, 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 = &#63; and groupId = &#63; and localNome LIKE &#63; and status = any &#63;.
 *
 * <p>/*from w  w  w  . 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 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 = &#63; and groupId = &#63; and localId = &#63; and status = any &#63;.
 *
 * <p>/* www  . j a  v 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 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 = &#63; and groupId = &#63; and userResponsavelNome LIKE &#63; and status = any &#63;.
 *
 * <p>//  w w w. j a  v 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 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;
}