本文整理汇总了Java中org.easyrec.service.domain.TypeMappingService.ACTION_TYPE_VIEW属性的典型用法代码示例。如果您正苦于以下问题:Java TypeMappingService.ACTION_TYPE_VIEW属性的具体用法?Java TypeMappingService.ACTION_TYPE_VIEW怎么用?Java TypeMappingService.ACTION_TYPE_VIEW使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.easyrec.service.domain.TypeMappingService
的用法示例。
在下文中一共展示了TypeMappingService.ACTION_TYPE_VIEW属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionHistoryForUser
@GET
@Path("/actionhistoryforuser")
public Response actionHistoryForUser(@PathParam("type") String type, @QueryParam("apikey") String apiKey,
@QueryParam("tenantid") String tenantId, @QueryParam("userid") String userId,
@QueryParam("numberOfResults") Integer numberOfResults,
@QueryParam("offset") @DefaultValue("0") Integer offset,
@QueryParam("requesteditemtype") String requestedItemType,
@QueryParam("callback") String callback,
@QueryParam("actiontype") @DefaultValue(TypeMappingService.ACTION_TYPE_VIEW) String actiontype,
@QueryParam("withProfile") @DefaultValue("false") boolean withProfile,
@QueryParam("token") String token)
throws EasyRecException {
Monitor mon = MonitorFactory.start(JAMON_REST_ACTIONHISTORY);
if (easyrecSettings.getSecuredAPIMethods().contains("actionhistoryforuser")) {
Operator o = operatorDAO.getOperatorFromToken(token);
if (o == null)
exceptionResponse(WS.ACTION_HISTORY, MSG.WRONG_TOKEN, type, callback);
else
apiKey = o.getApiKey();
}
Recommendation rec = null;
Session session = new Session(null, request);
Integer coreTenantId = operatorDAO.getTenantId(apiKey, tenantId);
if (coreTenantId == null)
exceptionResponse(WS.ACTION_HISTORY, MSG.TENANT_WRONG_TENANT_APIKEY, type, callback);
RemoteTenant remoteTenant = remoteTenantDAO.get(coreTenantId);
if (remoteTenant.isMaxActionLimitExceeded())
exceptionResponse(WS.ACTION_HISTORY, MSG.MAXIMUM_ACTIONS_EXCEEDED, type, callback);
if (Strings.isNullOrEmpty(userId))
exceptionResponse(WS.ACTION_HISTORY, MSG.USER_NO_ID, type, callback);
requestedItemType = checkItemType(requestedItemType, type, coreTenantId, tenantId, WS.ACTION_HISTORY, callback, null);
if (typeMappingService.getIdOfActionType(coreTenantId, actiontype) == null) {
exceptionResponse(WS.ACTION_HISTORY, MSG.OPERATION_FAILED.append(String.format(" actionType %s not found for tenant %s", actiontype, tenantId)), type, callback);
}
if ((numberOfResults == null) || (numberOfResults > WS.DEFAULT_NUMBER_OF_RESULTS))
numberOfResults = WS.DEFAULT_NUMBER_OF_RESULTS;
if (rec == null || rec.getRecommendedItems().isEmpty()) {
try {
rec = shopRecommenderService.actionHistory(coreTenantId, userId, session, actiontype,
requestedItemType, numberOfResults + 5, numberOfResults,
offset); // +5 to compensate for inactive items
if (withProfile) {
addProfileDataToItems(rec);
}
} catch (EasyRecRestException sre) {
exceptionResponse(WS.ACTION_HISTORY, sre.getMessageObject(), type, callback);
}
}
mon.stop();
if (type.endsWith(WS.RESPONSE_TYPE_PATH_JSON)) {
if (callback != null)
return Response.ok(new JSONPObject(callback, rec), WS.RESPONSE_TYPE_JSCRIPT).build();
else
return Response.ok(rec, WS.RESPONSE_TYPE_JSON).build();
} else
return Response.ok(rec, WS.RESPONSE_TYPE_XML).build();
}