當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。