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


Java TenantVO类代码示例

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


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

示例1: getTenantById

import org.easyrec.model.core.TenantVO; //导入依赖的package包/类
@LongCacheable
public TenantVO getTenantById(Integer tenantId) {
    // validate input parameters
    if (tenantId == null) {
        throw new IllegalArgumentException("missing 'tenantId'");
    }

    if (logger.isDebugEnabled()) {
        logger.debug("loading 'tenant' with id '" + tenantId + "'");
    }

    StringBuilder sqlString = new StringBuilder("SELECT * FROM ");
    sqlString.append(DEFAULT_TABLE_NAME);
    sqlString.append(" WHERE ");
    sqlString.append(DEFAULT_ID_COLUMN_NAME);
    sqlString.append("=?");
    Object[] args = {tenantId};
    int[] argTypes = {Types.INTEGER};

    return getJdbcTemplate().queryForObject(sqlString.toString(), args, argTypes, tenantVORowMapper);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:22,代码来源:AbstractBaseTenantDAOMysqlImpl.java

示例2: getTenantByStringId

import org.easyrec.model.core.TenantVO; //导入依赖的package包/类
@LongCacheable
public TenantVO getTenantByStringId(String stringId) {
    // validate input parameters
    if (stringId == null) {
        throw new IllegalArgumentException("missing 'stringId'");
    }

    if (logger.isDebugEnabled()) {
        logger.debug("loading 'tenant' with stringId '" + stringId + "'");
    }

    StringBuilder sqlString = new StringBuilder("SELECT * FROM ");
    sqlString.append(DEFAULT_TABLE_NAME);
    sqlString.append(" WHERE ");
    sqlString.append(DEFAULT_STRING_ID_COLUMN_NAME);
    sqlString.append(" LIKE ?");
    Object[] args = {stringId};
    int[] argTypes = {Types.VARCHAR};

    return getJdbcTemplate().queryForObject(sqlString.toString(), args, argTypes, tenantVORowMapper);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:22,代码来源:AbstractBaseTenantDAOMysqlImpl.java

示例3: setTenantActive

import org.easyrec.model.core.TenantVO; //导入依赖的package包/类
public int setTenantActive(TenantVO tenant, boolean active) {

        if (logger.isDebugEnabled()) {
            logger.debug("setting tenant '" + tenant.getStringId() + "' to " + active);
        }

        StringBuilder query = new StringBuilder("UPDATE ");
        query.append(DEFAULT_TABLE_NAME);
        query.append(" SET ");
        query.append(DEFAULT_ACTIVE_COLUMN_NAME).append("=?");
        query.append(" WHERE ");
        query.append(DEFAULT_ID_COLUMN_NAME).append("=?");

        Object[] args = {active, tenant.getId()};
        int[] argTypes = {Types.BOOLEAN, Types.INTEGER};

        PreparedStatementCreatorFactory factory = new PreparedStatementCreatorFactory(query.toString(), argTypes);

        return getJdbcTemplate().update(factory.newPreparedStatementCreator(args));

    }
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:22,代码来源:AbstractBaseTenantDAOMysqlImpl.java

示例4: updateform

import org.easyrec.model.core.TenantVO; //导入依赖的package包/类
public ModelAndView updateform(HttpServletRequest request, HttpServletResponse httpServletResponse) {
    ModelAndView mav = security(request);

    String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");

    if (operatorId.length() == 0) {
        TenantVO tenantVO =
                tenantService.getTenantByStringId(ServletUtils.getSafeParameter(request, "tenantId", ""));
        RemoteTenant remoteTenant = remoteTenantDAO.get(tenantVO.getId());
        operatorId = remoteTenant.getOperatorId();


    }

    Operator operator = operatorDAO.get(operatorId);
    mav.addObject("operator", operator);

    mav.addObject("title", "easyrec :: update account");
    mav.addObject("page", "operator/update");
    mav.addObject("selectedMenu", "");
    return mav;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:23,代码来源:OperatorController.java

示例5: performForTenant

import org.easyrec.model.core.TenantVO; //导入依赖的package包/类
private void performForTenant(final TenantVO tenant) {
    if (tenant == null) throw new IllegalArgumentException("tenant is null");

    final Integer tenantId = tenant.getId();
    final Integer actionTypeId = typeMappingService.getIdOfActionType(tenantId, settings.getActionType());
    final Integer itemTypeId = typeMappingService.getIdOfItemType(tenantId, settings.getItemType());
    final Integer sourceTypeId = typeMappingService.getIdOfSourceType(tenantId, settings.getSourceType());
    final Integer minRatingValue = tenant.getRatingRangeMin();
    final Integer maxRatingValue = tenant.getRatingRangeMax();
    final Date changeDate = new Date();

    final List<User> users = userDao.getUsersForTenant(tenantId);
    final Map<Integer, Double> averageRatings = getAverageUserRatingMap(tenantId, itemTypeId);

    logger.info("Starting weight calculation.");
    Date start = new Date();

    // calculateWeights(tenantId, actionTypeId, itemTypeId, users, averageRatings);

    Date end = new Date();
    double time = (end.getTime() - start.getTime()) / 1000L;
    logger.info(String.format("Calculating weights for %s took %.2f seconds", tenant.getStringId(), time));

    logger.info("Starting predictions.");
    start = new Date();

    predict(tenantId, actionTypeId, itemTypeId, sourceTypeId, changeDate, users, averageRatings, minRatingValue,
            maxRatingValue);

    end = new Date();
    time = (end.getTime() - start.getTime()) / 1000L;
    logger.info(String.format("Calculating USER-ITEM predictions for %s took %.2f seconds", tenant.getStringId(),
            time));
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:35,代码来源:PearsonServiceImpl.java

示例6: personalizedRecommendations

import org.easyrec.model.core.TenantVO; //导入依赖的package包/类
@SuppressWarnings({"UnusedDeclaration"})
public void personalizedRecommendations(TenantVO tenant, SlopeOneIntegerConfiguration config, SlopeOneStats stats,
                                        Date execution, Set<TenantItem> changedItemIds, boolean weighted,
                                        final ExecutionControl control) {
    List<Integer> userIds = actionDAO.getUsers(config.getTenant(), config.getItemTypes(), execution);

    final int TOTAL_STEPS = userIds.size();
    int currentStep = 0;

    for (int userId : userIds) {
        if (control != null) control.updateProgress(
                String.format("Calculating personalized recommendations %d/%d", currentStep++, TOTAL_STEPS));

        List<RatingVO<Integer, Integer>> ratings = actionDAO.getRatings(
                config.getTenant(), config.getItemTypes(), userId);

        for (RatingVO<Integer, Integer> rating : ratings) {
            int itemId = rating.getItem().getItem();
            int itemTypeId = rating.getItem().getType();

            if (!changedItemIds.contains(new TenantItem(itemId, itemTypeId))) continue;

            List<Deviation> deviations = deviationDAO.getDeviationsOrdered(config.getTenant(), itemTypeId, itemId,
                    config.getMinRatedCount(), config.getMaxRecsPerItem());

            double recommendation = weighted ? weightedRecommendations(rating, deviations)
                                             : plainRecommendations(rating, deviations);

            if (logger.isDebugEnabled())
                logger.debug("created recommendation " + recommendation);
            // TODO write to database
        }
    }
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:35,代码来源:SlopeOneServiceImpl.java

示例7: getAllTenants

import org.easyrec.model.core.TenantVO; //导入依赖的package包/类
public List<TenantVO> getAllTenants() {

        if (logger.isDebugEnabled()) {
            logger.debug("loading list of all tenants'");
        }

        StringBuilder sqlString = new StringBuilder("SELECT * FROM ");
        sqlString.append(DEFAULT_TABLE_NAME);

        return getJdbcTemplate().query(sqlString.toString(), tenantVORowMapper);
    }
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:12,代码来源:AbstractBaseTenantDAOMysqlImpl.java

示例8: insertTenant

import org.easyrec.model.core.TenantVO; //导入依赖的package包/类
public int insertTenant(TenantVO tenant) {

        if (logger.isDebugEnabled()) {
            logger.debug("inserting tenant '" + tenant.getStringId() + "'");
        }


        StringBuilder query = new StringBuilder("INSERT INTO ");
        query.append(DEFAULT_TABLE_NAME);
        query.append(" SET ");
        query.append(DEFAULT_ID_COLUMN_NAME);
        query.append(" =?, ");
        query.append(DEFAULT_STRING_ID_COLUMN_NAME);
        query.append(" =?, ");
        query.append(DEFAULT_DESCRIPTION_COLUMN_NAME);
        query.append(" =?, ");
        query.append(DEFAULT_RATING_RANGE_MIN_COLUMN_NAME);
        query.append(" =?, ");
        query.append(DEFAULT_RATING_RANGE_MAX_COLUMN_NAME);
        query.append(" =?, ");
        query.append(DEFAULT_RATING_RANGE_NEUTRAL_COLUMN_NAME);
        query.append(" =?");

        tenant.setId(getNewTenantId());

        Object[] args = {tenant.getId(), tenant.getStringId(), tenant.getDescription(), tenant.getRatingRangeMin(),
                tenant.getRatingRangeMax(), tenant.getRatingRangeNeutral()};
        int[] argTypes = {Types.INTEGER, Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.DOUBLE};

        PreparedStatementCreatorFactory factory = new PreparedStatementCreatorFactory(query.toString(), argTypes);

        getJdbcTemplate().update(factory.newPreparedStatementCreator(args));

        return tenant.getId();
    }
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:36,代码来源:AbstractBaseTenantDAOMysqlImpl.java

示例9: mapRow

import org.easyrec.model.core.TenantVO; //导入依赖的package包/类
public TenantVO mapRow(ResultSet rs, int rowNum) throws SQLException {
    TenantVO tenant = new TenantVO(DaoUtils.getInteger(rs, DEFAULT_ID_COLUMN_NAME),
            DaoUtils.getStringIfPresent(rs, DEFAULT_STRING_ID_COLUMN_NAME),
            DaoUtils.getStringIfPresent(rs, DEFAULT_DESCRIPTION_COLUMN_NAME),
            DaoUtils.getInteger(rs, DEFAULT_RATING_RANGE_MIN_COLUMN_NAME),
            DaoUtils.getInteger(rs, DEFAULT_RATING_RANGE_MAX_COLUMN_NAME),
            DaoUtils.getDouble(rs, DEFAULT_RATING_RANGE_NEUTRAL_COLUMN_NAME),
            DaoUtils.getBoolean(rs, DEFAULT_ACTIVE_COLUMN_NAME));
    return tenant;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:11,代码来源:AbstractBaseTenantDAOMysqlImpl.java

示例10: testGetTenantById

import org.easyrec.model.core.TenantVO; //导入依赖的package包/类
@Test
public void testGetTenantById() {
    TenantVO resultTenant = tenantDAO.getTenantById(0);
    assertEquals(TENANT_TEST, resultTenant);

    resultTenant = tenantDAO.getTenantById(1);
    assertEquals(TENANT_MEX_TEST, resultTenant);

    resultTenant = tenantDAO.getTenantById(3);
    assertEquals(TENANT_RASCALLI, resultTenant);

    resultTenant = tenantDAO.getTenantById(Integer.MAX_VALUE);
    assertNull(resultTenant);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:15,代码来源:TenantDAOTest.java

示例11: testGetTenantByIdEmptyDB

import org.easyrec.model.core.TenantVO; //导入依赖的package包/类
@Test
public void testGetTenantByIdEmptyDB() {
    Unitils.getInstance().getModulesRepository().getModuleOfType(DatabaseModule.class).cleanSchemas();

    TenantVO resultAssoc = tenantDAO.getTenantById(0);
    assertNull(resultAssoc);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:8,代码来源:TenantDAOTest.java

示例12: testGetTenantByStringId

import org.easyrec.model.core.TenantVO; //导入依赖的package包/类
@Test
public void testGetTenantByStringId() {
    TenantVO resultTenant = tenantDAO.getTenantByStringId("TEST");
    assertEquals(TENANT_TEST, resultTenant);

    resultTenant = tenantDAO.getTenantByStringId("MEX-TEST");
    assertEquals(TENANT_MEX_TEST, resultTenant);

    resultTenant = tenantDAO.getTenantByStringId("RASCALLI");
    assertEquals(TENANT_RASCALLI, resultTenant);

    resultTenant = tenantDAO.getTenantByStringId("NOT VALID");
    assertNull(resultTenant);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:15,代码来源:TenantDAOTest.java

示例13: testGetTenantByStringIdEmptyDB

import org.easyrec.model.core.TenantVO; //导入依赖的package包/类
@Test
public void testGetTenantByStringIdEmptyDB() {
    Unitils.getInstance().getModulesRepository().getModuleOfType(DatabaseModule.class).cleanSchemas();

    TenantVO resultAssoc = tenantDAO.getTenantByStringId("TEST");
    assertNull(resultAssoc);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:8,代码来源:TenantDAOTest.java

示例14: doExecute

import org.easyrec.model.core.TenantVO; //导入依赖的package包/类
@Override
 protected void doExecute(final ExecutionControl control, GeneratorStatistics stats) throws Exception {
     TypeMappingService typeMappingService = (TypeMappingService) getTypeMappingService();
     ItemItemConfiguration configuration = getConfiguration();

     final Integer tenantId = configuration.getTenantId();
     final Integer actionTypeId = typeMappingService.getIdOfActionType(tenantId, configuration.getActionType());
     final Integer itemTypeId = typeMappingService.getIdOfItemType(tenantId, configuration.getItemType());
     final Integer assocTypeId = typeMappingService.getIdOfAssocType(tenantId, configuration.getAssociationType());
     final Integer viewTypeId = typeMappingService.getIdOfViewType(tenantId, configuration.getViewType());
     final String sourceType = ID + "/" + VERSION;
     final Integer sourceTypeId = typeMappingService.getIdOfSourceType(tenantId, sourceType);
     final Date changeDate = new Date();

     stats.setStartDate(changeDate);

     TenantVO tenant = getTenantService().getTenantById(tenantId);

     SimilarityCalculationStrategy similarityCalculationStrategy = similarityCalculationTypes
             .get(configuration.getSimilarityType());
     similarityCalculationStrategy.setItemAssocService(itemAssocService);
     similarityCalculationStrategy.setActionDAO(actionDAO);

     PredictionComputationStrategy predictionComputationStrategy = predictionComputationTypes
             .get(configuration.getPredictionType());
     predictionComputationStrategy.setActionDAO(actionDAO);
     predictionComputationStrategy.setUserAssocDAO(userAssocDAO);

     itemItemService.setSimilarityCalculationStrategy(similarityCalculationStrategy);
     itemItemService.setPredictionComputationStrategy(predictionComputationStrategy);
     itemItemService.setConfiguration(configuration);

     // generate actions

     if (control.isAbortRequested()) return;

     control.updateProgress(new Progress(1, 4, "Generating actions"));

     int generatedActions = actionDAO.generateActions(tenantId, null);
     stats.setNumberOfActionsConsidered(generatedActions);

     // similarity calculation

     if (control.isAbortRequested()) return;

     control.updateProgress(new Progress(2, 4, "Calculating similarity"));

     itemItemService.calculateSimilarity(tenantId, actionTypeId, itemTypeId, assocTypeId, viewTypeId, sourceTypeId,
             changeDate, stats, control);

     // prediction generation

     if (control.isAbortRequested()) return;

     control.updateProgress(new Progress(3, 4, "Calculating predictions"));

     /* removed for now because user->item associations are not yet enabled

itemItemService.predict(tenantId, actionTypeId, itemTypeId, assocTypeId, viewTypeId, sourceTypeId, changeDate,
    similarityCalculationStrategy.getSourceInfo(), tenant.getRatingRangeMin(), tenant.getRatingRangeMax(),
    control); */

     control.updateProgress(new Progress(4, 4, "Finished"));
     stats.setEndDateToNow();
 }
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:66,代码来源:ItemItemGenerator.java


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