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


Java TimeConstraintVO.getDateFrom方法代码示例

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


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

示例1: getRecommendationIteratorQueryString

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入方法依赖的package包/类
protected String getRecommendationIteratorQueryString(TimeConstraintVO timeConstraints, ArgsAndTypesHolder holder) {
    StringBuilder query = new StringBuilder("SELECT * FROM ");
    query.append(DEFAULT_TABLE_NAME);

    if (timeConstraints.getDateFrom() != null) {
        query.append(" WHERE ");
        query.append(DEFAULT_RECOMMENDATION_TIME_COLUMN_NAME);
        query.append(" >= ?");
        holder.getArgs()[0] = timeConstraints.getDateFrom();
        if (timeConstraints.getDateTo() != null) {
            query.append(" AND ");
            query.append(DEFAULT_RECOMMENDATION_TIME_COLUMN_NAME);
            query.append(" <= ?");
            holder.setArgs(ObjectArrays.concat(holder.getArgs(), timeConstraints.getDateTo()));
            holder.setArgTypes(Ints.concat(holder.getArgTypes(), new int[] { Types.TIMESTAMP }));
        }
    } else {
        query.append(" WHERE ");
        query.append(DEFAULT_RECOMMENDATION_TIME_COLUMN_NAME);
        query.append(" <= ?");
        holder.getArgs()[0] = timeConstraints.getDateTo();
    }

    return query.toString();
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:26,代码来源:AbstractBaseRecommendationDAOMysqlImpl.java

示例2: getActionIteratorQueryString

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入方法依赖的package包/类
protected String getActionIteratorQueryString(TimeConstraintVO timeConstraints, ArgsAndTypesHolder holder) {
    StringBuilder query = new StringBuilder("SELECT * FROM ");
    query.append(DEFAULT_TABLE_NAME);

    if (timeConstraints.getDateFrom() != null) {
        query.append(" WHERE ");
        query.append(DEFAULT_ACTION_TIME_COLUMN_NAME);
        query.append(" >= ?");
        holder.getArgs()[0] = timeConstraints.getDateFrom();
        if (timeConstraints.getDateTo() != null) {
            query.append(" AND ");
            query.append(DEFAULT_ACTION_TIME_COLUMN_NAME);
            query.append(" <= ?");
            holder.setArgs( ObjectArrays.concat(holder.getArgs(), timeConstraints.getDateTo()));
            holder.setArgTypes(Ints.concat(holder.getArgTypes(), new int[] { Types.TIMESTAMP }));
        }
    } else {
        query.append(" WHERE ");
        query.append(DEFAULT_ACTION_TIME_COLUMN_NAME);
        query.append(" <= ?");
        holder.getArgs()[0] = timeConstraints.getDateTo();
    }

    if (logger.isDebugEnabled()) {
        logger.debug("sending query: " + query);
    }
    return query.toString();
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:29,代码来源:AbstractBaseActionDAOMysqlImpl.java

示例3: getRecommendedItemIterator

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入方法依赖的package包/类
@Override
public Iterator<RecommendedItemVO<Integer, String>> getRecommendedItemIterator(int bulkSize,
                                                                                        TimeConstraintVO timeConstraints) {
    if (timeConstraints == null || timeConstraints.getDateFrom() == null && timeConstraints.getDateTo() == null) {
        return getRecommendedItemIterator(bulkSize);
    }
    Object[] args = new Object[1];
    int[] argTypes = {Types.TIMESTAMP};

    DaoUtils.ArgsAndTypesHolder holder = new DaoUtils.ArgsAndTypesHolder(args, argTypes);
    String s = getRecommendedItemIteratorQueryString(timeConstraints, holder);

    return new ResultSetIteratorMysql<RecommendedItemVO<Integer, String>>(getDataSource(), bulkSize, s,
            holder.getArgs(), holder.getArgTypes(), recommendedItemVORowMapper);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:16,代码来源:TypedRecommendedItemDAOMysqlImpl.java

示例4: getActionIterator

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入方法依赖的package包/类
@Override
public Iterator<ActionVO<Integer, String>> getActionIterator(int bulkSize,
                                                                                       TimeConstraintVO timeConstraints) {
    if (timeConstraints == null || timeConstraints.getDateFrom() == null && timeConstraints.getDateTo() == null) {
        return getActionIterator(bulkSize);
    }
    Object[] args = new Object[1];
    int[] argTypes = {Types.TIMESTAMP};

    DaoUtils.ArgsAndTypesHolder holder = new DaoUtils.ArgsAndTypesHolder(args, argTypes);
    String s = getActionIteratorQueryString(timeConstraints, holder);

    return new ResultSetIteratorMysql<>(getDataSource(),
            bulkSize, s, holder.getArgs(), holder.getArgTypes(), actionVORowMapper);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:16,代码来源:TypedActionDAOMysqlImpl.java

示例5: getRecommendationIterator

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入方法依赖的package包/类
@Override
public Iterator<RecommendationVO<Integer, String>> getRecommendationIterator(
        int bulkSize, TimeConstraintVO timeConstraints) {
    if (timeConstraints == null || timeConstraints.getDateFrom() == null && timeConstraints.getDateTo() == null) {
        return getRecommendationIterator(bulkSize);
    }
    Object[] args = new Object[1];
    int[] argTypes = {Types.TIMESTAMP};

    DaoUtils.ArgsAndTypesHolder holder = new DaoUtils.ArgsAndTypesHolder(args, argTypes);
    String s = getRecommendationIteratorQueryString(timeConstraints, holder);

    return new ResultSetIteratorMysql<RecommendationVO<Integer, String>>(
            getDataSource(), bulkSize, s, holder.getArgs(), holder.getArgTypes(), recommendationVORowMapper);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:16,代码来源:TypedRecommendationDAOMysqlImpl.java

示例6: getActionIterator

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入方法依赖的package包/类
@Override
public Iterator<ActionVO<Integer, Integer>> getActionIterator(int bulkSize,
                                                                                         TimeConstraintVO timeConstraints) {
    if (timeConstraints == null || timeConstraints.getDateFrom() == null && timeConstraints.getDateTo() == null) {
        return getActionIterator(bulkSize);
    }
    Object[] args = new Object[1];
    int[] argTypes = {Types.TIMESTAMP};

    DaoUtils.ArgsAndTypesHolder holder = new DaoUtils.ArgsAndTypesHolder(args, argTypes);
    String s = getActionIteratorQueryString(timeConstraints, holder);

    return new ResultSetIteratorMysql<>(getDataSource(),
            bulkSize, s, holder.getArgs(), holder.getArgTypes(), actionVORowMapper);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:16,代码来源:ActionDAOMysqlImpl.java

示例7: getRecommendationIterator

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入方法依赖的package包/类
@Override
public Iterator<RecommendationVO<Integer, Integer>> getRecommendationIterator(
        int bulkSize, TimeConstraintVO timeConstraints) {
    if (timeConstraints == null || timeConstraints.getDateFrom() == null && timeConstraints.getDateTo() == null) {
        return getRecommendationIterator(bulkSize);
    }
    Object[] args = new Object[1];
    int[] argTypes = {Types.TIMESTAMP};

    DaoUtils.ArgsAndTypesHolder holder = new DaoUtils.ArgsAndTypesHolder(args, argTypes);
    String s = getRecommendationIteratorQueryString(timeConstraints, holder);

    return new ResultSetIteratorMysql<RecommendationVO<Integer, Integer>>(
            getDataSource(), bulkSize, s, holder.getArgs(), holder.getArgTypes(), recommendationVORowMapper);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:16,代码来源:RecommendationDAOMysqlImpl.java

示例8: getRecommendedItemIterator

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入方法依赖的package包/类
@Override
public Iterator<RecommendedItemVO<Integer, Integer>> getRecommendedItemIterator(int bulkSize,
                                                                                         TimeConstraintVO timeConstraints) {
    if (timeConstraints == null || timeConstraints.getDateFrom() == null && timeConstraints.getDateTo() == null) {
        return getRecommendedItemIterator(bulkSize);
    }
    Object[] args = new Object[1];
    int[] argTypes = {Types.TIMESTAMP};

    DaoUtils.ArgsAndTypesHolder holder = new DaoUtils.ArgsAndTypesHolder(args, argTypes);
    String s = getRecommendedItemIteratorQueryString(timeConstraints, holder);

    return new ResultSetIteratorMysql<RecommendedItemVO<Integer, Integer>>(getDataSource(), bulkSize, s,
            holder.getArgs(), holder.getArgTypes(), recommendedItemVORowMapper);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:16,代码来源:RecommendedItemDAOMysqlImpl.java

示例9: getRecommendedItems

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入方法依赖的package包/类
@Override
public List<RecommendedItemVO<Integer, Integer>> getRecommendedItems(TimeConstraintVO timeConstraints) {
    if (timeConstraints == null || timeConstraints.getDateFrom() == null && timeConstraints.getDateTo() == null) {
        throw new IllegalArgumentException(
                "missing 'timeConstraints', if you prefer to retrieve ALL recommended items (without specifying any time constraints) use method 'getRecommendedItemIterator()' instead");
    }
    Object[] args = new Object[1];
    int[] argTypes = {Types.TIMESTAMP};

    DaoUtils.ArgsAndTypesHolder holder = new DaoUtils.ArgsAndTypesHolder(args, argTypes);
    String s = getRecommendedItemIteratorQueryString(timeConstraints, holder);

    return getJdbcTemplate().query(s, holder.getArgs(), holder.getArgTypes(), recommendedItemVORowMapper);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:15,代码来源:RecommendedItemDAOMysqlImpl.java

示例10: getRecommendedItemIteratorQueryString

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入方法依赖的package包/类
protected String getRecommendedItemIteratorQueryString(TimeConstraintVO timeConstraints,
                                                       ArgsAndTypesHolder holder) {
    String recAlias = "rec";
    String recItemAlias = "recItem";

    // join with recommendation (to retrieve tenantId)
    StringBuilder sqlString = new StringBuilder("SELECT ");
    sqlString.append(recItemAlias);
    sqlString.append(".*, ");
    sqlString.append(recAlias);
    sqlString.append(".");
    sqlString.append(RecommendationDAO.DEFAULT_RECOMMENDATION_TIME_COLUMN_NAME);
    sqlString.append(", ");
    sqlString.append(recAlias);
    sqlString.append(".");
    sqlString.append(RecommendationDAO.DEFAULT_TENANT_COLUMN_NAME);
    sqlString.append(" FROM ");
    sqlString.append(DEFAULT_TABLE_NAME);
    sqlString.append(" AS ");
    sqlString.append(recItemAlias);
    sqlString.append(", ");
    sqlString.append(RecommendationDAO.DEFAULT_TABLE_NAME);
    sqlString.append(" AS ");
    sqlString.append(recAlias);
    sqlString.append(" WHERE ");
    sqlString.append(recItemAlias);
    sqlString.append(".");
    sqlString.append(DEFAULT_RECOMMENDATION_COLUMN_NAME);
    sqlString.append("=");
    sqlString.append(recAlias);
    sqlString.append(".");
    sqlString.append(RecommendationDAO.DEFAULT_ID_COLUMN_NAME);

    if (timeConstraints.getDateFrom() != null) {
        sqlString.append(" AND ");
        sqlString.append(BaseRecommendationDAO.DEFAULT_RECOMMENDATION_TIME_COLUMN_NAME);
        sqlString.append(" >= ?");
        holder.getArgs()[0] = timeConstraints.getDateFrom();
        if (timeConstraints.getDateTo() != null) {
            sqlString.append(" AND ");
            sqlString.append(BaseRecommendationDAO.DEFAULT_RECOMMENDATION_TIME_COLUMN_NAME);
            sqlString.append(" <= ?");
            holder.setArgs(ObjectArrays.concat(holder.getArgs(), timeConstraints.getDateTo()));
            holder.setArgTypes(Ints.concat(holder.getArgTypes(), new int[] { Types.TIMESTAMP }));
        }
    } else {
        sqlString.append(" AND ");
        sqlString.append(BaseRecommendationDAO.DEFAULT_RECOMMENDATION_TIME_COLUMN_NAME);
        sqlString.append(" <= ?");
        holder.getArgs()[0] = timeConstraints.getDateTo();
    }

    return sqlString.toString();
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:55,代码来源:AbstractBaseRecommendedItemDAOMysqlImpl.java

示例11: generateSearchQuery

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入方法依赖的package包/类
private void generateSearchQuery(String itemId, Iterable<String> itemTypes, String description,
                                 String url, String imageUrl, Boolean active,
                                 TimeConstraintVO creationDateConstraint, StringBuilder query, List<Object> args,
                                 List<Integer> argt, String fieldPrefix) {
    if (itemId != null) {
        query.append(" AND ").append(fieldPrefix).append("itemId LIKE ?");

        args.add(replaceWildcard(itemId));
        argt.add(Types.VARCHAR);
    }

    if (itemTypes != null && itemTypes.iterator().hasNext()) {
        query.append(" AND (");

        for (String itemType : itemTypes) {
            query.append(fieldPrefix).append("itemType = ? OR ");
            args.add(itemType);
            argt.add(Types.VARCHAR);
        }

        query.append("FALSE)");
    }

    if (description != null) {
        query.append(" AND ").append(fieldPrefix).append("description LIKE ?");

        args.add(replaceWildcard(description));
        argt.add(Types.VARCHAR);
    }

    if (url != null) {
        query.append(" AND ").append(fieldPrefix).append("url LIKE ?");

        args.add(replaceWildcard(url));
        argt.add(Types.VARCHAR);
    }

    if (imageUrl != null) {
        query.append(" AND ").append(fieldPrefix).append("imageUrl LIKE ?");

        args.add(replaceWildcard(imageUrl));
        argt.add(Types.VARCHAR);
    }

    if (active != null) {
        query.append(" AND ").append(fieldPrefix).append("active = ?");

        args.add(active);
        argt.add(Types.TINYINT);
    }

    if (creationDateConstraint != null) {
        if (creationDateConstraint.getDateFrom() != null && creationDateConstraint.getDateTo() != null) {
            query.append(" AND ").append(fieldPrefix).append("creationDate BETWEEN ? AND ?");

            args.add(creationDateConstraint.getDateFrom());
            argt.add(Types.TIMESTAMP);
            args.add(creationDateConstraint.getDateTo());
            argt.add(Types.TIMESTAMP);
        } else if (creationDateConstraint.getDateFrom() != null) {
            query.append(" AND ").append(fieldPrefix).append("creationDate >= ?");

            args.add(creationDateConstraint.getDateFrom());
            argt.add(Types.TIMESTAMP);
        } else if (creationDateConstraint.getDateTo() != null) {
            query.append(" AND ").append(fieldPrefix).append("creationDate <= ?");

            args.add(creationDateConstraint.getDateTo());
            argt.add(Types.TIMESTAMP);
        } else
            throw new IllegalArgumentException("creationDateConstraint must have either dateFrom or dateTo set.");
    }
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:74,代码来源:ItemDAOMysqlImpl.java


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