本文整理汇总了Java中org.easyrec.store.dao.core.ItemDAO.SortColumn方法的典型用法代码示例。如果您正苦于以下问题:Java ItemDAO.SortColumn方法的具体用法?Java ItemDAO.SortColumn怎么用?Java ItemDAO.SortColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.easyrec.store.dao.core.ItemDAO
的用法示例。
在下文中一共展示了ItemDAO.SortColumn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tableSortParameterToDatabaseColumnName
import org.easyrec.store.dao.core.ItemDAO; //导入方法依赖的package包/类
private ItemDAO.SortColumn tableSortParameterToDatabaseColumnName(int columnIndex) {
switch (columnIndex) {
case 0:
return ItemDAO.SortColumn.ITEM_ID;
case 1:
return ItemDAO.SortColumn.DESCRIPTION;
case 2:
return ItemDAO.SortColumn.ITEM_TYPE;
default:
return ItemDAO.SortColumn.NONE;
}
}
示例2: generateSearchResult
import org.easyrec.store.dao.core.ItemDAO; //导入方法依赖的package包/类
private ModelAndView generateSearchResult(HttpServletRequest request, ModelAndView mav) throws ParseException {
RemoteTenant tenant = initializeView(request, mav);
// set to empty values so in case an error is returned the displayTag:table does not throw an exception
mav.addObject("itemSearchResult", null);
mav.addObject("totalCount", 0);
mav.addObject("pageSize", PAGE_SIZE);
if (tenant == null) {
logger.warn("no tenantId supplied");
return mav;
}
String itemId = ServletUtils.getSafeParameter(request, "itemId", "");
String description = ServletUtils.getSafeParameter(request, "description", "");
String creationDateFrom = ServletUtils.getSafeParameter(request, "fromCreationDate", "");
String creationDateTo = ServletUtils.getSafeParameter(request, "toCreationDate", "");
String[] itemTypes = request.getParameterValues("itemTypes");
boolean hasRules = ServletUtils.getSafeParameter(request, "hasRules", null) != null;
String activatedString = ServletUtils.getSafeParameter(request, "isActivated", "null");
String rulesOfType = ServletUtils.getSafeParameter(request, "rulesOfType", "");
Boolean isActivated;
if (activatedString.equalsIgnoreCase("null"))
isActivated = null;
else isActivated = activatedString.equalsIgnoreCase("true");
mav.addObject("itemId", itemId);
mav.addObject("description", description);
mav.addObject("fromCreationDate", creationDateFrom);
mav.addObject("toCreationDate", creationDateTo);
mav.addObject("itemTypes", itemTypes);
mav.addObject("hasRules", hasRules);
mav.addObject("rulesOfType", rulesOfType);
mav.addObject("isActivated", isActivated);
ItemDAO.SortColumn sortColumn =
tableSortParameterToDatabaseColumnName(ServletUtils.getSafeParameter(request, "d-16544-s", 0));
Integer page = ServletUtils.getSafeParameter(request, "d-16544-p", 1);
boolean sortDescending = ServletUtils.getSafeParameter(request, "d-16544-o", "0").equalsIgnoreCase("1");
Date from = null;
Date to = null;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(this.dateFormat);
if (!Strings.isNullOrEmpty(creationDateFrom))
from = simpleDateFormat.parse(creationDateFrom);
if (!Strings.isNullOrEmpty(creationDateTo))
to = simpleDateFormat.parse(creationDateTo);
if (Strings.isNullOrEmpty(itemId))
itemId = null;
if (Strings.isNullOrEmpty(description))
description = null;
TimeConstraintVO creationDateConstraint = from != null || to != null ? new TimeConstraintVO(from, to) : null;
Iterable<String> itemTypesIterable = itemTypes != null ? Arrays.asList(itemTypes) : null;
List<Item> items =
itemDAO.searchItems(tenant.getId(), itemId, itemTypesIterable, description, null, null, isActivated,
creationDateConstraint, hasRules, rulesOfType, sortColumn, sortDescending,
PAGE_SIZE * (page - 1), PAGE_SIZE);
int totalCount =
itemDAO.searchItemsTotalCount(tenant.getId(), itemId, itemTypesIterable, description, null, null,
isActivated, creationDateConstraint, hasRules, rulesOfType);
mav.addObject("itemSearchResult", items);
mav.addObject("totalCount", totalCount);
return mav;
}