Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6513537
  • 博文数量: 915
  • 博客积分: 17977
  • 博客等级: 上将
  • 技术积分: 8846
  • 用 户 组: 普通用户
  • 注册时间: 2005-08-26 09:59
个人简介

一个好老好老的老程序员了。

文章分类

全部博文(915)

文章存档

2022年(9)

2021年(13)

2020年(10)

2019年(40)

2018年(88)

2017年(130)

2015年(5)

2014年(12)

2013年(41)

2012年(36)

2011年(272)

2010年(1)

2009年(53)

2008年(65)

2007年(47)

2006年(81)

2005年(12)

分类: Java

2011-09-27 22:00:00

Java代码 复制代码 收藏代码
  1. int viewSize = GlobalConstant.VIEW_SIZE;   
  2.  int dataSize = 0;   
  3. int viewIndex = 0;   
  4.         String temp = (String) map.get("viewIndex");   
  5.         if (UtilValidate.isNotEmpty(temp)) {   
  6.             try {   
  7.                 viewIndex = Integer.valueOf(temp);   
  8.             } catch (NumberFormatException e) {   
  9.                 viewIndex = 0;   
  10.                 Debug.logError(e.getMessage().toString(), module);   
  11.             }   
  12.         }   
  13.         int lowIndex = viewIndex * viewSize + 1;   
  14.         int highIndex = (viewIndex + 1) * viewSize;   
  15.   
  16. List condition = makeCondition(map);   
  17.         EntityListIterator eli = null;   
  18.         List product = null;   
  19.         try {   
  20.             eli = delegator.find("test", EntityCondition.makeCondition(condition), nullnull, UtilMisc   
  21.                             .toList(sortBy), null);   
  22.             product = eli.getPartialList(lowIndex, viewSize);   
  23.             eli.last();   
  24.             dataSize = eli.currentIndex();   
  25.         } catch (GenericEntityException e) {   
  26.             Debug.logInfo(e.getMessage().toString(), module);   
  27.         } finally {   
  28.             try {   
  29.                 if (eli != null) {   
  30.                     eli.close();   
  31.                     eli = null;   
  32.                 }   
  33.   
  34.             } catch (GenericEntityException e) {   
  35.                 Debug.logError(e.getMessage().toString(), module);   
  36.             }   
  37.         }   
  38.     if (highIndex > dataSize) {   
  39.             highIndex = dataSize;   
  40.         }  
int viewSize = GlobalConstant.VIEW_SIZE; int dataSize = 0; int viewIndex = 0; String temp = (String) map.get("viewIndex"); if (UtilValidate.isNotEmpty(temp)) { try { viewIndex = Integer.valueOf(temp); } catch (NumberFormatException e) { viewIndex = 0; Debug.logError(e.getMessage().toString(), module); } } int lowIndex = viewIndex * viewSize + 1; int highIndex = (viewIndex + 1) * viewSize; List condition = makeCondition(map); EntityListIterator eli = null; List product = null; try { eli = delegator.find("test", EntityCondition.makeCondition(condition), null, null, UtilMisc .toList(sortBy), null); product = eli.getPartialList(lowIndex, viewSize); eli.last(); dataSize = eli.currentIndex(); } catch (GenericEntityException e) { Debug.logInfo(e.getMessage().toString(), module); } finally { try { if (eli != null) { eli.close(); eli = null; } } catch (GenericEntityException e) { Debug.logError(e.getMessage().toString(), module); } } if (highIndex > dataSize) { highIndex = dataSize; }

 最主要的是:使用find方法,EntityListIterator现调用getPartialList方法

阅读(2289) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~