当前位置: 首页>>代码示例>>Java>>正文


Java ItemDAO.SortColumn方法代码示例

本文整理汇总了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;
    }
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:13,代码来源:ItemSearchController.java

示例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;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:75,代码来源:ItemSearchController.java


注:本文中的org.easyrec.store.dao.core.ItemDAO.SortColumn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。