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


Java ActionVO类代码示例

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


ActionVO类属于org.easyrec.model.core包,在下文中一共展示了ActionVO类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: insertActions

import org.easyrec.model.core.ActionVO; //导入依赖的package包/类
public int insertActions(List<ActionVO<Integer, Integer>> actions) {
    final int BULK_SIZE = 100;
    final int BULK_COUNT = ((actions.size() + BULK_SIZE) - 1) / BULK_SIZE;

    int result = 0;

    for (int bulk = 0; bulk < BULK_COUNT; bulk++) {
        int fromIdx = bulk * BULK_SIZE;
        int toIdx = (bulk + 1) * BULK_SIZE;
        toIdx = Math.min(toIdx, actions.size());

        List<ActionVO<Integer, Integer>> thisBulk = actions.subList(fromIdx, toIdx);
        result = insertActionsBulk(BULK_SIZE, thisBulk, result);
    }

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

示例2: mapRow

import org.easyrec.model.core.ActionVO; //导入依赖的package包/类
@Override
public ActionVO<Integer, Integer> mapRow(ResultSet rs, int rowNum)
        throws SQLException {
    ActionVO<Integer, Integer> actionVO =
            new ActionVO<>(
                    DaoUtils.getLong(rs, DEFAULT_ID_COLUMN_NAME),
                    DaoUtils.getInteger(rs, DEFAULT_TENANT_COLUMN_NAME),
                    DaoUtils.getInteger(rs, DEFAULT_USER_COLUMN_NAME),
                    DaoUtils.getStringIfPresent(rs, DEFAULT_SESSION_COLUMN_NAME),
                    DaoUtils.getStringIfPresent(rs, DEFAULT_IP_COLUMN_NAME),
                    new ItemVO<>(DaoUtils.getInteger(rs, DEFAULT_TENANT_COLUMN_NAME),
                            DaoUtils.getInteger(rs, DEFAULT_ITEM_COLUMN_NAME),
                            DaoUtils.getInteger(rs, DEFAULT_ITEM_TYPE_COLUMN_NAME)),
                    DaoUtils.getInteger(rs, DEFAULT_ACTION_TYPE_COLUMN_NAME),
                    DaoUtils.getInteger(rs, DEFAULT_RATING_VALUE_COLUMN_NAME),
                    DaoUtils.getStringIfPresent(rs, DEFAULT_ACTIONINFO_COLUMN_NAME),
                    DaoUtils.getDate(rs, DEFAULT_ACTION_TIME_COLUMN_NAME));
    return actionVO;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:20,代码来源:AggregatorActionDAOMysqlImpl.java

示例3: mapRow

import org.easyrec.model.core.ActionVO; //导入依赖的package包/类
public ActionVO<Integer, String> mapRow(ResultSet rs, int rowNum)
        throws SQLException {
    Integer tenantId = DaoUtils.getInteger(rs, DEFAULT_TENANT_COLUMN_NAME);

    return new ActionVO<>(
            DaoUtils.getLong(rs, DEFAULT_ID_COLUMN_NAME), tenantId,
            DaoUtils.getInteger(rs, DEFAULT_USER_COLUMN_NAME),
            DaoUtils.getStringIfPresent(rs, DEFAULT_SESSION_COLUMN_NAME),
            DaoUtils.getStringIfPresent(rs, DEFAULT_IP_COLUMN_NAME),
            new ItemVO<>(DaoUtils.getInteger(rs, DEFAULT_TENANT_COLUMN_NAME),
                    DaoUtils.getInteger(rs, DEFAULT_ITEM_COLUMN_NAME), typeMappingService
                    .getItemTypeById(tenantId, DaoUtils.getInteger(rs, DEFAULT_ITEM_TYPE_COLUMN_NAME))),
            typeMappingService
                    .getActionTypeById(tenantId,
                            DaoUtils.getInteger(rs, DEFAULT_ACTION_TYPE_COLUMN_NAME)),
            DaoUtils.getInteger(rs, DEFAULT_RATING_VALUE_COLUMN_NAME),
            DaoUtils.getStringIfPresent(rs, DEFAULT_ACTIONINFO_COLUMN_NAME),
            DaoUtils.getDate(rs, DEFAULT_ACTION_TIME_COLUMN_NAME));
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:20,代码来源:TypedActionDAOMysqlImpl.java

示例4: 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

示例5: 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

示例6: mapRow

import org.easyrec.model.core.ActionVO; //导入依赖的package包/类
public ActionVO<Integer, Integer> mapRow(ResultSet rs, int rowNum)
        throws SQLException {
    ActionVO<Integer, Integer> actionVO =
            new ActionVO<>(
                    DaoUtils.getLong(rs, DEFAULT_ID_COLUMN_NAME),
                    DaoUtils.getInteger(rs, DEFAULT_TENANT_COLUMN_NAME),
                    DaoUtils.getInteger(rs, DEFAULT_USER_COLUMN_NAME),
                    DaoUtils.getStringIfPresent(rs, DEFAULT_SESSION_COLUMN_NAME),
                    DaoUtils.getStringIfPresent(rs, DEFAULT_IP_COLUMN_NAME),
                    new ItemVO<>(DaoUtils.getInteger(rs, DEFAULT_TENANT_COLUMN_NAME),
                            DaoUtils.getInteger(rs, DEFAULT_ITEM_COLUMN_NAME),
                            DaoUtils.getInteger(rs, DEFAULT_ITEM_TYPE_COLUMN_NAME)),
                    DaoUtils.getInteger(rs, DEFAULT_ACTION_TYPE_COLUMN_NAME),
                    DaoUtils.getInteger(rs, DEFAULT_RATING_VALUE_COLUMN_NAME),
                    DaoUtils.getStringIfPresent(rs, DEFAULT_ACTIONINFO_COLUMN_NAME),
                    DaoUtils.getDate(rs, DEFAULT_ACTION_TIME_COLUMN_NAME));
    return actionVO;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:19,代码来源:ActionDAOMysqlImpl.java

示例7: testInsertAction

import org.easyrec.model.core.ActionVO; //导入依赖的package包/类
@Test
@DataSet(DATA_FILENAME_ONE_LESS)
@ExpectedDataSet(DATA_FILENAME_NO_ACTIONTIME)
public void testInsertAction() {
    ActionVO<Integer, Integer> action = null;
    try {
        action = new ActionVO<>(2, 2, "abc5", "127.0.0.1",
                new ItemVO<>(2, 1, 1), 1, null, null);
    } catch (Exception e) {
        fail("caught exception: " + e);
    }
    assertTrue(action.getId() == null);
    actionDAO.insertAction(action, false);

    assertThat(action.getId(), is(not(1l)));
    assertThat(action.getId(), is(not(2l)));
    assertThat(action.getId(), is(not(3l)));
    assertThat(action.getId(), is(not(4l)));
    assertThat(action.getId(), is(not(5l)));
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:21,代码来源:ActionDAOTest.java

示例8: testGetActionIteratorConstraintsBoth

import org.easyrec.model.core.ActionVO; //导入依赖的package包/类
@Test
public void testGetActionIteratorConstraintsBoth() {
    Iterator<ActionVO<Integer, Integer>> actions = null;
    try {
        actions = actionDAO.getActionIterator(5000,
                new TimeConstraintVO(new Date(new GregorianCalendar(2007, 3, 15, 12, 12).getTimeInMillis()),
                        new Date(new GregorianCalendar(2007, 3, 15, 12, 15).getTimeInMillis())));
    } catch (Exception e) {
        fail("caught exception: " + e);
    }
    assertTrue(actions != null);
    List<ActionVO<Integer, Integer>> actionsList = iteratorToList(actions);
    assertEquals(4, actionsList.size());

    // HINT: hardcoded check if list equals expected list (Mantis Issue: #721)
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:17,代码来源:ActionDAOTest.java

示例9: mapRow

import org.easyrec.model.core.ActionVO; //导入依赖的package包/类
public ActionVO<Integer, String> mapRow(ResultSet rs, int rowNum)
        throws SQLException {
    Integer tenantId = DaoUtils.getInteger(rs, DEFAULT_TENANT_COLUMN_NAME);

    return new ActionVO<Integer, String>(
            DaoUtils.getInteger(rs, DEFAULT_ID_COLUMN_NAME), tenantId,
            DaoUtils.getInteger(rs, DEFAULT_USER_COLUMN_NAME),
            DaoUtils.getStringIfPresent(rs, DEFAULT_SESSION_COLUMN_NAME),
            DaoUtils.getStringIfPresent(rs, DEFAULT_IP_COLUMN_NAME),
            new ItemVO<Integer, String>(DaoUtils.getInteger(rs, DEFAULT_TENANT_COLUMN_NAME),
                    DaoUtils.getInteger(rs, DEFAULT_ITEM_COLUMN_NAME), typeMappingService
                    .getItemTypeById(tenantId, DaoUtils.getInteger(rs, DEFAULT_ITEM_TYPE_COLUMN_NAME))),
            typeMappingService
                    .getActionTypeById(tenantId,
                            DaoUtils.getInteger(rs, DEFAULT_ACTION_TYPE_COLUMN_NAME)),
            DaoUtils.getInteger(rs, DEFAULT_RATING_VALUE_COLUMN_NAME),
            DaoUtils.getBoolean(rs, DEFAULT_SEARCH_SUCCEEDED_COLUMN_NAME),
            DaoUtils.getInteger(rs, DEFAULT_NUMBER_OF_FOUND_ITEMS),
            DaoUtils.getStringIfPresent(rs, DEFAULT_DESCRIPTION_COLUMN_NAME),
            DaoUtils.getDate(rs, DEFAULT_ACTION_TIME_COLUMN_NAME));
}
 
开发者ID:customertimes,项目名称:easyrec-PoC,代码行数:22,代码来源:TypedActionDAOMysqlImpl.java

示例10: 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

示例11: mapRow

import org.easyrec.model.core.ActionVO; //导入依赖的package包/类
public ActionVO<Integer, Integer> mapRow(ResultSet rs, int rowNum)
        throws SQLException {
    ActionVO<Integer, Integer> actionVO =
            new ActionVO<Integer, Integer>(
                    DaoUtils.getInteger(rs, DEFAULT_ID_COLUMN_NAME),
                    DaoUtils.getInteger(rs, DEFAULT_TENANT_COLUMN_NAME),
                    DaoUtils.getInteger(rs, DEFAULT_USER_COLUMN_NAME),
                    DaoUtils.getStringIfPresent(rs, DEFAULT_SESSION_COLUMN_NAME),
                    DaoUtils.getStringIfPresent(rs, DEFAULT_IP_COLUMN_NAME),
                    new ItemVO<Integer, Integer>(DaoUtils.getInteger(rs, DEFAULT_TENANT_COLUMN_NAME),
                            DaoUtils.getInteger(rs, DEFAULT_ITEM_COLUMN_NAME),
                            DaoUtils.getInteger(rs, DEFAULT_ITEM_TYPE_COLUMN_NAME)),
                    DaoUtils.getInteger(rs, DEFAULT_ACTION_TYPE_COLUMN_NAME),
                    DaoUtils.getInteger(rs, DEFAULT_RATING_VALUE_COLUMN_NAME),
                    DaoUtils.getBoolean(rs, DEFAULT_SEARCH_SUCCEEDED_COLUMN_NAME),
                    DaoUtils.getInteger(rs, DEFAULT_NUMBER_OF_FOUND_ITEMS),
                    DaoUtils.getStringIfPresent(rs, DEFAULT_DESCRIPTION_COLUMN_NAME),
                    DaoUtils.getDate(rs, DEFAULT_ACTION_TIME_COLUMN_NAME));
    return actionVO;
}
 
开发者ID:customertimes,项目名称:easyrec-PoC,代码行数:21,代码来源:ActionDAOMysqlImpl.java

示例12: testInsertAction

import org.easyrec.model.core.ActionVO; //导入依赖的package包/类
@Test
@DataSet(DATA_FILENAME_ONE_LESS)
@ExpectedDataSet(DATA_FILENAME_NO_ACTIONTIME)
public void testInsertAction() {
    ActionVO<Integer, Integer> action = null;
    try {
        action = new ActionVO<Integer, Integer>(2, 2, "abc5", "127.0.0.1",
                new ItemVO<Integer, Integer>(2, 1, 1), 1, null, null, null, null);
    } catch (Exception e) {
        fail("caught exception: " + e);
    }
    assertTrue(action.getId() == null);
    actionDAO.insertAction(action, false);

    assertThat(action.getId(), is(not(1)));
    assertThat(action.getId(), is(not(2)));
    assertThat(action.getId(), is(not(3)));
    assertThat(action.getId(), is(not(4)));
    assertThat(action.getId(), is(not(5)));
}
 
开发者ID:customertimes,项目名称:easyrec-PoC,代码行数:21,代码来源:ActionDAOTest.java

示例13: 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

示例14: 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

示例15: insertActionsBulk

import org.easyrec.model.core.ActionVO; //导入依赖的package包/类
private int insertActionsBulk(final int bulkSize,
                              final List<ActionVO<Integer, Integer>> thisBulk,
                              int currentResult) {
    List<Object> args = new ArrayList<Object>(thisBulk.size() * ARGT_INSERT.length);

    StringBuilder query = new StringBuilder(QUERY_INSERT);
    TIntArrayList argt = new TIntArrayList(bulkSize * ARGT_INSERT.length);

    //noinspection ForLoopReplaceableByForEach
    for (int i = 0; i < thisBulk.size(); i++) {
        query.append(QUERY_INSERT_VALUE);
        argt.addAll(ARGT_INSERT);
    }

    query.replace(query.length() - 2, query.length(), "");

    for (ActionVO<Integer, Integer> action : thisBulk) {
        args.add(action.getTenant());
        args.add(action.getUser());
        args.add(action.getItem().getItem());
        args.add(action.getItem().getType());
        args.add(action.getRatingValue());
        args.add(action.getActionTime());
    }

    try {
        currentResult += getJdbcTemplate().update(query.toString(), args.toArray(), argt.toArray());
    } catch (Exception e) {
        logger.warn("An error occurred!", e);
    }
    return currentResult;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:33,代码来源:ActionDAOMysqlImpl.java


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