本文整理汇总了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;
}