當前位置: 首頁>>代碼示例>>Java>>正文


Java RowBounds.NO_ROW_LIMIT屬性代碼示例

本文整理匯總了Java中org.apache.ibatis.session.RowBounds.NO_ROW_LIMIT屬性的典型用法代碼示例。如果您正苦於以下問題:Java RowBounds.NO_ROW_LIMIT屬性的具體用法?Java RowBounds.NO_ROW_LIMIT怎麽用?Java RowBounds.NO_ROW_LIMIT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.apache.ibatis.session.RowBounds的用法示例。


在下文中一共展示了RowBounds.NO_ROW_LIMIT屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: selectPosts

@SuppressWarnings("unchecked")
public List<ActivityPostEntity> selectPosts(ActivityPostEntity activityPost, int maxItems) throws SQLException 
{
    int rowLimit = maxItems < 0 ? RowBounds.NO_ROW_LIMIT : maxItems;
    RowBounds rowBounds = new RowBounds(RowBounds.NO_ROW_OFFSET, rowLimit);
    
    if ((activityPost.getJobTaskNode() != -1) &&
        (activityPost.getMinId() != -1) &&
        (activityPost.getMaxId() != -1) &&
        (activityPost.getStatus() != null))
    {
        return template.selectList("alfresco.activities.select_activity_posts_by_params", activityPost, rowBounds);
    }
    else if (activityPost.getStatus() != null)
    {
        return template.selectList("alfresco.activities.select_activity_posts_by_status", activityPost, rowBounds);
    }
    else
    {
        return new ArrayList<ActivityPostEntity>(0);
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:22,代碼來源:ActivityPostDAOImpl.java

示例2: getADMNodeEntityIdsByAcl

@SuppressWarnings("unchecked")
@Override
protected List<Long> getADMNodeEntityIdsByAcl(long aclEntityId, int maxResults)
{
    if (maxResults < 0)
    {
        maxResults = RowBounds.NO_ROW_LIMIT;
    }
    
    Map<String, Object> params = new HashMap<String, Object>(1);
    params.put("id", aclEntityId);
    
    return template.selectList(SELECT_ADM_NODES_BY_ACL, params, new RowBounds(0 , maxResults));
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:14,代碼來源:AclCrudDAOImpl.java

示例3: selectSiteFeedEntries

@SuppressWarnings("unchecked")
@Override
public List<ActivityFeedEntity> selectSiteFeedEntries(String siteId, int maxFeedSize) throws SQLException
{
    ActivityFeedQueryEntity params = new ActivityFeedQueryEntity();
    params.setSiteNetwork(siteId);
    
    int rowLimit = maxFeedSize < 0 ? RowBounds.NO_ROW_LIMIT : maxFeedSize;
    RowBounds rowBounds = new RowBounds(RowBounds.NO_ROW_OFFSET, rowLimit);
    
    // for given site
    return template.selectList("alfresco.activities.select.select_activity_feed_for_site", params, rowBounds);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:13,代碼來源:ActivityFeedDAOImpl.java

示例4: processIntercept

void processIntercept(final Object[] queryArgs) {
	MappedStatement ms = (MappedStatement) queryArgs[MAPPED_STATEMENT_INDEX];
	Object parameter = queryArgs[PARAMETER_INDEX];
	final RowBounds rowBounds = (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)) {
		BoundSql boundSql = ms.getBoundSql(parameter);
		String sql = boundSql.getSql().trim();
		if (dialect.supportsLimitOffset()) {
			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 = new BoundSql(ms.getConfiguration(), sql, boundSql.getParameterMappings(),
				boundSql.getParameterObject());
		for (ParameterMapping mapping : boundSql.getParameterMappings()) {
			String prop = mapping.getProperty();
			if (boundSql.hasAdditionalParameter(prop)) {
				newBoundSql.setAdditionalParameter(prop, boundSql.getAdditionalParameter(prop));
			}
		}
		MappedStatement newMs = copyFromMappedStatement(ms, new BoundSqlSqlSource(newBoundSql));
		queryArgs[MAPPED_STATEMENT_INDEX] = newMs;
	}
}
 
開發者ID:yi-jun,項目名稱:aaden-pay,代碼行數:29,代碼來源:PagePluging.java

示例5: intercept

@Override
public Object intercept(Invocation invocation) throws Throwable {
	final MappedStatement mappedStatement = (MappedStatement) invocation
			.getArgs()[0];
	// 攔截需要分頁的SQL
	if (mappedStatement.getId().matches(SQL_PATTERN)) {
		Object parameter = invocation.getArgs()[1];
		BoundSql boundSql = mappedStatement.getBoundSql(parameter);
		String originalSql = boundSql.getSql().trim();
		if (null == boundSql.getSql() || "".equals(boundSql.getSql()))
			return null;
		// 分頁參數--上下文傳參
		Page page = null;
		PageContext context = PageContext.getPageContext();
		// map傳參每次都將currentPage重置,先判讀map再判斷context
		if (null != parameter && null == context) {
			page = convertParameter(parameter, page);
		}
		// 分頁參數--context參數裏的Page傳參
		if (null == page) {
			page = context;
		}

		if (null != page) {
			int totalPage = page.getTotal();
			// 得到總記錄數
			if (totalPage == 0) {
				Connection connection = mappedStatement.getConfiguration()
						.getEnvironment().getDataSource().getConnection();
				totalPage = BaseParameter.getCount(originalSql, connection,
						mappedStatement, parameter, boundSql, DIALECT);
			}
			// 分頁計算
			page.init(totalPage, page.getSize(), page.getLimit());
			invocation.getArgs()[2] = new RowBounds(
					RowBounds.NO_ROW_OFFSET, RowBounds.NO_ROW_LIMIT);
			BoundSql newBoundSql = new BoundSql(
					mappedStatement.getConfiguration(),
					BaseParameter.generatePageSql(originalSql, page,
							DIALECT), boundSql.getParameterMappings(),
					boundSql.getParameterObject());
			MappedStatement newMs = copyFromMappedStatement(
					mappedStatement, new BoundSqlSqlSource(newBoundSql));
			invocation.getArgs()[0] = newMs;
		}
	}
	PageContext.clear();
	return invocation.proceed();
}
 
開發者ID:jiangzongyao,項目名稱:kettle_support_kettle8.0,代碼行數:49,代碼來源:PaginationInterceptor.java

示例6: selectUserFeedEntries

@SuppressWarnings("unchecked")
@Override
public List<ActivityFeedEntity> selectUserFeedEntries(String feedUserId, String siteId, boolean excludeThisUser, boolean excludeOtherUsers, long minFeedId, int maxFeedSize) throws SQLException
{
    ActivityFeedQueryEntity params = new ActivityFeedQueryEntity();
    params.setFeedUserId(feedUserId);
    
    if (minFeedId > -1)
    {
        params.setMinId(minFeedId);
    }
    
    int rowLimit = maxFeedSize < 0 ? RowBounds.NO_ROW_LIMIT : maxFeedSize;
    RowBounds rowBounds = new RowBounds(RowBounds.NO_ROW_OFFSET, rowLimit);
    
    if (siteId != null)
    {
        // given site
        params.setSiteNetwork(siteId);
        
        if (excludeThisUser && excludeOtherUsers)
        {
            // effectively NOOP - return empty feed
            return new ArrayList<ActivityFeedEntity>(0);
        }
        if ((!excludeThisUser) && (!excludeOtherUsers))
        {
            // no excludes => everyone => where feed user is me
            return template.selectList("alfresco.activities.select.select_activity_feed_for_feeduser_and_site", params, rowBounds);
        }
        else if ((excludeThisUser) && (!excludeOtherUsers))
        {
            // exclude feed user => others => where feed user is me and post user is not me
            return template.selectList("alfresco.activities.select.select_activity_feed_for_feeduser_others_and_site", params, rowBounds);
        }
        else if ((excludeOtherUsers) && (!excludeThisUser))
        {
            // exclude others => me => where feed user is me and post user is me
            return template.selectList("alfresco.activities.select.select_activity_feed_for_feeduser_me_and_site", params, rowBounds);
        }
    }
    else
    {
        // all sites
        
        if (excludeThisUser && excludeOtherUsers)
        {
            // effectively NOOP - return empty feed
            return new ArrayList<ActivityFeedEntity>(0);
        }
        if (!excludeThisUser && !excludeOtherUsers)
        {
            // no excludes => everyone => where feed user is me
            return template.selectList("alfresco.activities.select.select_activity_feed_for_feeduser", params, rowBounds);
        }
        else if (excludeThisUser)
        {
            // exclude feed user => others => where feed user is me and post user is not me
            return template.selectList("alfresco.activities.select.select_activity_feed_for_feeduser_others", params, rowBounds);
        }
        else if (excludeOtherUsers)
        {
            // exclude others => me => where feed user is me and post user is me
            return template.selectList("alfresco.activities.select.select_activity_feed_for_feeduser_me", params, rowBounds);
        }
    }
    
    // belts-and-braces
    throw new AlfrescoRuntimeException("Unexpected: invalid arguments");
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:70,代碼來源:ActivityFeedDAOImpl.java

示例7: intercept

public Object intercept(final Invocation invocation) throws Throwable {
       final Executor executor = (Executor) invocation.getTarget();
       final Object[] queryArgs = invocation.getArgs();
       final MappedStatement ms = (MappedStatement)queryArgs[MAPPED_STATEMENT_INDEX];
       final Object parameter = queryArgs[PARAMETER_INDEX];
       final RowBounds rowBounds = (RowBounds)queryArgs[ROWBOUNDS_INDEX];
       final PageBounds pageBounds = new PageBounds(rowBounds);

       if(pageBounds.getOffset() == RowBounds.NO_ROW_OFFSET
               && pageBounds.getLimit() == RowBounds.NO_ROW_LIMIT
               && pageBounds.getOrders().isEmpty()){
           return invocation.proceed();
       }

       final Dialect dialect;
       try {
           Class clazz = Class.forName(dialectClass);
           Constructor constructor = clazz.getConstructor(MappedStatement.class, Object.class, PageBounds.class);
           dialect = (Dialect)constructor.newInstance(new Object[]{ms, parameter, pageBounds});
       } catch (Exception e) {
           throw new ClassNotFoundException("Cannot create dialect instance: "+dialectClass,e);
       }

       final BoundSql boundSql = ms.getBoundSql(parameter);

       queryArgs[MAPPED_STATEMENT_INDEX] = copyFromNewSql(ms,boundSql,dialect.getPageSQL(), dialect.getParameterMappings(), dialect.getParameterObject());
       queryArgs[PARAMETER_INDEX] = dialect.getParameterObject();
       queryArgs[ROWBOUNDS_INDEX] = new RowBounds(RowBounds.NO_ROW_OFFSET,RowBounds.NO_ROW_LIMIT);

       Boolean async = pageBounds.getAsyncTotalCount() == null ? asyncTotalCount : pageBounds.getAsyncTotalCount();
       Future<List> listFuture = call(new Callable<List>() {
           public List call() throws Exception {
               return (List)invocation.proceed();
           }
       }, async);


       if(pageBounds.isContainsTotalCount()){
           Callable<Paginator> countTask = new Callable() {
               public Object call() throws Exception {
                   Integer count;
                   Cache cache = ms.getCache();
                   if(cache != null && ms.isUseCache() && ms.getConfiguration().isCacheEnabled()){
                       CacheKey cacheKey = executor.createCacheKey(ms,parameter,new PageBounds(),copyFromBoundSql(ms,boundSql,dialect.getCountSQL(), boundSql.getParameterMappings(), boundSql.getParameterObject()));
                       count = (Integer)cache.getObject(cacheKey);
                       if(count == null){
                           count = SQLHelp.getCount(ms,executor.getTransaction(),parameter,boundSql,dialect);
                           cache.putObject(cacheKey, count);
                       }
                   }else{
                       count = SQLHelp.getCount(ms,executor.getTransaction(),parameter,boundSql,dialect);
                   }
                   return new Paginator(pageBounds.getPage(), pageBounds.getLimit(), count);
               }
           };
           Future<Paginator> countFutrue = call(countTask, async);
           return new PageList(listFuture.get(),countFutrue.get());
       }

       return listFuture.get();
}
 
開發者ID:AsuraTeam,項目名稱:asura,代碼行數:61,代碼來源:OffsetLimitInterceptor.java

示例8: processIntercept

void processIntercept(final Object[] queryArgs) throws Exception
{
	/*
	// 以下代碼可根據數據源動態加載方言,用於多數據源的情況下
	Dialect dialect = this.dialect;
	String str = DynamicDataSource.getDbType();
	if(!str.equals("1"))
	{
		String dialectClass = this.properties.getProperty(str);
		try
		{
			System.out.println("dbType是" + str + ",加載動態方言:" + dialectClass);
			dialect = (Dialect) Class.forName(dialectClass).newInstance();
		}
		catch (Exception e)
		{
			throw new RuntimeException("無法初始化方言:" + dialectClass, e);
		}
	}
	*/
	final RowBounds rowBounds = (RowBounds) queryArgs[ROWBOUNDS_INDEX];
	int offset = rowBounds.getOffset();
	int limit = rowBounds.getLimit();
	if (dialect.supportsLimitOffset() && (offset != RowBounds.NO_ROW_OFFSET || limit != RowBounds.NO_ROW_LIMIT))
	{
		MappedStatement ms = (MappedStatement) queryArgs[MAPPED_STATEMENT_INDEX];
		Object parameter = queryArgs[PARAMETER_INDEX];
		BoundSql boundSql = ms.getBoundSql(parameter);
		String sql = boundSql.getSql().trim();
		
		sql = dialect.getLimitString(sql, offset, limit);
		offset = RowBounds.NO_ROW_OFFSET;
		
		limit = RowBounds.NO_ROW_LIMIT;
		queryArgs[ROWBOUNDS_INDEX] = new RowBounds(offset, limit);
		BoundSql newBoundSql = new BoundSql(ms.getConfiguration(), sql, boundSql.getParameterMappings(), boundSql.getParameterObject());
		String prop;
		for(ParameterMapping p : boundSql.getParameterMappings())
		{
			prop = p.getProperty();
			if(boundSql.hasAdditionalParameter(prop))
			{
				newBoundSql.setAdditionalParameter(prop, boundSql.getAdditionalParameter(prop));
			}
		}
		MappedStatement newMs = copyFromMappedStatement(ms, new BoundSqlSqlSource(newBoundSql));
		queryArgs[MAPPED_STATEMENT_INDEX] = newMs;
	}
}
 
開發者ID:skeychen,項目名稱:dswork,代碼行數:49,代碼來源:OffsetLimitInterceptor.java


注:本文中的org.apache.ibatis.session.RowBounds.NO_ROW_LIMIT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。