本文整理汇总了Java中org.easyrec.store.dao.core.types.AssocTypeDAO类的典型用法代码示例。如果您正苦于以下问题:Java AssocTypeDAO类的具体用法?Java AssocTypeDAO怎么用?Java AssocTypeDAO使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AssocTypeDAO类属于org.easyrec.store.dao.core.types包,在下文中一共展示了AssocTypeDAO类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ClusterServiceImpl
import org.easyrec.store.dao.core.types.AssocTypeDAO; //导入依赖的package包/类
public ClusterServiceImpl(ProfileDAO profileDAO,
ItemAssocService itemAssocService,
IDMappingDAO idMappingDAO,
TenantService tenantService,
ItemTypeDAO itemTypeDAO,
AssocTypeDAO assocTypeDAO,
SourceTypeDAO sourceTypeDAO,
ViewTypeDAO viewTypeDAO) {
this.profileDAO = profileDAO;
this.itemAssocService = itemAssocService;
this.tenantService = tenantService;
this.idMappingDAO = idMappingDAO;
this.itemTypeDAO = itemTypeDAO;
this.assocTypeDAO = assocTypeDAO;
this.sourceTypeDAO = sourceTypeDAO;
this.viewTypeDAO = viewTypeDAO;
this.clusters =
new HashMap<>();
try {
context = JAXBContext.newInstance(org.easyrec.model.core.ClusterVO.class);
} catch (Exception e) {
logger.error("Could not instantiate JAXB Context for ClusterService!", e);
}
}
示例2: ActionDAOMysqlImpl
import org.easyrec.store.dao.core.types.AssocTypeDAO; //导入依赖的package包/类
public ActionDAOMysqlImpl(DataSource dataSource, TenantDAO tenantDAO,
SqlScriptService sqlScriptService, AssocTypeDAO assocTypeDAO) {
super(sqlScriptService);
this.tenantDAO = tenantDAO;
this.assocTypeDAO = assocTypeDAO;
setDataSource(dataSource);
// output connection information
if (logger.isInfoEnabled()) {
try {
logger.info(DaoUtils.getDatabaseURLAndUserName(dataSource));
} catch (Exception e) {
logger.error(e);
}
}
}
示例3: ClusterServiceImpl
import org.easyrec.store.dao.core.types.AssocTypeDAO; //导入依赖的package包/类
public ClusterServiceImpl(ProfileDAO profileDAO,
ItemAssocService itemAssocService,
IDMappingDAO idMappingDAO,
TenantService tenantService,
ItemTypeDAO itemTypeDAO,
AssocTypeDAO assocTypeDAO,
SourceTypeDAO sourceTypeDAO,
ViewTypeDAO viewTypeDAO) {
this.profileDAO = profileDAO;
this.itemAssocService = itemAssocService;
this.tenantService = tenantService;
this.idMappingDAO = idMappingDAO;
this.itemTypeDAO = itemTypeDAO;
this.assocTypeDAO = assocTypeDAO;
this.sourceTypeDAO = sourceTypeDAO;
this.viewTypeDAO = viewTypeDAO;
this.clusters =
new HashMap<Integer, DelegateTree<ClusterVO, ItemAssocVO<Integer,Integer>>>();
try {
context = JAXBContext.newInstance(org.easyrec.model.core.ClusterVO.class);
} catch (Exception e) {
logger.error("Could not instantiate JAXB Context for ClusterService!", e);
}
}
示例4: ActionDAOMysqlImpl
import org.easyrec.store.dao.core.types.AssocTypeDAO; //导入依赖的package包/类
public ActionDAOMysqlImpl(DataSource dataSource, TenantService tenantService,
SqlScriptService sqlScriptService, AssocTypeDAO assocTypeDAO) {
super(sqlScriptService);
this.tenantService = tenantService;
this.assocTypeDAO = assocTypeDAO;
setDataSource(dataSource);
// output connection information
if (logger.isInfoEnabled()) {
try {
logger.info(DaoUtils.getDatabaseURLAndUserName(dataSource));
} catch (Exception e) {
logger.error(e);
}
}
}
示例5: GeneratorContainer
import org.easyrec.store.dao.core.types.AssocTypeDAO; //导入依赖的package包/类
public GeneratorContainer(AssocTypeDAO assocTypeDAO, NamedConfigurationDAO namedConfigurationDAO,
LogEntryDAO logEntryDAO, PluginRegistry registry) {
this.assocTypeDAO = assocTypeDAO;
this.namedConfigurationDAO = namedConfigurationDAO;
this.logEntryDAO = logEntryDAO;
this.registry = registry;
}
示例6: ItemSearchController
import org.easyrec.store.dao.core.types.AssocTypeDAO; //导入依赖的package包/类
public ItemSearchController(ItemDAO itemDAO, String dateFormat, RemoteTenantDAO remoteTenantDAO,
ItemTypeDAO itemTypeDAO, AssocTypeDAO assocTypeDAO) {
this.itemDAO = itemDAO;
this.dateFormat = dateFormat;
this.remoteTenantDAO = remoteTenantDAO;
this.itemTypeDAO = itemTypeDAO;
this.assocTypeDAO = assocTypeDAO;
}
示例7: IDMappingServiceImpl
import org.easyrec.store.dao.core.types.AssocTypeDAO; //导入依赖的package包/类
public IDMappingServiceImpl(IDMappingDAO idMappingDAO, ItemDAO itemDAO, TenantService tenantService,
AssocTypeDAO assocTypeDAO, ItemTypeDAO itemTypeDAO) {
this.idMappingDAO = idMappingDAO;
this.itemDAO = itemDAO;
this.tenantService = tenantService;
this.assocTypeDAO = assocTypeDAO;
this.itemTypeDAO = itemTypeDAO;
}
示例8: itemsForUser
import org.easyrec.store.dao.core.types.AssocTypeDAO; //导入依赖的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;
}
示例9: setAssocTypeDAO
import org.easyrec.store.dao.core.types.AssocTypeDAO; //导入依赖的package包/类
public void setAssocTypeDAO(AssocTypeDAO assocTypeDAO) {
this.assocTypeDAO = assocTypeDAO;
}
示例10: getAssocTypeDAO
import org.easyrec.store.dao.core.types.AssocTypeDAO; //导入依赖的package包/类
public AssocTypeDAO getAssocTypeDAO() {
return assocTypeDAO;
}
示例11: relatedItems
import org.easyrec.store.dao.core.types.AssocTypeDAO; //导入依赖的package包/类
@GET
@Path("/relateditems")
public Response relatedItems(@PathParam("type") String type, @QueryParam("apikey") String apiKey,
@QueryParam("tenantid") String tenantId,
@QueryParam("assoctype") String assocType, @QueryParam("userid") String userId,
@QueryParam("sessionid") String sessionId, @QueryParam("itemid") String itemId,
@QueryParam("numberOfResults") Integer numberOfResults,
@QueryParam("offset") @DefaultValue("0") Integer offset,
@QueryParam("itemtype") String itemType,
@QueryParam("requesteditemtype") String requestedItemType,
@QueryParam("callback") String callback,
@QueryParam("withProfile") @DefaultValue("false") boolean withProfile,
@QueryParam("token") String token)
throws EasyRecException {
Monitor mon = MonitorFactory.start(JAMON_REST_RELATED_ITEMS);
if (easyrecSettings.getSecuredAPIMethods().contains("relateditems")) {
Operator o = operatorDAO.getOperatorFromToken(token);
if (o == null)
exceptionResponse(WS.ACTION_RELATED_ITEMS, MSG.WRONG_TOKEN, type, callback);
else
apiKey = o.getApiKey();
}
Recommendation rec = null;
Integer coreTenantId = operatorDAO.getTenantId(apiKey, tenantId);
Integer assocTypeId = null;
if (coreTenantId == null)
exceptionResponse(WS.ACTION_RELATED_ITEMS, MSG.TENANT_WRONG_TENANT_APIKEY, type, callback);
RemoteTenant r = remoteTenantDAO.get(coreTenantId);
if (r.isMaxActionLimitExceeded())
exceptionResponse(WS.ACTION_RELATED_ITEMS, MSG.MAXIMUM_ACTIONS_EXCEEDED, type, callback);
if (itemId == null)
exceptionResponse(WS.ACTION_RELATED_ITEMS, MSG.ITEM_NO_ID, type, callback);
if (assocType != null) {
assocTypeId = typeMappingService.getIdOfAssocType(coreTenantId, assocType, Boolean.TRUE); // only visible assocTypes can be queried
if (assocTypeId == null)
exceptionResponse(WS.ACTION_RELATED_ITEMS, MSG.ASSOC_TYPE_DOES_NOT_EXIST, type, callback);
} else {
assocType = AssocTypeDAO.ASSOCTYPE_IS_RELATED;
}
itemType = checkItemType(itemType, type, coreTenantId, tenantId, WS.ACTION_RELATED_ITEMS, callback);
requestedItemType = checkItemType(requestedItemType, type, coreTenantId, tenantId, WS.ACTION_RELATED_ITEMS, callback, null);
Session session = new Session(null, request);
try {
if ((numberOfResults == null) || (numberOfResults > WS.DEFAULT_NUMBER_OF_RESULTS))
numberOfResults = WS.DEFAULT_NUMBER_OF_RESULTS;
rec = shopRecommenderService.relatedItems(coreTenantId, assocType, userId, itemId, itemType,
requestedItemType, session,
numberOfResults, offset);
//added by FK on 2012-12-18 for adding profile data to recommendations.
if (withProfile) {
addProfileDataToItems(rec);
}
} catch (EasyRecRestException e) {
exceptionResponse(WS.ACTION_RELATED_ITEMS, e.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();
}
示例12: installDefaultOnFirstRun
import org.easyrec.store.dao.core.types.AssocTypeDAO; //导入依赖的package包/类
public void installDefaultOnFirstRun() throws Exception {
if (properties != null && "true".equals(properties.getProperty("easyrec.firstrun"))) {
properties.setProperty("easyrec.firstrun", "false");
File of = new File(overrideFolder.getFile(), "easyrec.database.properties");
properties.store(new FileOutputStream(of), "");
logger.info("First run after install... installing/updating default plugins!");
HashMap<URI, Version> installedPlugins = new HashMap<URI, Version>();
for (PluginVO plugin : pluginDAO.loadPluginInfos()) {
installedPlugins.put(plugin.getPluginId().getUri(), plugin.getPluginId().getVersion());
}
File[] files = new File[0];
if (pluginFolder.exists())
files = pluginFolder.getFile().listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.endsWith(".jar");
}
});
for (File file : files) {
byte[] pluginContent = IOUtils.toByteArray(new FileInputStream(file));
PluginVO defaultPlugin = checkPlugin(pluginContent);
if (defaultPlugin != null) {
// if an older version of a default plugin exists, delete it
if (installedPlugins.containsKey(defaultPlugin.getPluginId().getUri())) {
if (installedPlugins.get(defaultPlugin.getPluginId().getUri())
.compareTo(defaultPlugin.getPluginId().getVersion()) < 0) {
pluginDAO.deletePlugin(defaultPlugin.getPluginId().getUri(),
installedPlugins.get(defaultPlugin.getPluginId().getUri()));
}
}
pluginDAO.storePlugin(defaultPlugin);
installPlugin(defaultPlugin.getPluginId().getUri(), defaultPlugin.getPluginId().getVersion());
}
}
}
// check if assocType "IS_RELATED" exists for all tenants, if not add it
List<TenantVO> tenants = tenantService.getAllTenants();
for (TenantVO tenantVO : tenants) {
tenantService.insertAssocTypeForTenant(tenantVO.getId(), AssocTypeDAO.ASSOCTYPE_IS_RELATED, true);
}
}