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


Java ActionVO.getTenant方法代码示例

本文整理汇总了Java中org.easyrec.model.core.ActionVO.getTenant方法的典型用法代码示例。如果您正苦于以下问题:Java ActionVO.getTenant方法的具体用法?Java ActionVO.getTenant怎么用?Java ActionVO.getTenant使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.easyrec.model.core.ActionVO的用法示例。


在下文中一共展示了ActionVO.getTenant方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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

示例4: generateActions

import org.easyrec.model.core.ActionVO; //导入方法依赖的package包/类
public int generateActions(int tenantId, TIntSet itemTypeIds, int actionTypeId, Date since) {
    Preconditions.checkNotNull(itemTypeIds);
    Preconditions.checkArgument(itemTypeIds.size() > 0, "at least one itemtype must be given");

    if (since == null) since = getNewestActionDate(tenantId, itemTypeIds);

    if (isOnSameDataSourceAsEasyrec()) {
        Object[] args = new Object[]{tenantId, actionTypeId, since};

        String query = QUERY_GENERATE.replace("@@@", generateItemTypeInClause(itemTypeIds));

        return getJdbcTemplate().update(query, args, ARGT_GENERATE);
    }

    // when not on same datasource the tenantId is ignored and all actions are copied

    Iterator<ActionVO<Integer, Integer>> actions = actionDAO
            .getActionIterator(5000, new TimeConstraintVO(since, null));
    int result = 0;

    while (actions.hasNext()) {
        ActionVO<Integer, Integer> actionVO = actions.next();

        if (actionVO.getTenant() != tenantId) continue;
        if (actionVO.getActionType() != actionTypeId) continue;
        if (!itemTypeIds.contains(actionVO.getItem().getType())) continue;

        result += insertAction(actionVO);
    }

    return result;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:33,代码来源:ActionDAOMysqlImpl.java

示例5: insertAction

import org.easyrec.model.core.ActionVO; //导入方法依赖的package包/类
public int insertAction(ActionVO<Integer, Integer> action) {
    String query = QUERY_INSERT + QUERY_INSERT_VALUE;
    query = query.substring(0, query.length() - 2);

    Object[] args = new Object[]{action.getTenant(), action.getUser(), action.getItem().getItem(),
            action.getItem().getType(), action.getRatingValue(), action.getActionTime()};

    return getJdbcTemplate().update(query, args, ARGT_INSERT);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:10,代码来源:ActionDAOMysqlImpl.java

示例6: insertAction

import org.easyrec.model.core.ActionVO; //导入方法依赖的package包/类
@Override
public int insertAction(ActionVO<Integer, String> typedAction, boolean useDateFromVO) {
    Integer tenantId = typedAction.getTenant();
    if (tenantId == null) {
        throw new IllegalArgumentException("tenant not specified, can not retrieve type mapping without tenant");
    }
    return actionDAO.insertAction(typeMappingService.convertTypedActionVO(tenantId, typedAction), useDateFromVO);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:9,代码来源:TypedActionDAOMysqlImpl.java


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