use of org.broadleafcommerce.common.web.BroadleafRequestContext in project BroadleafCommerce by BroadleafCommerce.
the class SolrConfiguration method getSiteServer.
public SolrClient getSiteServer() {
BroadleafRequestContext ctx = BroadleafRequestContext.getBroadleafRequestContext();
Site site = ctx.getNonPersistentSite();
CloudSolrClient client = (CloudSolrClient) primaryServer;
client.connect();
String aliasName = getSiteAliasName(site);
if (aliasName != null) {
String collectionName = getSiteCollectionName(site);
createCollectionIfNotExist(client, collectionName);
createAliasIfNotExist(client, collectionName, collectionName);
}
return client;
}
use of org.broadleafcommerce.common.web.BroadleafRequestContext in project BroadleafCommerce by BroadleafCommerce.
the class SolrSearchServiceImpl method createSearchContextDTO.
protected SearchContextDTO createSearchContextDTO() {
SearchContextDTO searchContextDTO = new SearchContextDTO();
BroadleafRequestContext ctx = BroadleafRequestContext.getBroadleafRequestContext();
if (ctx != null) {
Map<String, Object> ruleMap = (Map<String, Object>) ctx.getRequestAttribute("blRuleMap");
if (MapUtils.isNotEmpty(ruleMap)) {
searchContextDTO.setAttributes(ruleMap);
}
}
return searchContextDTO;
}
use of org.broadleafcommerce.common.web.BroadleafRequestContext in project BroadleafCommerce by BroadleafCommerce.
the class SolrIndexCachedOperation method getCache.
/**
* Retrieve the cache bound to the current thread.
*
* @return The cache for the current thread, or null if not set
*/
public static CatalogStructure getCache() {
BroadleafRequestContext ctx = BroadleafRequestContext.getBroadleafRequestContext();
Catalog currentCatalog = ctx == null ? null : ctx.getCurrentCatalog();
if (currentCatalog != null) {
return MapUtils.getObject(CACHE.get(), currentCatalog.getId());
} else {
return MapUtils.getObject(CACHE.get(), DEFAULT_CATALOG_CACHE_KEY);
}
}
Aggregations