Example usage for com.liferay.portal.kernel.dao.orm QueryUtil list

List of usage examples for com.liferay.portal.kernel.dao.orm QueryUtil list

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.dao.orm QueryUtil list.

Prototype

public static List<?> list(Query query, Dialect dialect, int start, int end, boolean unmodifiable) 

Source Link

Usage

From source file:com.asu.poly.teams.manualSelect.slayer.service.persistence.TeamPersistenceImpl.java

License:Open Source License

/**
 * Returns an ordered range of all the teams.
 *
 * <p>//www.ja  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.
 * </p>
 *
 * @param start the lower bound of the range of teams
 * @param end the upper bound of the range of teams (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of teams
 * @throws SystemException if a system exception occurred
 */
public List<Team> findAll(int start, int end, OrderByComparator orderByComparator) throws SystemException {
    FinderPath finderPath = null;
    Object[] finderArgs = new Object[] { start, end, orderByComparator };

    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) {
        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<Team> list = (List<Team>) 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_TEAM);

            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator);

            sql = query.toString();
        } else {
            sql = _SQL_SELECT_TEAM;
        }

        Session session = null;

        try {
            session = openSession();

            Query q = session.createQuery(sql);

            if (orderByComparator == null) {
                list = (List<Team>) QueryUtil.list(q, getDialect(), start, end, false);

                Collections.sort(list);
            } else {
                list = (List<Team>) QueryUtil.list(q, getDialect(), start, end);
            }
        } catch (Exception e) {
            throw processException(e);
        } finally {
            if (list == null) {
                FinderCacheUtil.removeResult(finderPath, finderArgs);
            } else {
                cacheResult(list);

                FinderCacheUtil.putResult(finderPath, finderArgs, list);
            }

            closeSession(session);
        }
    }

    return list;
}

From source file:com.bank.service.persistence.customerRelPersistenceImpl.java

License:Open Source License

/**
 * Returns an ordered range of all the customer rels.
 *
 * <p>//from w w w. java  2 s.  com
 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
 * </p>
 *
 * @param start the lower bound of the range of customer rels
 * @param end the upper bound of the range of customer rels (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of customer rels
 * @throws SystemException if a system exception occurred
 */
public List<customerRel> findAll(int start, int end, OrderByComparator orderByComparator)
        throws SystemException {
    FinderPath finderPath = null;
    Object[] finderArgs = new Object[] { start, end, orderByComparator };

    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) {
        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<customerRel> list = (List<customerRel>) 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_CUSTOMERREL);

            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator);

            sql = query.toString();
        } else {
            sql = _SQL_SELECT_CUSTOMERREL;
        }

        Session session = null;

        try {
            session = openSession();

            Query q = session.createQuery(sql);

            if (orderByComparator == null) {
                list = (List<customerRel>) QueryUtil.list(q, getDialect(), start, end, false);

                Collections.sort(list);
            } else {
                list = (List<customerRel>) QueryUtil.list(q, getDialect(), start, end);
            }
        } catch (Exception e) {
            throw processException(e);
        } finally {
            if (list == null) {
                FinderCacheUtil.removeResult(finderPath, finderArgs);
            } else {
                cacheResult(list);

                FinderCacheUtil.putResult(finderPath, finderArgs, list);
            }

            closeSession(session);
        }
    }

    return list;
}

From source file:com.bcnet.portlet.biobank.service.persistence.BiobankAtrributeListsMasterPersistenceImpl.java

License:Open Source License

/**
 * Returns an ordered range of all the biobank atrribute lists masters where attributeListName = &#63;.
 *
 * <p>//w  w w. ja  v  a 2  s .  c  o  m
 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.bcnet.portlet.biobank.model.impl.BiobankAtrributeListsMasterModelImpl}. 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 attributeListName the attribute list name
 * @param start the lower bound of the range of biobank atrribute lists masters
 * @param end the upper bound of the range of biobank atrribute lists masters (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of matching biobank atrribute lists masters
 * @throws SystemException if a system exception occurred
 */
@Override
public List<BiobankAtrributeListsMaster> findByattribute(String attributeListName, 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_ATTRIBUTE;
        finderArgs = new Object[] { attributeListName };
    } else {
        finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_ATTRIBUTE;
        finderArgs = new Object[] { attributeListName,

                start, end, orderByComparator };
    }

    List<BiobankAtrributeListsMaster> list = (List<BiobankAtrributeListsMaster>) FinderCacheUtil
            .getResult(finderPath, finderArgs, this);

    if ((list != null) && !list.isEmpty()) {
        for (BiobankAtrributeListsMaster biobankAtrributeListsMaster : list) {
            if (!Validator.equals(attributeListName, biobankAtrributeListsMaster.getAttributeListName())) {
                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_BIOBANKATRRIBUTELISTSMASTER_WHERE);

        boolean bindAttributeListName = false;

        if (attributeListName == null) {
            query.append(_FINDER_COLUMN_ATTRIBUTE_ATTRIBUTELISTNAME_1);
        } else if (attributeListName.equals(StringPool.BLANK)) {
            query.append(_FINDER_COLUMN_ATTRIBUTE_ATTRIBUTELISTNAME_3);
        } else {
            bindAttributeListName = true;

            query.append(_FINDER_COLUMN_ATTRIBUTE_ATTRIBUTELISTNAME_2);
        }

        if (orderByComparator != null) {
            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator);
        } else if (pagination) {
            query.append(BiobankAtrributeListsMasterModelImpl.ORDER_BY_JPQL);
        }

        String sql = query.toString();

        Session session = null;

        try {
            session = openSession();

            Query q = session.createQuery(sql);

            QueryPos qPos = QueryPos.getInstance(q);

            if (bindAttributeListName) {
                qPos.add(attributeListName);
            }

            if (!pagination) {
                list = (List<BiobankAtrributeListsMaster>) QueryUtil.list(q, getDialect(), start, end, false);

                Collections.sort(list);

                list = new UnmodifiableList<BiobankAtrributeListsMaster>(list);
            } else {
                list = (List<BiobankAtrributeListsMaster>) 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:com.bcnet.portlet.biobank.service.persistence.BiobankAtrributeListsMasterPersistenceImpl.java

License:Open Source License

/**
 * Returns an ordered range of all the biobank atrribute lists masters.
 *
 * <p>//from  www. 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 com.bcnet.portlet.biobank.model.impl.BiobankAtrributeListsMasterModelImpl}. 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 biobank atrribute lists masters
 * @param end the upper bound of the range of biobank atrribute lists masters (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of biobank atrribute lists masters
 * @throws SystemException if a system exception occurred
 */
@Override
public List<BiobankAtrributeListsMaster> 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<BiobankAtrributeListsMaster> list = (List<BiobankAtrributeListsMaster>) 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_BIOBANKATRRIBUTELISTSMASTER);

            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator);

            sql = query.toString();
        } else {
            sql = _SQL_SELECT_BIOBANKATRRIBUTELISTSMASTER;

            if (pagination) {
                sql = sql.concat(BiobankAtrributeListsMasterModelImpl.ORDER_BY_JPQL);
            }
        }

        Session session = null;

        try {
            session = openSession();

            Query q = session.createQuery(sql);

            if (!pagination) {
                list = (List<BiobankAtrributeListsMaster>) QueryUtil.list(q, getDialect(), start, end, false);

                Collections.sort(list);

                list = new UnmodifiableList<BiobankAtrributeListsMaster>(list);
            } else {
                list = (List<BiobankAtrributeListsMaster>) 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:com.bcnet.portlet.biobank.service.persistence.BiobankAttributeListsPersistenceImpl.java

License:Open Source License

/**
 * Returns an ordered range of all the biobank attribute listses where biobankDbId = &#63;.
 *
 * <p>/*from 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 com.bcnet.portlet.biobank.model.impl.BiobankAttributeListsModelImpl}. 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 biobankDbId the biobank db ID
 * @param start the lower bound of the range of biobank attribute listses
 * @param end the upper bound of the range of biobank attribute listses (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of matching biobank attribute listses
 * @throws SystemException if a system exception occurred
 */
@Override
public List<BiobankAttributeLists> findBybiobankDbId(long biobankDbId, 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_BIOBANKDBID;
        finderArgs = new Object[] { biobankDbId };
    } else {
        finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_BIOBANKDBID;
        finderArgs = new Object[] { biobankDbId, start, end, orderByComparator };
    }

    List<BiobankAttributeLists> list = (List<BiobankAttributeLists>) FinderCacheUtil.getResult(finderPath,
            finderArgs, this);

    if ((list != null) && !list.isEmpty()) {
        for (BiobankAttributeLists biobankAttributeLists : list) {
            if ((biobankDbId != biobankAttributeLists.getBiobankDbId())) {
                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_BIOBANKATTRIBUTELISTS_WHERE);

        query.append(_FINDER_COLUMN_BIOBANKDBID_BIOBANKDBID_2);

        if (orderByComparator != null) {
            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator);
        } else if (pagination) {
            query.append(BiobankAttributeListsModelImpl.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(biobankDbId);

            if (!pagination) {
                list = (List<BiobankAttributeLists>) QueryUtil.list(q, getDialect(), start, end, false);

                Collections.sort(list);

                list = new UnmodifiableList<BiobankAttributeLists>(list);
            } else {
                list = (List<BiobankAttributeLists>) 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:com.bcnet.portlet.biobank.service.persistence.BiobankAttributeListsPersistenceImpl.java

License:Open Source License

/**
 * Returns an ordered range of all the biobank attribute listses where biobankDbId = &#63; and attributeListName = &#63;.
 *
 * <p>// w ww. ja  v  a 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 com.bcnet.portlet.biobank.model.impl.BiobankAttributeListsModelImpl}. 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 biobankDbId the biobank db ID
 * @param attributeListName the attribute list name
 * @param start the lower bound of the range of biobank attribute listses
 * @param end the upper bound of the range of biobank attribute listses (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of matching biobank attribute listses
 * @throws SystemException if a system exception occurred
 */
@Override
public List<BiobankAttributeLists> findBybiobankDbId_attributeListName(long biobankDbId,
        String attributeListName, 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_BIOBANKDBID_ATTRIBUTELISTNAME;
        finderArgs = new Object[] { biobankDbId, attributeListName };
    } else {
        finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_BIOBANKDBID_ATTRIBUTELISTNAME;
        finderArgs = new Object[] { biobankDbId, attributeListName,

                start, end, orderByComparator };
    }

    List<BiobankAttributeLists> list = (List<BiobankAttributeLists>) FinderCacheUtil.getResult(finderPath,
            finderArgs, this);

    if ((list != null) && !list.isEmpty()) {
        for (BiobankAttributeLists biobankAttributeLists : list) {
            if ((biobankDbId != biobankAttributeLists.getBiobankDbId())
                    || !Validator.equals(attributeListName, biobankAttributeLists.getAttributeListName())) {
                list = null;

                break;
            }
        }
    }

    if (list == null) {
        StringBundler query = null;

        if (orderByComparator != null) {
            query = new StringBundler(4 + (orderByComparator.getOrderByFields().length * 3));
        } else {
            query = new StringBundler(4);
        }

        query.append(_SQL_SELECT_BIOBANKATTRIBUTELISTS_WHERE);

        query.append(_FINDER_COLUMN_BIOBANKDBID_ATTRIBUTELISTNAME_BIOBANKDBID_2);

        boolean bindAttributeListName = false;

        if (attributeListName == null) {
            query.append(_FINDER_COLUMN_BIOBANKDBID_ATTRIBUTELISTNAME_ATTRIBUTELISTNAME_1);
        } else if (attributeListName.equals(StringPool.BLANK)) {
            query.append(_FINDER_COLUMN_BIOBANKDBID_ATTRIBUTELISTNAME_ATTRIBUTELISTNAME_3);
        } else {
            bindAttributeListName = true;

            query.append(_FINDER_COLUMN_BIOBANKDBID_ATTRIBUTELISTNAME_ATTRIBUTELISTNAME_2);
        }

        if (orderByComparator != null) {
            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator);
        } else if (pagination) {
            query.append(BiobankAttributeListsModelImpl.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(biobankDbId);

            if (bindAttributeListName) {
                qPos.add(attributeListName);
            }

            if (!pagination) {
                list = (List<BiobankAttributeLists>) QueryUtil.list(q, getDialect(), start, end, false);

                Collections.sort(list);

                list = new UnmodifiableList<BiobankAttributeLists>(list);
            } else {
                list = (List<BiobankAttributeLists>) 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:com.bcnet.portlet.biobank.service.persistence.BiobankAttributeListsPersistenceImpl.java

License:Open Source License

/**
 * Returns an ordered range of all the biobank attribute listses.
 *
 * <p>/*from   www .  ja  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 com.bcnet.portlet.biobank.model.impl.BiobankAttributeListsModelImpl}. 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 biobank attribute listses
 * @param end the upper bound of the range of biobank attribute listses (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of biobank attribute listses
 * @throws SystemException if a system exception occurred
 */
@Override
public List<BiobankAttributeLists> 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<BiobankAttributeLists> list = (List<BiobankAttributeLists>) 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_BIOBANKATTRIBUTELISTS);

            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator);

            sql = query.toString();
        } else {
            sql = _SQL_SELECT_BIOBANKATTRIBUTELISTS;

            if (pagination) {
                sql = sql.concat(BiobankAttributeListsModelImpl.ORDER_BY_JPQL);
            }
        }

        Session session = null;

        try {
            session = openSession();

            Query q = session.createQuery(sql);

            if (!pagination) {
                list = (List<BiobankAttributeLists>) QueryUtil.list(q, getDialect(), start, end, false);

                Collections.sort(list);

                list = new UnmodifiableList<BiobankAttributeLists>(list);
            } else {
                list = (List<BiobankAttributeLists>) 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:com.bcnet.portlet.biobank.service.persistence.BiobankContactPersistenceImpl.java

License:Open Source License

/**
 * Returns an ordered range of all the biobank contacts.
 *
 * <p>//from w w  w . ja v  a  2s. 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 com.bcnet.portlet.biobank.model.impl.BiobankContactModelImpl}. 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 biobank contacts
 * @param end the upper bound of the range of biobank contacts (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of biobank contacts
 * @throws SystemException if a system exception occurred
 */
@Override
public List<BiobankContact> 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<BiobankContact> list = (List<BiobankContact>) 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_BIOBANKCONTACT);

            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator);

            sql = query.toString();
        } else {
            sql = _SQL_SELECT_BIOBANKCONTACT;

            if (pagination) {
                sql = sql.concat(BiobankContactModelImpl.ORDER_BY_JPQL);
            }
        }

        Session session = null;

        try {
            session = openSession();

            Query q = session.createQuery(sql);

            if (!pagination) {
                list = (List<BiobankContact>) QueryUtil.list(q, getDialect(), start, end, false);

                Collections.sort(list);

                list = new UnmodifiableList<BiobankContact>(list);
            } else {
                list = (List<BiobankContact>) 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:com.bcnet.portlet.biobank.service.persistence.BiobankGeneralInformationPersistenceImpl.java

License:Open Source License

/**
 * Returns an ordered range of all the biobank general informations.
 *
 * <p>/*from  w w w. j  a  va 2  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 com.bcnet.portlet.biobank.model.impl.BiobankGeneralInformationModelImpl}. 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 biobank general informations
 * @param end the upper bound of the range of biobank general informations (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of biobank general informations
 * @throws SystemException if a system exception occurred
 */
@Override
public List<BiobankGeneralInformation> 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<BiobankGeneralInformation> list = (List<BiobankGeneralInformation>) 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_BIOBANKGENERALINFORMATION);

            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator);

            sql = query.toString();
        } else {
            sql = _SQL_SELECT_BIOBANKGENERALINFORMATION;

            if (pagination) {
                sql = sql.concat(BiobankGeneralInformationModelImpl.ORDER_BY_JPQL);
            }
        }

        Session session = null;

        try {
            session = openSession();

            Query q = session.createQuery(sql);

            if (!pagination) {
                list = (List<BiobankGeneralInformation>) QueryUtil.list(q, getDialect(), start, end, false);

                Collections.sort(list);

                list = new UnmodifiableList<BiobankGeneralInformation>(list);
            } else {
                list = (List<BiobankGeneralInformation>) 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:com.bcnet.portlet.biobank.service.persistence.BiobankPersistenceImpl.java

License:Open Source License

/**
 * Returns an ordered range of all the biobanks.
 *
 * <p>//from  w  ww .  j  a v 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 com.bcnet.portlet.biobank.model.impl.BiobankModelImpl}. 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 biobanks
 * @param end the upper bound of the range of biobanks (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of biobanks
 * @throws SystemException if a system exception occurred
 */
@Override
public List<Biobank> 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<Biobank> list = (List<Biobank>) 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_BIOBANK);

            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator);

            sql = query.toString();
        } else {
            sql = _SQL_SELECT_BIOBANK;

            if (pagination) {
                sql = sql.concat(BiobankModelImpl.ORDER_BY_JPQL);
            }
        }

        Session session = null;

        try {
            session = openSession();

            Query q = session.createQuery(sql);

            if (!pagination) {
                list = (List<Biobank>) QueryUtil.list(q, getDialect(), start, end, false);

                Collections.sort(list);

                list = new UnmodifiableList<Biobank>(list);
            } else {
                list = (List<Biobank>) 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;
}