Example usage for org.apache.ibatis.session RowBounds NO_ROW_LIMIT

List of usage examples for org.apache.ibatis.session RowBounds NO_ROW_LIMIT

Introduction

In this page you can find the example usage for org.apache.ibatis.session RowBounds NO_ROW_LIMIT.

Prototype

int NO_ROW_LIMIT

To view the source code for org.apache.ibatis.session RowBounds NO_ROW_LIMIT.

Click Source Link

Usage

From source file:org.openlmis.report.service.SummaryReportDataProvider.java

License:Open Source License

@Override
protected List<? extends ReportData> getResultSet(Map<String, String[]> filterCriteria) {
    RowBounds rowBounds = new RowBounds(RowBounds.NO_ROW_OFFSET, RowBounds.NO_ROW_LIMIT);
    return reportMapper.getReport(getParameter(filterCriteria), rowBounds);
}

From source file:org.openlmis.report.service.SupplyStatusReportDataProvider.java

License:Open Source License

@Override
protected List<? extends ReportData> getResultSet(Map<String, String[]> filterCriteria) {
    RowBounds rowBounds = new RowBounds(RowBounds.NO_ROW_OFFSET, RowBounds.NO_ROW_LIMIT);
    return reportMapper.getSupplyStatus(getParam(filterCriteria), rowBounds, this.getUserId());
}

From source file:org.openlmis.report.service.TimelinessReportDataProvider.java

License:Open Source License

@Override
protected List<? extends ReportData> getResultSet(Map<String, String[]> filterCriteria) {
    RowBounds rowBounds = new RowBounds(RowBounds.NO_ROW_OFFSET, RowBounds.NO_ROW_LIMIT);
    return reportMapper.getTimelinessData(filterCriteria, rowBounds, this.getUserId());
}

From source file:org.openlmis.report.service.UnscheduledReportingReportDataProvider.java

License:Open Source License

@Override
protected List<? extends ReportData> getResultSet(Map<String, String[]> filterCriteria) {
    RowBounds rowBounds = new RowBounds(RowBounds.NO_ROW_OFFSET, RowBounds.NO_ROW_LIMIT);
    return reportMapper.getFilteredSortedUnscheduledReportingReport(filterCriteria, rowBounds,
            this.getUserId());
}

From source file:org.openlmis.report.service.UserSummaryReportProvider.java

License:Open Source License

@Override
protected List<? extends ReportData> getResultSet(Map<String, String[]> filterCriteria) {
    RowBounds rowBounds = new RowBounds(RowBounds.NO_ROW_OFFSET, RowBounds.NO_ROW_LIMIT);

    return reportMapper.getReport(getReportFilterData(filterCriteria), null, rowBounds);
}

From source file:plum.mybatis.PaginationInterceptor.java

License:Apache License

/**
 * perform paging intercetion.//from w w w  .  ja  v a 2s . co  m
 *
 * @param queryArgs Executor.query params.
 */
private void processIntercept(final Object[] queryArgs) {
    //queryArgs = query(MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler)
    final MappedStatement ms = (MappedStatement) queryArgs[MAPPED_STATEMENT_INDEX];

    final Object parameter = queryArgs[PARAMETER_INDEX];
    //the need for paging intercept.
    boolean interceptor = ms.getId().matches(_sql_regex);
    //obtain paging information.
    final PageQuery pageQuery = interceptor ? PagingParametersFinder.getInstance().findCriteria(parameter)
            : new PageQuery(PageQuery.DEFAULT_PAGE_SIZE);
    if (interceptor) {
        PAGINATION_CRITERIA_THREAD_LOCAL.set(pageQuery);
    }
    final RowBounds rowBounds = (interceptor) ? offset_paging((RowBounds) queryArgs[ROWBOUNDS_INDEX])
            : (RowBounds) queryArgs[ROWBOUNDS_INDEX];
    int offset = rowBounds.getOffset();
    int limit = rowBounds.getLimit();

    if (_dialect.supportsLimit() && (offset != RowBounds.NO_ROW_OFFSET || limit != RowBounds.NO_ROW_LIMIT)) {
        final BoundSql boundSql = ms.getBoundSql(parameter);
        String sql = boundSql.getSql().trim();
        if (LOG.isDebugEnabled()) {
            LOG.debug("Pagination sql is <" + sql + ">");
        }
        //implementation of the access to the total number of SQL,to obtain  the total number and stored in the thread location

        Connection connection = null;
        try {
            //get connection
            connection = ms.getConfiguration().getEnvironment().getDataSource().getConnection();
            int count = SQLHelp.getCount(sql, connection, ms, parameter, boundSql, _dialect);
            final Pager pager = new Pager(pageQuery.getPage(), pageQuery.getPageSize(), count);
            PAGINATION_COUNT.set(pager);
        } catch (SQLException e) {
            LOG.error("The total number of access to the database failure.", e);
            PAGINATION_COUNT.set(null);
        } finally {
            try {
                if (connection != null && !connection.isClosed()) {
                    connection.close();
                }
            } catch (SQLException e) {
                LOG.error("Close the database connection error.", e);
            }
        }
        if (_dialect.supportsLimit()) {
            sql = _dialect.getLimitString(sql, offset, limit);
            offset = RowBounds.NO_ROW_OFFSET;
        } else {
            sql = _dialect.getLimitString(sql, 0, limit);
        }
        limit = RowBounds.NO_ROW_LIMIT;

        queryArgs[ROWBOUNDS_INDEX] = new RowBounds(offset, limit);

        BoundSql newBoundSql = copyFromBoundSql(ms, boundSql, sql);

        MappedStatement newMs = copyFromMappedStatement(ms, new BoundSqlSqlSource(newBoundSql));
        queryArgs[MAPPED_STATEMENT_INDEX] = newMs;
    }
}