本文整理匯總了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;
}
示例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'");
}
}
示例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;
}