本文整理汇总了Java中org.easyrec.model.core.transfer.IAConstraintVO类的典型用法代码示例。如果您正苦于以下问题:Java IAConstraintVO类的具体用法?Java IAConstraintVO怎么用?Java IAConstraintVO使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IAConstraintVO类属于org.easyrec.model.core.transfer包,在下文中一共展示了IAConstraintVO类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getItemsOfCluster
import org.easyrec.model.core.transfer.IAConstraintVO; //导入依赖的package包/类
public List<ItemVO<Integer, Integer>> getItemsOfCluster(ClusterVO cluster, Integer itemType) {
Preconditions.checkNotNull(cluster);
Preconditions.checkNotNull(cluster.getItem());
Preconditions.checkNotNull(cluster.getItem().getTenant());
Preconditions.checkNotNull(cluster.getName());
Integer tenantId = cluster.getItem().getTenant();
Integer assocTypeBelongsTo = assocTypeDAO.getIdOfType(tenantId, ClusterService.ASSOCTYPE_BELONGSTO);
IAConstraintVO<Integer, Integer> constraint = new IAConstraintVO<Integer, Integer>(
null, null, null, null, tenantId, true, null);
List<AssociatedItemVO<Integer, Integer>> itemAssocs =
itemAssocService.getItemsFrom(itemType, assocTypeBelongsTo, cluster.getItem(), constraint);
return Lists.transform(itemAssocs,
new Function<AssociatedItemVO<Integer, Integer>,
ItemVO<Integer, Integer>>() {
public ItemVO<Integer, Integer> apply(
AssociatedItemVO<Integer, Integer> input) {
return input.getItem();
}
});
}
示例2: getClustersForItem
import org.easyrec.model.core.transfer.IAConstraintVO; //导入依赖的package包/类
public List<ClusterVO> getClustersForItem(ItemVO<Integer, Integer> item) {
Integer assocTypeBelongsTo = assocTypeDAO.getIdOfType(item.getTenant(), ClusterService.ASSOCTYPE_BELONGSTO);
IAConstraintVO<Integer, Integer> constraint = new IAConstraintVO<Integer, Integer>(
null, null, null, null, item.getTenant(), true, null);
List<AssociatedItemVO<Integer, Integer>> itemAssocs =
itemAssocService.getItemsTo(item, assocTypeBelongsTo, itemTypeDAO.getIdOfType(item.getTenant(), ClusterService.ITEMTYPE_CLUSTER), constraint);
return Lists.transform(itemAssocs,
new Function<AssociatedItemVO<Integer, Integer>,ClusterVO>() {
public ClusterVO apply(
AssociatedItemVO<Integer, Integer> input) {
return loadCluster(input.getItem().getTenant(),input.getItem().getItem(),input.getItem().getType());
}
});
}
示例3: buildTree
import org.easyrec.model.core.transfer.IAConstraintVO; //导入依赖的package包/类
private void buildTree(
DelegateTree<ClusterVO, ItemAssocVO<Integer,Integer>> tree,
ClusterVO vertex) {
Integer assocTypeCluster =
assocTypeDAO.getIdOfType(vertex.getItem().getTenant(), ClusterService.ASSOCTYPE_CLUSTER);
List<ItemAssocVO<Integer,Integer>> edges = itemAssocService
.getItemAssocs(vertex.getItem(), assocTypeCluster, null,
new IAConstraintVO<Integer, Integer>(null, vertex.getItem().getTenant()));
for (ItemAssocVO<Integer,Integer> edge : edges) {
ItemVO<Integer, Integer> child = edge.getItemTo();
ClusterVO childVertex = loadCluster(child.getTenant(), child.getItem(), child.getType());
if (childVertex != null) {
tree.addChild(edge, vertex, childVertex);
buildTree(tree, childVertex);
}
}
}
示例4: validateConstraints
import org.easyrec.model.core.transfer.IAConstraintVO; //导入依赖的package包/类
private void validateConstraints(IAConstraintVO<Integer, Integer> constraints) {
if (constraints == null) {
throw new IllegalArgumentException("missing Constraint 'constraints'");
}
if ((constraints.getSortAsc() != null) && (constraints.getSortField() == null)) {
throw new IllegalArgumentException("wrong Constraint - if sortAsc is specified, a valid sortField needs to be specified as well");
}
if ((constraints.getSortAsc() != null) && (constraints.getSortField() != null)) {
if (!constraints.getSortField().equals(ItemAssocDAO.DEFAULT_ASSOC_VALUE_COLUMN_NAME) &&
!constraints.getSortField().equals(ItemAssocDAO.DEFAULT_CHANGE_DATE_COLUMN_NAME) &&
!constraints.getSortField().equals(ItemAssocDAO.DEFAULT_ACTIVE_COLUMN_NAME) &&
!constraints.getSortField().equals(ItemAssocDAO.DEFAULT_ASSOC_TYPE_COLUMN_NAME) &&
!constraints.getSortField().equals(ItemAssocDAO.DEFAULT_ID_COLUMN_NAME) &&
!constraints.getSortField().equals(ItemAssocDAO.DEFAULT_ITEM_FROM_COLUMN_NAME) &&
!constraints.getSortField().equals(ItemAssocDAO.DEFAULT_ITEM_FROM_TYPE_COLUMN_NAME) &&
!constraints.getSortField().equals(ItemAssocDAO.DEFAULT_ITEM_TO_COLUMN_NAME) &&
!constraints.getSortField().equals(ItemAssocDAO.DEFAULT_ITEM_TO_TYPE_COLUMN_NAME) &&
!constraints.getSortField().equals(ItemAssocDAO.DEFAULT_SOURCE_TYPE_COLUMN_NAME) &&
!constraints.getSortField().equals(ItemAssocDAO.DEFAULT_TENANT_COLUMN_NAME) &&
!constraints.getSortField().equals(ItemAssocDAO.DEFAULT_VIEW_TYPE_COLUMN_NAME)) {
throw new IllegalArgumentException("wrong Constraint - unknown sortField");
}
}
}
示例5: convertIAConstraintVO
import org.easyrec.model.core.transfer.IAConstraintVO; //导入依赖的package包/类
@Override
public IAConstraintVO<Integer, String> convertIAConstraintVO(Integer tenantId,
IAConstraintVO<Integer, Integer> constraint) {
if (constraint == null) {
return null;
}
return new IAConstraintVO<>(
constraint.getNumberOfResults(), viewTypeDAO.getTypeById(tenantId, constraint.getViewType()),
sourceTypeDAO.getTypeById(tenantId, constraint.getSourceType()), constraint.getSourceInfo(),
constraint.getTenant(), constraint.isActive(), constraint.getSortAsc());
}
示例6: convertTypedIAConstraintVO
import org.easyrec.model.core.transfer.IAConstraintVO; //导入依赖的package包/类
@Override
public IAConstraintVO<Integer, Integer> convertTypedIAConstraintVO(Integer tenantId,
IAConstraintVO<Integer, String> typedConstraint) {
if (typedConstraint == null) {
return null;
}
return new IAConstraintVO<>(
typedConstraint.getNumberOfResults(), viewTypeDAO.getIdOfType(tenantId, typedConstraint.getViewType()),
sourceTypeDAO.getIdOfType(tenantId, typedConstraint.getSourceType()), typedConstraint.getSourceInfo(),
typedConstraint.getTenant(), typedConstraint.isActive(), typedConstraint.getSortAsc());
}
示例7: convertListOfIAConstraintVOs
import org.easyrec.model.core.transfer.IAConstraintVO; //导入依赖的package包/类
@Override
public List<IAConstraintVO<Integer, String>> convertListOfIAConstraintVOs(Integer tenantId,
List<IAConstraintVO<Integer, Integer>> inList) {
if (inList == null) {
return null;
}
List<IAConstraintVO<Integer, String>> outList = new ArrayList<>();
for (IAConstraintVO<Integer, Integer> constraint : inList) {
outList.add(convertIAConstraintVO(tenantId, constraint));
}
return outList;
}
示例8: convertListOfTypedIAConstraintVOs
import org.easyrec.model.core.transfer.IAConstraintVO; //导入依赖的package包/类
@Override
public List<IAConstraintVO<Integer, Integer>> convertListOfTypedIAConstraintVOs(Integer tenantId,
List<IAConstraintVO<Integer, String>> inList) {
if (inList == null) {
return null;
}
List<IAConstraintVO<Integer, Integer>> outList = new ArrayList<>();
for (IAConstraintVO<Integer, String> typedConstraint : inList) {
outList.add(convertTypedIAConstraintVO(tenantId, typedConstraint));
}
return outList;
}
示例9: getItemAssocsForItem
import org.easyrec.model.core.transfer.IAConstraintVO; //导入依赖的package包/类
@Override
public List<ItemAssocVO<Integer, String>> getItemAssocsForItem(Integer tenant,
ItemVO<Integer, String> itemFrom,
Integer numberOfResults) {
return typedItemAssocDAO.getItemAssocsQBE(itemFrom, null, null,
new IAConstraintVO<Integer, String>(numberOfResults, null, null, null, tenant, null, false));
}
示例10: getItemsFromCluster
import org.easyrec.model.core.transfer.IAConstraintVO; //导入依赖的package包/类
@ShortCacheable
public List<AssociatedItemVO<Integer, Integer>> getItemsFromCluster(Integer tenantId,
ClusterVO cluster,
Integer numberOfResults,
Integer itemType) {
IAConstraintVO<Integer, Integer> constraint =
new IAConstraintVO<Integer, Integer>(numberOfResults, null, null, null, tenantId, true, false);
return itemAssocService.getItemsFrom(itemType,
assocTypeDAO.getIdOfType(tenantId, ClusterService.ASSOCTYPE_BELONGSTO), cluster.getItem(), constraint);
}
示例11: getAlsoActedItems
import org.easyrec.model.core.transfer.IAConstraintVO; //导入依赖的package包/类
@Override
public RecommendationVO<Integer, Integer> getAlsoActedItems(Integer tenantId,
Integer userId,
String sessionId,
Integer assocTypeId,
ItemVO<Integer, Integer> item,
Integer filteredActionTypeId,
Integer requestedItemTypeId) {
List<AssociatedItemVO<Integer, Integer>> associatedItems = itemAssocService
.getItemsTo(item, assocTypeId, requestedItemTypeId,
new IAConstraintVO<Integer, Integer>(maximumNumberOfRelatedItemsPerItem, null, null,
null, tenantId, true, false));
List<RecommendedItemVO<Integer, Integer>> recommendedItems = convertAssociatedItems(associatedItems,
item);
// filter duplicates and history
if (filterResults) {
recommendedItems = doFiltering(tenantId, userId, sessionId, filteredActionTypeId, requestedItemTypeId,
recommendedItems, DEFAULT_USE_AVERAGE_PREDICTION_VALUES_FOR_DUPLICATES);
}
RecommendationVO<Integer, Integer> recommendation = new RecommendationVO<Integer, Integer>(
tenantId, userId, item.getItem(), item.getType(), assocTypeId, null,
RECOMMENDATION_STRATEGY_ITEMS_ALSO_ACTED_ON, EXPLANATION_ITEMS_ALSO_ACTED_ON, recommendedItems);
// HINT: implement an aspect (instead of directly using this) (Mantis Issue: #650)
if (recommendationHistoryService != null) recommendationHistoryService.insertRecommendation(recommendation);
return recommendation;
}
示例12: getItemAssocsForItem
import org.easyrec.model.core.transfer.IAConstraintVO; //导入依赖的package包/类
@Override
public List<ItemAssocVO<Integer,Integer>> getItemAssocsForItem(Integer tenant,
ItemVO<Integer, Integer> itemFrom,
Integer numberOfResults) {
return itemAssocDAO.getItemAssocsQBE(itemFrom, null, null,
new IAConstraintVO<Integer, Integer>(numberOfResults, null, null, null, tenant, null, false));
}
示例13: getItemsFrom
import org.easyrec.model.core.transfer.IAConstraintVO; //导入依赖的package包/类
@Override
public List<AssociatedItemVO<Integer, Integer>> getItemsFrom(Integer itemFromTypeId,
Integer assocTypeId,
ItemVO<Integer, Integer> itemTo,
IAConstraintVO<Integer, Integer> constraints) {
return itemAssocDAO.getItemsFrom(itemFromTypeId, assocTypeId, itemTo, constraints);
}
示例14: getItemsFromCluster
import org.easyrec.model.core.transfer.IAConstraintVO; //导入依赖的package包/类
@ShortCacheable
public List<AssociatedItemVO<Integer, Integer>> getItemsFromCluster(Integer tenantId,
ClusterVO cluster,
Integer numberOfResults,
Integer itemType) {
IAConstraintVO<Integer, Integer> constraint = new IAConstraintVO<Integer, Integer>(
numberOfResults, null, null, null, tenantId, true, false, ItemAssocDAO.DEFAULT_CHANGE_DATE_COLUMN_NAME);
return itemAssocService.getItemsFrom(itemType,
assocTypeDAO.getIdOfType(tenantId, ClusterService.ASSOCTYPE_BELONGSTO), cluster.getItem(), constraint);
}
示例15: getAllItems
import org.easyrec.model.core.transfer.IAConstraintVO; //导入依赖的package包/类
@ShortCacheable
private List<AssociatedItemVO<Integer, Integer>> getAllItems(Integer tenantId, ClusterVO cluster,
Integer numberOfResults,
Integer itemType) {
IAConstraintVO<Integer, Integer> constraint = new IAConstraintVO<Integer, Integer>(
numberOfResults, null, null, null, tenantId, true, null);
//TODO: modify SQL statement: SELECT RANDOM .... LIMIT 100;
return itemAssocService.getItemsFrom(itemType,
assocTypeDAO.getIdOfType(tenantId, ClusterService.ASSOCTYPE_BELONGSTO), cluster.getItem(), constraint);
}