Advanced Search Engine Generic Initializer Widget

The Advanced Search Engine Generic Initializer widget is a generic solution that can be used to invoke the Advanced Search, for example as a reaction to some selection in the explorer tree.

Widget Definition

Name

Advanced Search Engine Generic Initializer

ID

com.hybris.cockpitng.widgets.common.advancedsearchengine.genericinitializer

Category

Search

Description

An Advanced Search Engine widget's generic initializer.

Applied In

Not applicable

Based On

Not applicable

Author

SAP

Inputs

  • nodeSelected
    • Type: com.hybris.backoffice.navigation.NavigationNode
    • Description: Receives input to convert it to another type

Outputs

  • outContext
    • Type: Any type com.hybris.backoffice.widgets.advancedsearch.impl.AdvancedSearchInitContext
    • Description: Result of the type conversion.

Configuration

Not applicable.

Widget Preview

Not applicable.

Settings

Setting

Type

Description

requiredTypeCode

java.lang.String

A type code for which the search context should be created.

navigationNodeId

java.lang.String

Navigation node's id to compare with. The query transformation is applied only in two cases:
  • if the node's id matches the value defined in this setting
  • if the node is of type DynamicNode and its id starts with the value defined in this setting
Default value: <__i_do_not_match>.

handlerBeanId

java.lang.String

Id of a bean that implements the com.hybris.backoffice.widgets.advancedsearch.AdvancedSearchInitializer and is used to initialize the query.

Widget Slots

slotID

Multiplicity Type

Slots Composition

cockpitWidgetChildrenInvisible

multi

Not applicable.

This is a general purpose slot available for widgets. Any widget placed on this slot will not be displayed in the application view but can be accessed through its socket API.

Initialization of Dynamic Reference Filter Query in Advanced Search

If you wish each selection in the dynamically configured Explorer Tree triggered the search with predefined Filter Query conditions, you need to set a relevant handler bean.

referenceFilterAdvancedSearchInitializer Spring Bean

The referenceFilterAdvancedSearchInitializer is a handler bean that can be used with the Advanced Search Engine Generic Initializer Widget to trigger Advanced Search Widget with Filter Query conditions that contain references – that is PK values.
To initialize the search with such conditions, the data of the NavigationNode object that is sent to the nodeSelected input socket of the Advanced Search Engine Generic Initializer Widget must be of ItemModel type. Configuration of this handler bean is defined by the referenceFilterConditionFieldForTypeMap Spring map, which maps the actual itemtype of the ItemModel to the condition field name. For example, if the CatalogVersion itemtype is mapped to the catalogVersionPk field, it means that when an item of the CatalogVersion type is sent as data to the widget's input socket, its PK value is used as a Filter Query condition value for the catalogVersionPk field. As a result, the advanced search is automatically initialized with the values set directly for the mapped field names.
Default values mapped in the referenceFilterConditionFieldForTypeMap:

Key

Value

Catalog

catalogPk

CatalogVersion

catalogVersionPk

Category

categoryPk

Example of Usage

Let's assume that you have the Explorer Tree widget configured with dynamic nodes that display Catalogs, CatalogVersions, and Categories. Owing to the referenceFilterAdvancedSearchInitializer handler configuration, each selection in the tree nodes triggers a search with the applied Filter Queries:
  • if a CatalogVersion node is chosen, the search conditions apply for Catalog and catalogVersion
  • if a Category node is chosen, the search conditions apply for Catalog, CatalogVersion, and all categories down the chosen one