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


Java ActionVO.getItem方法代碼示例

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


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

示例1: insertAction

import org.easyrec.model.core.ActionVO; //導入方法依賴的package包/類
@Override
public int insertAction(ActionVO<Integer, Integer> action, boolean useDateFromVO) {
    if (logger.isTraceEnabled()) {
        logger.trace("inserting action=" + action);
    }

    // validate non-empty fields (NOT NULL)
    validateNonEmptyFields(action, useDateFromVO);

    Object[] args = {action.getTenant(), action.getUser(), action.getSessionId(), action.getIp(),
            ((action.getItem() != null) ? action.getItem().getItem() : null),
            ((action.getItem() != null) ? action.getItem().getType() : null), action.getActionType(),
            action.getRatingValue(), 
            action.getActionInfo(), ((useDateFromVO && action.getActionTime() != null) ? action.getActionTime() :
                                      new Date(System.currentTimeMillis()))};

    KeyHolder keyHolder = new GeneratedKeyHolder();

    int rowsAffected = getJdbcTemplate().update(PS_INSERT_ACTION.newPreparedStatementCreator(args), keyHolder);

    // retrieve auto increment id, and set to VO
    action.setId(keyHolder.getKey().longValue());

    return rowsAffected;
}
 
開發者ID:major2015,項目名稱:easyrec_major,代碼行數:26,代碼來源:ActionDAOMysqlImpl.java

示例2: validateNonEmptyFields

import org.easyrec.model.core.ActionVO; //導入方法依賴的package包/類
private void validateNonEmptyFields(ActionVO<Integer, Integer> action,
                                    boolean useDateFromVO) {
    if (action.getTenant() == null) {
        throw new IllegalArgumentException(
                "missing constraints, unique key (tenantId, itemTypeId, actionTypeId, actionTime) must be set, missing 'tenantId'");
    }
    if (action.getItem() == null) {
        throw new IllegalArgumentException(
                "missing constraints, unique key (tenantId, itemTypeId, actionTypeId, actionTime) must be set, missing 'item'");
    }
    if (action.getItem().getType() == null) {
        throw new IllegalArgumentException(
                "missing constraints, unique key (tenantId, itemTypeId, actionTypeId, actionTime) must be set, missing 'itemTypeId'");
    }
    if (action.getActionType() == null) {
        throw new IllegalArgumentException(
                "missing constraints, unique key (tenantId, itemTypeId, actionTypeId, actionTime) must be set, missing 'actionTypeId'");
    }
    // in case of automatically generated 'actionTime' on database level leave out check for null
    if (useDateFromVO && action.getActionTime() == null) {
        throw new IllegalArgumentException(
                "missing constraints, unique key (tenantId, itemTypeId, actionTypeId, actionTime) must be set, missing 'actionTime'");
    }
}
 
開發者ID:major2015,項目名稱:easyrec_major,代碼行數:25,代碼來源:ActionDAOMysqlImpl.java

示例3: insertAction

import org.easyrec.model.core.ActionVO; //導入方法依賴的package包/類
@Override
public int insertAction(ActionVO<Integer, Integer> action, boolean useDateFromVO) {
    if (logger.isTraceEnabled()) {
        logger.trace("inserting action=" + action);
    }

    // validate non-empty fields (NOT NULL)
    validateNonEmptyFields(action, useDateFromVO);

    Object[] args = {action.getTenant(), action.getUser(), action.getSessionId(), action.getIp(),
            ((action.getItem() != null) ? action.getItem().getItem() : null),
            ((action.getItem() != null) ? action.getItem().getType() : null), action.getActionType(),
            action.getRatingValue(), action.getSearchSucceeded(), action.getNumberOfFoundItems(),
            action.getDescription(), ((useDateFromVO && action.getActionTime() != null) ? action.getActionTime() :
                                      new Date(System.currentTimeMillis()))};

    KeyHolder keyHolder = new GeneratedKeyHolder();

    int rowsAffected = getJdbcTemplate().update(PS_INSERT_ACTION.newPreparedStatementCreator(args), keyHolder);

    // retrieve auto increment id, and set to VO
    action.setId(keyHolder.getKey().intValue());

    return rowsAffected;
}
 
開發者ID:customertimes,項目名稱:easyrec-PoC,代碼行數:26,代碼來源:ActionDAOMysqlImpl.java


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