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


Java TimeConstraintVO类代码示例

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


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

示例1: adjustConstraint

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入依赖的package包/类
private void adjustConstraint(TimeConstraintVO constraint, TimeRange timeRange) {

        Calendar cal = Calendar.getInstance();
        Date end = cal.getTime();
        Date start = null;
        switch (timeRange) {
            case DAY:
                cal.setTimeInMillis(end.getTime() - 86400000);
                start = cal.getTime();
                break;
            case WEEK:
                cal.setTimeInMillis(end.getTime() - 604800000);
                start = cal.getTime();
                break;
            case MONTH:
                cal.add(Calendar.MONTH, -1);
                start = cal.getTime();
                break;
            case ALL:   //start = null;
                break;
        }
        constraint.setDateFrom(start);
        constraint.setDateTo(end);
    }
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:25,代码来源:ShopRecommenderServiceImpl.java

示例2: mostViewedItems

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入依赖的package包/类
@Override
public List<RankedItemVO<Integer, String>> mostViewedItems(Integer tenant, String itemType,
                                                           Integer cluster, Integer numberOfResults,
                                                           TimeConstraintVO timeRange,
                                                           Boolean sortDescending) {
    if (cluster == null) {
        return typedActionDAO
            .getRankedItemsByActionType(tenant, TypeMappingService.ACTION_TYPE_VIEW, itemType, numberOfResults,
                    timeRange, sortDescending);
    } else {
        return typedActionDAO
                .getRankedItemsByActionTypeAndCluster(tenant, TypeMappingService.ACTION_TYPE_VIEW, cluster,
                        itemType, numberOfResults,
                        timeRange, sortDescending);
    }
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:17,代码来源:DomainActionServiceImpl.java

示例3: mostSearchedItems

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入依赖的package包/类
@Override
public List<RankedItemVO<Integer, String>> mostSearchedItems(Integer tenant, String itemType,
                                                             Integer cluster, Integer numberOfResults,
                                                             TimeConstraintVO timeRange,
                                                             Boolean sortDescending) {

    if (cluster == null) {
        return typedActionDAO
            .getRankedItemsByActionType(tenant, TypeMappingService.ACTION_TYPE_SEARCH, itemType, numberOfResults,
                    timeRange, sortDescending);
    } else {
        return typedActionDAO
                .getRankedItemsByActionTypeAndCluster(tenant, TypeMappingService.ACTION_TYPE_SEARCH, cluster, itemType, numberOfResults,
                        timeRange, sortDescending);
    }
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:17,代码来源:DomainActionServiceImpl.java

示例4: checkTimeConstraints

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入依赖的package包/类
private TimeConstraintVO checkTimeConstraints(String startTime, String endTime) {
    Date startDate = null;
    Date endDate;

    SimpleDateFormat dateFormatter = new SimpleDateFormat(dateFormat);
    if (startTime != null) {
        startDate = MyUtils.dateFormatCheck(startTime, dateFormatter);

        if (startDate == null)
            return null;
    }

    if (endTime == null)
        endDate = new Date(System.currentTimeMillis());
    else {
        endDate = MyUtils.dateFormatCheck(endTime, dateFormatter);

        if (endDate == null)
            return null;
    }

    return new TimeConstraintVO(startDate, endDate);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:24,代码来源:EasyRec.java

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

示例6: getRecommendationIteratorConstraintsFrom

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入依赖的package包/类
@Test
public void getRecommendationIteratorConstraintsFrom() {
    Iterator<RecommendationVO<Integer, Integer>> recommendations = null;
    try {
        recommendations = recommendationDAO.getRecommendationIterator(5000,
                new TimeConstraintVO(new Date(new GregorianCalendar(2007, 3, 15, 12, 15).getTimeInMillis()), null));
    } catch (Exception e) {
        fail("caught exception: " + e);
    }
    assertTrue(recommendations != null);
    List<RecommendationVO<Integer, Integer>> recommendationsList = iteratorToList(
            recommendations);
    assertEquals(3, recommendationsList.size());
    assertEquals(1, recommendationsList.get(0).getRecommendedItems().size());
    assertEquals(3, recommendationsList.get(1).getRecommendedItems().size());
    assertEquals(2, recommendationsList.get(2).getRecommendedItems().size());

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

示例7: getRecommendationIteratorConstraintsTo

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入依赖的package包/类
@Test
public void getRecommendationIteratorConstraintsTo() {
    Iterator<RecommendationVO<Integer, Integer>> recommendations = null;
    try {
        recommendations = recommendationDAO.getRecommendationIterator(5000,
                new TimeConstraintVO(null, new Date(new GregorianCalendar(2007, 3, 15, 12, 14).getTimeInMillis())));
    } catch (Exception e) {
        fail("caught exception: " + e);
    }
    assertTrue(recommendations != null);
    List<RecommendationVO<Integer, Integer>> recommendationsList = iteratorToList(
            recommendations);
    assertEquals(2, recommendationsList.size());
    assertEquals(2, recommendationsList.get(0).getRecommendedItems().size());
    assertEquals(2, recommendationsList.get(1).getRecommendedItems().size());

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

示例8: getRecommendationIteratorConstraintsBoth

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入依赖的package包/类
@Test
public void getRecommendationIteratorConstraintsBoth() {
    Iterator<RecommendationVO<Integer, Integer>> recommendations = null;
    try {
        recommendations = recommendationDAO.getRecommendationIterator(5000,
                new TimeConstraintVO(new Date(new GregorianCalendar(2007, 3, 15, 12, 12).getTimeInMillis()),
                        new Date(new GregorianCalendar(2007, 3, 15, 12, 17).getTimeInMillis())));
    } catch (Exception e) {
        fail("caught exception: " + e);
    }
    assertTrue(recommendations != null);
    List<RecommendationVO<Integer, Integer>> recommendationsList = iteratorToList(
            recommendations);
    assertEquals(3, recommendationsList.size());
    assertEquals(2, recommendationsList.get(0).getRecommendedItems().size());
    assertEquals(1, recommendationsList.get(1).getRecommendedItems().size());
    assertEquals(3, recommendationsList.get(2).getRecommendedItems().size());

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

示例9: testGetRecommendedItemIteratorConstraintBoth

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入依赖的package包/类
@Test
public void testGetRecommendedItemIteratorConstraintBoth() {
    Iterator<RecommendedItemVO<Integer, Integer>> recommendedItems = null;
    try {
        recommendedItems = recommendedItemDAO.getRecommendedItemIterator(5000,
                new TimeConstraintVO(new Date(new GregorianCalendar(2007, 3, 15, 12, 13).getTimeInMillis()),
                        new Date(new GregorianCalendar(2007, 3, 15, 12, 17).getTimeInMillis())));
    } catch (Exception e) {
        fail("caught exception: " + e);
    }
    assertTrue(recommendedItems != null);
    List<RecommendedItemVO<Integer, Integer>> recommendedItemList = iteratorToList(recommendedItems);
    assertEquals(4, recommendedItemList.size());

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

示例10: testGetActionIteratorConstraintsBoth

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入依赖的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

示例11: generateActions

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入依赖的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

示例12: mostViewedGenres

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入依赖的package包/类
public List<RankedItemVO<Integer, String>> mostViewedGenres(Integer tenant,
                                                                             Integer numberOfResults,
                                                                             TimeConstraintVO timeRange,
                                                                             Boolean sortDescending) {
    return mostViewedItems(tenant, TypeMappingService.ITEM_TYPE_GENRE_CLUSTER, null, numberOfResults, timeRange,
            sortDescending);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:8,代码来源:MusicActionServiceImpl.java

示例13: mostSearchedArtists

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入依赖的package包/类
public List<RankedItemVO<Integer, String>> mostSearchedArtists(Integer tenant,
                                                                                Integer numberOfResults,
                                                                                TimeConstraintVO timeRange,
                                                                                Boolean sortDescending) {
    return mostSearchedItems(tenant, TypeMappingService.ITEM_TYPE_ARTIST, null, numberOfResults, timeRange,
            sortDescending);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:8,代码来源:MusicActionServiceImpl.java

示例14: mostSearchedTracks

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入依赖的package包/类
public List<RankedItemVO<Integer, String>> mostSearchedTracks(Integer tenant,
                                                                               Integer numberOfResults,
                                                                               TimeConstraintVO timeRange,
                                                                               Boolean sortDescending) {
    return mostSearchedItems(tenant, TypeMappingService.ITEM_TYPE_TRACK, null, numberOfResults, timeRange,
            sortDescending);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:8,代码来源:MusicActionServiceImpl.java

示例15: mostPreviewedTracks

import org.easyrec.model.core.transfer.TimeConstraintVO; //导入依赖的package包/类
public List<RankedItemVO<Integer, String>> mostPreviewedTracks(Integer tenant,
                                                                                Integer numberOfResults,
                                                                                TimeConstraintVO timeRange,
                                                                                Boolean sortDescending) {
    return typedActionDAO.getRankedItemsByActionType(tenant, TypeMappingService.ACTION_TYPE_PREVIEW,
            TypeMappingService.ITEM_TYPE_TRACK, numberOfResults, timeRange, sortDescending);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:8,代码来源:MusicActionServiceImpl.java


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