本文整理汇总了Java中org.easyrec.utils.spring.log.annotation.IOLog类的典型用法代码示例。如果您正苦于以下问题:Java IOLog类的具体用法?Java IOLog怎么用?Java IOLog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IOLog类属于org.easyrec.utils.spring.log.annotation包,在下文中一共展示了IOLog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: logIO
import org.easyrec.utils.spring.log.annotation.IOLog; //导入依赖的package包/类
/**
* Logs a method call and prints the arguments and the return value to the log level given in the
* iol parameter.
*
* @param pjp the JoinPoint containing information about the intercepted method call
* @param iol annotation for the IOLog aspect; contains info about the log level
* @return the result of the method call
* @throws Throwable
*/
public Object logIO(ProceedingJoinPoint pjp, IOLog iol) throws Throwable {
StringBuilder sb = new StringBuilder();
String methodName = pjp.getSignature().getName();
// parameter names only work with when compiled with AspectJ compiler
//String[] params = ((MethodSignature)pjp.getSignature()).getParameterNames();
Class<?>[] paramTypes = ((MethodSignature) pjp.getSignature()).getParameterTypes();
Class<?> returnType = ((MethodSignature) pjp.getSignature()).getReturnType();
Object[] args = pjp.getArgs();
Log logger = LogFactory.getLog(pjp.getTarget().getClass());
Object o = pjp.proceed();
if (!LoggerUtils.isLogLevelEnabled(logger, iol.value())) return o;
sb.append(methodName).append(argsToString(paramTypes, args)).append(':').append(returnType.getName())
.append('=').append(o);
LoggerUtils.log(logger, iol.value(), sb.toString());
return o;
}
示例2: itemsBasedOnPurchaseHistory
import org.easyrec.utils.spring.log.annotation.IOLog; //导入依赖的package包/类
@IOLog
@Profiled
@Override
public RecommendedItem[] itemsBasedOnPurchaseHistory(Integer tenantId, String userId, String sessionId,
String consideredItemType,
Integer numberOfLastActionsConsidered, String assocType,
String requestedItemType) throws EasyRecRestException {
RecommendationVO<Integer, String> recommendation = domainRecommenderService
.itemsBasedOnPurchaseHistory(tenantId, idMappingDAO.lookup(userId), sessionId, consideredItemType,
numberOfLastActionsConsidered, assocType, requestedItemType);
List<RecommendedItem> recommendedItems = idMappingService
.convertListOfRecommendedItemVOs(recommendation.getRecommendedItems());
if (recommendedItems != null && recommendedItems.size() > 0) {
return recommendedItems.toArray(new RecommendedItem[recommendedItems.size()]);
} else {
return new RecommendedItem[0];
}
}
示例3: itemsBasedOnSearchingHistory
import org.easyrec.utils.spring.log.annotation.IOLog; //导入依赖的package包/类
@IOLog
@Profiled
@Override
public RecommendedItem[] itemsBasedOnSearchingHistory(Integer tenantId, String userId, String sessionId,
String consideredItemType,
Integer numberOfLastActionsConsidered, String assocType,
String requestedItemType) throws EasyRecRestException {
RecommendationVO<Integer, String> recommendation = domainRecommenderService
.itemsBasedOnSearchingHistory(tenantId, idMappingDAO.lookup(userId), sessionId, consideredItemType,
numberOfLastActionsConsidered, assocType, requestedItemType);
List<RecommendedItem> recommendedItems = idMappingService
.convertListOfRecommendedItemVOs(recommendation.getRecommendedItems());
if (recommendedItems != null && recommendedItems.size() > 0) {
return recommendedItems.toArray(new RecommendedItem[recommendedItems.size()]);
} else {
return new RecommendedItem[0];
}
}
示例4: getRules
import org.easyrec.utils.spring.log.annotation.IOLog; //导入依赖的package包/类
@IOLog
@Profiled
@Override
public List<ItemAssocVO<String, String>> getRules(Item item) {
List<ItemAssocVO<String, String>> rules;
ItemVO<Integer, String> itemFrom = new ItemVO<>(item.getTenantId(),
idMappingDAO.lookup(item.getItemId()), item.getItemType());
List<ItemAssocVO<Integer, String>> itemAssocs = domainItemAssocService
.getItemAssocsForItem(item.getTenantId(), itemFrom, 200);
rules = idMappingService.mapItemAssocs(itemAssocs, true);
return rules;
}
示例5: getRules
import org.easyrec.utils.spring.log.annotation.IOLog; //导入依赖的package包/类
@IOLog
@Profiled
@Override
public List<ItemAssocVO<String, String>> getRules(Item item) {
List<ItemAssocVO<String, String>> rules;
ItemVO<Integer, String> itemFrom = new ItemVO<Integer, String>(item.getTenantId(),
idMappingDAO.lookup(item.getItemId()), item.getItemType());
List<ItemAssocVO<Integer, String>> itemAssocs = domainItemAssocService
.getItemAssocsForItem(item.getTenantId(), itemFrom, 200);
rules = idMappingService.mapItemAssocs(itemAssocs, true);
return rules;
}
示例6: getAssocTypes
import org.easyrec.utils.spring.log.annotation.IOLog; //导入依赖的package包/类
@IOLog
@Profiled
@Override
public String[] getAssocTypes(Integer tenantId) throws EasyRecRestException {
return typeMappingService.getAssocTypes(tenantId)
.toArray(new String[typeMappingService.getAssocTypes(tenantId).size()]);
}
示例7: itemsBasedOnViewingHistory
import org.easyrec.utils.spring.log.annotation.IOLog; //导入依赖的package包/类
@IOLog
@Profiled
@Override
public Recommendation itemsBasedOnViewingHistory(Integer tenantId, String userId, Session session,
String consideredItemType, Integer numberOfLastActionsConsidered,
String assocType, String requestedItemType,
Integer numberOfRecommendations) throws EasyRecRestException {
Recommendation rec;
RemoteTenant remoteTenant = remoteTenantDAO.get(tenantId);
Monitor monCore = MonitorFactory.start(JAMON_REST_RECS_FOR_USER);
RecommendationVO<Integer, String> recommendation =
domainRecommenderService.itemsBasedOnViewingHistory(
tenantId, idMappingDAO.lookup(userId), null, // no sessionId needed
consideredItemType, numberOfLastActionsConsidered, assocType, requestedItemType);
monCore.stop();
List<Item> items = idMappingService.mapRecommendedItems(recommendation, remoteTenant,
idMappingDAO.lookup(userId), session,
numberOfRecommendations); // session needed for building backtracking url (session.getRequest())
rec = new Recommendation(remoteTenant.getStringId(), WS.ACTION_RECOMMENDATIONS_FOR_USER, userId, null,
// no sessionId needed
null, // no base item needed
items);
return rec;
}
示例8: actionHistory
import org.easyrec.utils.spring.log.annotation.IOLog; //导入依赖的package包/类
@IOLog
@Profiled
@Override
public Recommendation actionHistory(Integer tenantId, String userId, Session session,
String consideredActionType, String consideredItemType,
Integer numberOfLastActionsConsidered,
Integer numberOfRecommendations) throws EasyRecRestException {
Recommendation rec;
RemoteTenant remoteTenant = remoteTenantDAO.get(tenantId);
Monitor monCore = MonitorFactory.start(JAMON_REST_ACTION_HISTORY_CORE);
List<ItemVO<Integer, String>> recommendation =
domainRecommenderService.getActionHistory(tenantId,
idMappingDAO.lookup(userId),
null,
consideredActionType,
consideredItemType,
null,
numberOfLastActionsConsidered);
monCore.stop();
List<Item> items = idMappingService.mapListOfItemVOs(recommendation,
remoteTenant,
idMappingDAO.lookup(userId),
session,
numberOfRecommendations);
rec = new Recommendation(remoteTenant.getStringId(), WS.ACTION_HISTORY, userId,
null, // no sessionId needed
null, // no base item needed
items);
return rec;
}
示例9: itemsBasedOnActionHistory
import org.easyrec.utils.spring.log.annotation.IOLog; //导入依赖的package包/类
@IOLog
@Profiled
@Override
public Recommendation itemsBasedOnActionHistory(Integer tenantId, String userId, Session session,
String consideredActionType, String consideredItemType,
Integer numberOfLastActionsConsidered,
String assocType, String requestedItemType,
Integer numberOfRecommendations) throws EasyRecRestException {
Recommendation rec;
RemoteTenant remoteTenant = remoteTenantDAO.get(tenantId);
Double ratingThreshold = null;
if (consideredActionType.equals(TypeMappingService.ACTION_TYPE_RATE)) {
ratingThreshold = tenantService.getTenantById(tenantId).getRatingRangeNeutral();
}
Monitor monCore = MonitorFactory.start(JAMON_REST_RECS_FOR_USER);
RecommendationVO<Integer, String> recommendation =
domainRecommenderService.getItemsBasedOnActionHistory(
tenantId, idMappingDAO.lookup(userId), null, // no sessionId needed
consideredActionType, consideredItemType, ratingThreshold, numberOfLastActionsConsidered, assocType, requestedItemType);
monCore.stop();
List<Item> items = idMappingService.mapRecommendedItems(recommendation, remoteTenant,
idMappingDAO.lookup(userId), session,
numberOfRecommendations); // session needed for building backtracking url (session.getRequest())
rec = new Recommendation(remoteTenant.getStringId(), WS.ACTION_RECOMMENDATIONS_FOR_USER, userId, null,
// no sessionId needed
null, // no base item needed
items);
return rec;
}
示例10: itemsForUser
import org.easyrec.utils.spring.log.annotation.IOLog; //导入依赖的package包/类
@IOLog
@Profiled
@Override
public Recommendation itemsForUser(Integer tenantId, String userId, Session session,
String consideredActionType, String consideredItemType, Integer numberOfLastActionsConsidered,
String assocType, String requestedItemType,
Integer numberOfRecommendations) throws EasyRecRestException {
Recommendation rec = null;
RemoteTenant remoteTenant = remoteTenantDAO.get(tenantId);
// double check: should have been checked before
if (remoteTenant.getPluginsEnabled()) {
//TODO: add sourceType to query!!! (dm: copy paste from relatedItems - refactor shared code ?)
RecommendationVO<Integer, String> recommendation =
domainRecommenderService
.getAlsoActedItems(tenantId, idMappingDAO.lookup(userId), session.getSessionId(),
AssocTypeDAO.ASSOCTYPE_USER_TO_ITEM,
new ItemVO<Integer, String>(tenantId, idMappingDAO.lookup(userId),
TypeMappingService.ITEM_TYPE_USER), null,
requestedItemType);
List<Item> items = idMappingService
.mapRecommendedItems(recommendation, remoteTenant, idMappingDAO.lookup(userId), session,
numberOfRecommendations);
rec = new Recommendation(remoteTenant.getStringId(), WS.ACTION_RECOMMENDATIONS_FOR_USER, userId, null, null, items);
}
return rec;
}
示例11: purchaseItem
import org.easyrec.utils.spring.log.annotation.IOLog; //导入依赖的package包/类
/**
* This procedure tells the ProfilerController that an Item is purchased.
* Note:
* A SessionId is always required. In case no userId is given the sessionId
* is used a the userId instead.
*/
@IOLog
@Profiled
@Override
public Item purchaseItem(RemoteTenant remoteTenant, String userId, String itemId, String itemType,
String itemDescription, String itemUrl, String itemImageUrl, Date actionTime,
Session session, String actionInfo) {
Item item = itemDAO.get(remoteTenant, itemId, itemType);
if (item == null) {
item = itemDAO.add(remoteTenant.getId(), itemId, itemType, itemDescription, itemUrl, itemImageUrl);
if (logger.isDebugEnabled()) {
logger.debug(new StringBuilder().
append("<[email protected]").
append(remoteTenant.getId()).
append("> ").
append(itemType).
append(" ").
append(itemDescription).
append(" (id:").
append(itemId).
append(")").toString());
}
}
if (item != null && item.isActive()) {
// if userid is empty use sessionid instead of the userid
userId = Strings.isNullOrEmpty(userId) ? session.getSessionId() : userId;
Monitor monCore = MonitorFactory.start(JAMON_REST_BUY_CORE);
if (actionTime == null) {
domainActionService
.purchaseItem(remoteTenant.getId(), idMappingDAO.lookup(userId), session.getSessionId(),
session.getIp(),
new ItemVO<>(remoteTenant.getId(), idMappingDAO.lookup(itemId),
itemType), actionInfo);
} else {
domainActionService
.purchaseItem(remoteTenant.getId(), idMappingDAO.lookup(userId), session.getSessionId(),
session.getIp(),
new ItemVO<>(remoteTenant.getId(), idMappingDAO.lookup(itemId),
itemType), actionInfo, actionTime);
}
monCore.stop();
if (logger.isDebugEnabled()) {
logger.debug(new StringBuilder().
append("<[email protected]").
append(remoteTenant.getId()).
append("> ").
append(userId).
append(" view ").
append(itemDescription).
append(" (id:").
append(itemId).
append(")").toString());
}
}
return item;
}
示例12: viewItem
import org.easyrec.utils.spring.log.annotation.IOLog; //导入依赖的package包/类
/**
* This procedure tells the ProfilerController that an Item is viewed.
* Note:
* A SessionId is always required. In case no userId is given the sessionId
* is used a the userId instead.
*/
@IOLog
@Profiled
@Override
public Item viewItem(RemoteTenant remoteTenant, String userId, String itemId, String itemType,
String itemDescription, String itemUrl, String itemImageUrl, Date actionTime,
Session session, String actionInfo) {
Item item = itemDAO.get(remoteTenant, itemId, itemType);
if (item == null) {
item = itemDAO.add(remoteTenant.getId(), itemId, itemType, itemDescription, itemUrl, itemImageUrl);
if (logger.isDebugEnabled()) {
logger.debug(new StringBuilder().
append("<[email protected]").
append(remoteTenant.getId()).
append("> ").
append(itemType).
append(" ").
append(itemDescription).
append(" (id:").
append(itemId).
append(")").toString());
}
}
if (item != null && item.isActive()) {
// if userid is empty use sessionid instead of the userid
userId = Strings.isNullOrEmpty(userId) ? session.getSessionId() : userId;
Monitor monCore = MonitorFactory.start(JAMON_REST_VIEW_CORE);
if (actionTime == null) {
domainActionService.viewItem(remoteTenant.getId(), idMappingDAO.lookup(userId), session.getSessionId(),
session.getIp(),
new ItemVO<>(remoteTenant.getId(), idMappingDAO.lookup(itemId),
itemType), actionInfo);
} else {
domainActionService.viewItem(remoteTenant.getId(), idMappingDAO.lookup(userId), session.getSessionId(),
session.getIp(),
new ItemVO<>(remoteTenant.getId(), idMappingDAO.lookup(itemId),
itemType), actionInfo, actionTime);
}
monCore.stop();
if (logger.isDebugEnabled()) {
logger.debug(new StringBuilder().
append("<[email protected]").
append(remoteTenant.getId()).
append("> ").
append(userId).
append(" view ").
append(itemDescription).
append(" (id:").
append(itemId).
append(")").toString());
}
}
return item;
}
示例13: rateItem
import org.easyrec.utils.spring.log.annotation.IOLog; //导入依赖的package包/类
/**
* This procedure tells the ProfilerController that an Item is rated
* with a given value.
* Note:
* A SessionId is always required. In case no userId is given the sessionId
* is used a the userId instead.
*/
@IOLog
@Profiled
@Override
public Item rateItem(RemoteTenant remoteTenant, String userId, String itemId, String itemType,
String itemDescription, String itemUrl, String itemImageUrl, Integer ratingValue,
Date actionTime, Session session, String actionInfo) {
Item item = itemDAO.get(remoteTenant, itemId, itemType);
if (item == null) {
item = itemDAO.add(remoteTenant.getId(), itemId, itemType, itemDescription, itemUrl, itemImageUrl);
if (logger.isDebugEnabled()) {
logger.debug(new StringBuilder().
append("<[email protected]").
append(remoteTenant.getId()).
append("> ").
append(itemType).
append(" ").
append(itemDescription).
append(" (id:").
append(itemId).
append(")").toString());
}
}
if (item != null && item.isActive()) {
// if userid is empty use sessionid instead of the userid
userId = Strings.isNullOrEmpty(userId) ? session.getSessionId() : userId;
Monitor monCore = MonitorFactory.start(JAMON_REST_RATE_CORE);
if (actionTime == null) {
domainActionService.rateItem(remoteTenant.getId(), idMappingDAO.lookup(userId), session.getSessionId(),
session.getIp(),
new ItemVO<>(remoteTenant.getId(), idMappingDAO.lookup(itemId),
itemType), ratingValue, actionInfo);
} else {
domainActionService.rateItem(remoteTenant.getId(), idMappingDAO.lookup(userId), session.getSessionId(),
session.getIp(),
new ItemVO<>(remoteTenant.getId(), idMappingDAO.lookup(itemId),
itemType), ratingValue, actionInfo, actionTime);
}
monCore.stop();
if (logger.isDebugEnabled()) {
logger.debug(new StringBuilder().
append("<[email protected]").
append(remoteTenant.getId()).
append("> ").
append(userId).
append(" view ").
append(itemDescription).
append(" (id:").
append(itemId).
append(")").toString());
}
}
return item;
}
示例14: sendAction
import org.easyrec.utils.spring.log.annotation.IOLog; //导入依赖的package包/类
/**
* This procedure tells the ProfilerController that an Item is rated
* with a given value.
* Note:
* A SessionId is always required. In case no userId is given the sessionId
* is used as the userId instead.
*/
@IOLog
@Profiled
@Override
public Item sendAction(RemoteTenant remoteTenant, String userId, String itemId, String itemType,
String itemDescription, String itemUrl, String itemImageUrl, String actionType, Integer actionValue,
Date actionTime, Session session, String actionInfo) {
Item item = itemDAO.get(remoteTenant, itemId, itemType);
if (item == null) {
item = itemDAO.add(remoteTenant.getId(), itemId, itemType, itemDescription, itemUrl, itemImageUrl);
if (logger.isDebugEnabled()) {
logger.debug(new StringBuilder().
append("<[email protected]").
append(remoteTenant.getId()).
append("> ").
append(itemType).
append(" ").
append(itemDescription).
append(" (id:").
append(itemId).
append(")").toString());
}
}
if (item != null && item.isActive()) {
// if userid is empty use sessionid instead of the userid
userId = Strings.isNullOrEmpty(userId) ? session.getSessionId() : userId;
Monitor monCore = MonitorFactory.start(JAMON_REST_SENDACTION_CORE);
if (actionTime == null) {
domainActionService.insertAction(remoteTenant.getId(), idMappingDAO.lookup(userId), session.getSessionId(),
session.getIp(),
new ItemVO<>(remoteTenant.getId(), idMappingDAO.lookup(itemId),
itemType), actionType, actionValue, actionInfo);
} else {
domainActionService.insertAction(remoteTenant.getId(), idMappingDAO.lookup(userId), session.getSessionId(),
session.getIp(),
new ItemVO<>(remoteTenant.getId(), idMappingDAO.lookup(itemId),
itemType), actionType, actionValue, actionInfo, actionTime);
}
monCore.stop();
if (logger.isDebugEnabled()) {
logger.debug(new StringBuilder().
append("<[email protected]").
append(remoteTenant.getId()).
append("> ").
append(userId).
append(" view ").
append(itemDescription).
append(" (id:").
append(itemId).
append(")").toString());
}
}
return item;
}
示例15: getItemTypes
import org.easyrec.utils.spring.log.annotation.IOLog; //导入依赖的package包/类
@IOLog
@Profiled
@Override
public Set<String> getItemTypes(Integer tenantId) throws EasyRecRestException {
return typeMappingService.getItemTypes(tenantId, true);
}