@Service(value="blMultiTenantSolrIndexServiceExtensionHandler")
public class MultiTenantSolrIndexServiceExtensionHandler
extends org.broadleafcommerce.core.search.service.solr.index.AbstractSolrIndexServiceExtensionHandler
implements org.broadleafcommerce.core.search.service.solr.index.SolrIndexServiceExtensionHandler
| Modifier and Type | Field and Description |
|---|---|
protected org.broadleafcommerce.core.catalog.service.CatalogService |
catalogService |
protected org.broadleafcommerce.core.search.service.solr.index.SolrIndexServiceExtensionManager |
extensionManager |
protected org.broadleafcommerce.core.search.service.solr.index.SolrIndexService |
indexService |
protected MultiTenantProductDao |
mtProductDao |
protected org.broadleafcommerce.common.sandbox.SandBoxHelper |
sandBoxHelper |
protected org.broadleafcommerce.core.search.service.solr.SolrHelperService |
shs |
protected org.broadleafcommerce.common.site.service.SiteService |
siteService |
protected org.broadleafcommerce.core.search.service.solr.SolrConfiguration |
solrConfiguration |
| Constructor and Description |
|---|
MultiTenantSolrIndexServiceExtensionHandler() |
| Modifier and Type | Method and Description |
|---|---|
org.broadleafcommerce.common.extension.ExtensionResultStatusType |
attachAdditionalBasicFields(org.broadleafcommerce.core.catalog.domain.Indexable indexable,
org.apache.solr.common.SolrInputDocument document,
org.broadleafcommerce.core.search.service.solr.SolrHelperService shs) |
protected org.broadleafcommerce.common.extension.ExtensionResultStatusType |
fixSuperCatalogProductionId(Class<?> clazz,
Long[] returnContainer) |
protected org.broadleafcommerce.common.extension.ExtensionResultStatusType |
fixSuperCatalogProductionId(org.broadleafcommerce.core.catalog.domain.Indexable indexable,
Long[] returnContainer)
In MultiTenant, everything in Solr should have the original ID from the catalog that it is inheriting from.
|
protected Long |
getCatalogDiscriminator(CatalogDiscriminator discriminableEntity,
Collection<Long> overriddenCatalogIds)
Obtains the catalog that the product should be indexed in.
|
org.broadleafcommerce.common.extension.ExtensionResultStatusType |
getCategoryId(Long category,
Long[] returnContainer) |
org.broadleafcommerce.common.extension.ExtensionResultStatusType |
getIndexableId(org.broadleafcommerce.core.catalog.domain.Indexable indexable,
Long[] returnContainer) |
int |
getPriority()
This must run after the Enterprise version of this extension handler in order for
fixSuperCatalogProductionId(Class, Long[])
to run afterwards |
void |
init() |
addPropertyValues, attachAdditionalDocumentFields, attachChildDocuments, endBatchEvent, modifyBuiltDocuments, populateDocumentForIndexField, startBatchEventisEnabled, setEnabled, setPriorityclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprotected org.broadleafcommerce.core.search.service.solr.SolrHelperService shs
protected org.broadleafcommerce.core.search.service.solr.index.SolrIndexServiceExtensionManager extensionManager
protected org.broadleafcommerce.core.catalog.service.CatalogService catalogService
protected MultiTenantProductDao mtProductDao
protected org.broadleafcommerce.common.sandbox.SandBoxHelper sandBoxHelper
protected org.broadleafcommerce.core.search.service.solr.index.SolrIndexService indexService
@Qualifier(value="blCatalogSolrConfiguration") @Autowired(required=false) protected org.broadleafcommerce.core.search.service.solr.SolrConfiguration solrConfiguration
protected org.broadleafcommerce.common.site.service.SiteService siteService
public MultiTenantSolrIndexServiceExtensionHandler()
@PostConstruct public void init()
public org.broadleafcommerce.common.extension.ExtensionResultStatusType attachAdditionalBasicFields(org.broadleafcommerce.core.catalog.domain.Indexable indexable,
org.apache.solr.common.SolrInputDocument document,
org.broadleafcommerce.core.search.service.solr.SolrHelperService shs)
attachAdditionalBasicFields in interface org.broadleafcommerce.core.search.service.solr.index.SolrIndexServiceExtensionHandlerattachAdditionalBasicFields in class org.broadleafcommerce.core.search.service.solr.index.AbstractSolrIndexServiceExtensionHandlerprotected Long getCatalogDiscriminator(CatalogDiscriminator discriminableEntity, Collection<Long> overriddenCatalogIds)
Obtains the catalog that the product should be indexed in. This should almost always be what is on threadlocal at
BroadleafRequestContext.getCurrentCatalog(). If nothing is on threadlocal this will use the catalog from the
given discriminableEntity
discriminableEntity - the entity whose catalog discriminator we should obtainoverriddenCatalogIds - the catalog IDs that the given discriminableEntity has been overridden inMultiTenantWorkflowSolrIndexServiceExtensionHandler#modifyBuiltDocuments(java.util.ArrayList, List, List, List)}public int getPriority()
fixSuperCatalogProductionId(Class, Long[])
to run afterwardsgetPriority in interface org.broadleafcommerce.common.extension.ExtensionHandlergetPriority in class org.broadleafcommerce.common.extension.AbstractExtensionHandlerpublic org.broadleafcommerce.common.extension.ExtensionResultStatusType getCategoryId(Long category, Long[] returnContainer)
getCategoryId in interface org.broadleafcommerce.core.search.service.solr.index.SolrIndexServiceExtensionHandlergetCategoryId in class org.broadleafcommerce.core.search.service.solr.index.AbstractSolrIndexServiceExtensionHandlerpublic org.broadleafcommerce.common.extension.ExtensionResultStatusType getIndexableId(org.broadleafcommerce.core.catalog.domain.Indexable indexable,
Long[] returnContainer)
getIndexableId in interface org.broadleafcommerce.core.search.service.solr.index.SolrIndexServiceExtensionHandlergetIndexableId in class org.broadleafcommerce.core.search.service.solr.index.AbstractSolrIndexServiceExtensionHandlerprotected org.broadleafcommerce.common.extension.ExtensionResultStatusType fixSuperCatalogProductionId(org.broadleafcommerce.core.catalog.domain.Indexable indexable,
Long[] returnContainer)
In MultiTenant, everything in Solr should have the original ID from the catalog that it is inheriting from. This solves the following problem:
When we get to this point in the Solr indexing, the id that is passed to us is the ID of the product in the standard site (10001 in the above example). We need to have product ID of the global catalog (1 in the above example). This will go and check the clone lib to see if this particular id was cloned from an id a master.
This will override the result that was previously placed in returnContainer (if any). Presumably, workflows/approvals would have been the one that would have attempted to give a result back for the 'real' production id. This takes that result and then uses it to look up what the inherited catalog production id is.
sandBoxDiscriminator - returnContainer - Copyright © 2020. All rights reserved.