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


Java RemoteTenant.backtrackingEnabled方法代码示例

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


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

示例1: mapRatedItems

import org.easyrec.model.core.web.RemoteTenant; //导入方法依赖的package包/类
@Override
public List<Item> mapRatedItems(List<RatingVO<Integer, String>> ratedItems,
                                RemoteTenant remoteTenant, Session session, Integer numberOfRecommendations,
                                Integer offset) {
    List<Item> items = new ArrayList<>();
    Item item = null;
    offset = CollectionUtils.getSafeOffset(offset);
    int skippedItemsDueToOffset = 0; //keep track of no of items we skip due to the specified offset
    if (ratedItems != null) {
        for (RatingVO<Integer, String> ratedItem : ratedItems) {
            if (items.size() >= numberOfRecommendations) break;
            item = itemDAO.get(remoteTenant, idMappingDAO.lookup(ratedItem.getItem().getItem()),
                    ratedItem.getItem().getType());

            if (item != null && item.isActive()) {
                if (skippedItemsDueToOffset < offset) {
                  //skip the item and count it
                  skippedItemsDueToOffset ++;
                } else {
                    // set tracking url
                    // e.g. http://localhost:8084/easyrec-web/t?t=1&f=2&t=3&a=4&u=www.flimmit.com
                    String itemUrl = item.getUrl();

                    if (remoteTenant.backtrackingEnabled()) {
                        Integer itemToType = itemTypeDAO.getIdOfType(remoteTenant.getId(), ratedItem.getItem().getType());
                        itemUrl = Item
                                .getTrackingUrl(session, 0, remoteTenant, 0, 0, ratedItem.getItem().getItem(), itemToType,
                                        WS.recTypes.get(WS.RECTYPE_RANKING), item.getUrl());
                    }

                    // to make webapp thread-safe, a new item is created
                    items.add(new Item(item.getId(), item.getTenantId(), item.getItemId(), item.getItemType(),
                            item.getDescription(), itemUrl, item.getImageUrl(), ratedItem.getRatingValue(), true,
                            item.getCreationDate()));
                }
            }
        }
    }
    return items;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:41,代码来源:IDMappingServiceImpl.java

示例2: mapListOfItemVOs

import org.easyrec.model.core.web.RemoteTenant; //导入方法依赖的package包/类
@Override
public List<Item> mapListOfItemVOs(List<ItemVO<Integer, String>> inList,
        RemoteTenant remoteTenant, Integer userId, Session session, Integer numberOfRecommendations, Integer
                                         offset) {
 
    List<Item> items = new ArrayList<>();
    Item item = null;
    offset = CollectionUtils.getSafeOffset(offset);
    int skippedItemsDueToOffset = 0; //keep track of no of items we skip due to the specified offset
    if (inList != null) {
        for (ItemVO<Integer, String> itemVO : inList) {

            if (items.size() >= numberOfRecommendations) break;

            item = itemDAO.get(remoteTenant, idMappingDAO.lookup(itemVO.getItem()),
                    itemVO.getType());

            if (item != null) {
                if (item.isActive()) {
                    if (skippedItemsDueToOffset < offset) {
                      //skip the item and count it
                      skippedItemsDueToOffset ++;
                    } else {
                      // set tracking url
                      // e.g. http://localhost:8084/easyrec-web/t?t=1&f=2&ft=3&i=3&it=2&a=4&u=www.flimmit.com
                      String itemUrl = item.getUrl();

                      if (remoteTenant.backtrackingEnabled()) {
                        Integer itemToType = itemTypeDAO.getIdOfType(remoteTenant.getId(), itemVO.getType());
                        itemUrl = Item
                          .getTrackingUrl(session, userId, remoteTenant, 0, 0, itemVO.getItem(), itemToType,
                                          WS.recTypes.get(WS.RECTYPE_HISTORY), item.getUrl());
                      }

                      // to make webapp thread-safe, a new item is created
                      items.add(new Item(item.getId(), item.getTenantId(), item.getItemId(), item.getItemType(),
                                         item.getDescription(), itemUrl, item.getImageUrl(), null,
                                         true, item.getCreationDate()));
                    }
                }
            }
        }
    }
    return items;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:46,代码来源:IDMappingServiceImpl.java

示例3: mapRecommendedItems

import org.easyrec.model.core.web.RemoteTenant; //导入方法依赖的package包/类
/**
 * This function maps the Items from the coreRec into
 * local Items that contain more information such as description,
 * item url or item image url.
 * @param recommendation
 * @param remoteTenant
 * @param userId
 * @param session
 * @param numberOfRecommendations
 *
 */
@Override
public List<Item> mapRecommendedItems(
        RecommendationVO<Integer, String> recommendation,
        RemoteTenant remoteTenant, Integer userId, Session session, Integer numberOfRecommendations, Integer
          offset) {
    List<Item> items = new ArrayList<>();
    Item item = null;
    offset = CollectionUtils.getSafeOffset(offset);
    int skippedItemsDueToOffset = 0; //keep track of no of items we skip due to the specified offset
    if (recommendation != null && recommendation.getRecommendedItems() != null) {
        for (RecommendedItemVO<Integer, String> recommendedItem : recommendation.getRecommendedItems()) {

            if (items.size() >= numberOfRecommendations) break;

            item = itemDAO.get(remoteTenant, idMappingDAO.lookup(recommendedItem.getItem().getItem()),
                    recommendedItem.getItem().getType());


            if (item != null && item.isActive()) {
                if (skippedItemsDueToOffset < offset) {
                  //skip the item and count it
                  skippedItemsDueToOffset ++;
                } else {

                  // set tracking url
                  // e.g. http://localhost:8084/easyrec-web/t?t=1&f=2&t=3&a=4&u=www.flimmit.com
                  String itemUrl = item.getUrl();

                  Integer assocTypeId = assocTypeDAO
                    .getIdOfType(remoteTenant.getId(), recommendation.getQueriedAssocType());

                  // assocTypeId: recommendations for user
                  if (assocTypeId == null) {
                    assocTypeId = WS.recTypes.get(WS.RECTYPE_RECS_FOR_USER);
                  }

                  Integer itemFromId = recommendation.getQueriedItem();

                  // default item fromid = 0 in case of "recommendations for user"
                  if (itemFromId == null) {
                    itemFromId = 0;
                  }

                  if (remoteTenant.backtrackingEnabled()) {
                    Integer itemFromType = itemTypeDAO
                      .getIdOfType(remoteTenant.getId(), recommendation.getQueriedItemType());
                    Integer itemToType = itemTypeDAO
                      .getIdOfType(remoteTenant.getId(), recommendedItem.getItem().getType());
                    itemUrl = Item.getTrackingUrl(session, userId, remoteTenant, itemFromId, itemFromType,
                                                  recommendedItem.getItem().getItem(), itemToType, assocTypeId,
                                                  item.getUrl());
                  }

                  // to make webapp thread-safe, a new item is created
                  // because this item contains request specific information
                  //if (recommendedItem.getPredictionValue() > 0) {
                  items.add(new Item(item.getId(), item.getTenantId(), item.getItemId(), item.getItemType(),
                                     item.getDescription(), itemUrl, item.getImageUrl(),
                                     recommendedItem.getPredictionValue(), true, item.getCreationDate()));
                  //}
                }
            }
        }
    }
    return items;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:78,代码来源:IDMappingServiceImpl.java

示例4: mapRankedItems

import org.easyrec.model.core.web.RemoteTenant; //导入方法依赖的package包/类
/**
 * This function maps the Items from the coreRec into
 * local Items that contain more information such as description,
 * item url or item image url.
 * @param rankedItems
 * @param remoteTenant
 * @param session
 * @param numberOfRecommendations
 *
 */
@Override
public List<Item> mapRankedItems(List<RankedItemVO<Integer, String>> rankedItems,
                                 RemoteTenant remoteTenant, Session session, Integer numberOfRecommendations,
                                 Integer offset) {
    List<Item> items = new ArrayList<>();
    Item item = null;
    offset = CollectionUtils.getSafeOffset(offset);
    int skippedItemsDueToOffset = 0; //keep track of no of items we skip due to the specified offset
    if (rankedItems != null) {
        for (RankedItemVO<Integer, String> rankedItem : rankedItems) {

            if (items.size() >= numberOfRecommendations) break;

            item = itemDAO.get(remoteTenant, idMappingDAO.lookup(rankedItem.getItem().getItem()),
                    rankedItem.getItem().getType());

            if (item != null && item.isActive()) {
                if (skippedItemsDueToOffset < offset) {
                  //skip the item and count it
                  skippedItemsDueToOffset ++;
                } else {

                    // set tracking url
                    // e.g. http://localhost:8084/easyrec-web/t?t=1&f=2&t=3&a=4&u=www.flimmit.com
                    String itemUrl = item.getUrl();

                    if (remoteTenant.backtrackingEnabled()) {
                        Integer itemToType = itemTypeDAO.getIdOfType(remoteTenant.getId(), rankedItem.getItem().getType());
                        itemUrl = Item
                                .getTrackingUrl(session, 0, remoteTenant, 0, 0, rankedItem.getItem().getItem(), itemToType,
                                        WS.recTypes.get(WS.RECTYPE_RANKING), item.getUrl());
                    }

                    // to make webapp thread-safe, a new item is created
                    items.add(new Item(item.getId(), item.getTenantId(), item.getItemId(), item.getItemType(),
                            item.getDescription(), itemUrl, item.getImageUrl(), rankedItem.getCount().doubleValue(),
                            true, item.getCreationDate()));
                }
            }
        }
    }
    return items;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:54,代码来源:IDMappingServiceImpl.java

示例5: mapClusterItems

import org.easyrec.model.core.web.RemoteTenant; //导入方法依赖的package包/类
/**
 * This function maps the Items from the coreRec into
 * local Items that contain more information such as description,
 * item url or item image url.
 * @param clusterItems
 * @param remoteTenant
 * @param session
 * @param numberOfRecommendations
 *
 */
@Override
public List<Item> mapClusterItems(List<ItemVO<Integer, Integer>> clusterItems,
                                  RemoteTenant remoteTenant, Session session, Integer numberOfRecommendations,
                                  Integer offset) {
    List<Item> items = new ArrayList<>();
    Item item = null;
    offset = CollectionUtils.getSafeOffset(offset);
    int skippedItemsDueToOffset = 0; //keep track of no of items we skip due to the specified offset
    if (clusterItems != null) {
        for (ItemVO<Integer, Integer> clusterItem : clusterItems) {

            if (items.size() >= numberOfRecommendations) break;

            item = itemDAO.get(remoteTenant, idMappingDAO.lookup(clusterItem.getItem()),
                    itemTypeDAO.getTypeById(clusterItem.getTenant(), clusterItem.getType()));

            if (item != null && item.isActive()) {
                if (skippedItemsDueToOffset < offset) {
                  //skip the item and count it
                  skippedItemsDueToOffset ++;
                } else {
                    // set tracking url
                    // e.g. http://localhost:8084/easyrec-web/t?t=1&f=2&t=3&a=4&u=www.flimmit.com
                    String itemUrl = item.getUrl();

                    if (remoteTenant.backtrackingEnabled()) {
                        itemUrl = Item
                                .getTrackingUrl(session, 0, remoteTenant, 0,0, clusterItem.getItem(), clusterItem.getType(),
                                        WS.recTypes.get(WS.RECTYPE_CLUSTER), item.getUrl());
                    }

                    // to make webapp thread-safe, a new item is created
                    items.add(new Item(item.getId(), item.getTenantId(), item.getItemId(), item.getItemType(),
                            item.getDescription(), itemUrl, item.getImageUrl(), null,
                            true, item.getCreationDate()));
                }
            }
        }
    }
    return items;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:52,代码来源:IDMappingServiceImpl.java


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