Class DefaultWebhookFilterService
java.lang.Object
de.hybris.platform.webhookservices.filter.impl.DefaultWebhookFilterService
- All Implemented Interfaces:
WebhookFilterService
A default implementation of the
WebhookFilterService that uses the platform's scripting engine for
executing the WebhookFilter logic.-
Constructor Summary
ConstructorsConstructorDescriptionDefaultWebhookFilterService(@NotNull ScriptingLanguagesService scriptingLanguagesService) Constructs the DefaultWebhookFilterService -
Method Summary
-
Constructor Details
-
DefaultWebhookFilterService
public DefaultWebhookFilterService(@NotNull @NotNull ScriptingLanguagesService scriptingLanguagesService) Constructs the DefaultWebhookFilterService- Parameters:
scriptingLanguagesService- Service to run scripts
-
-
Method Details
-
filter
Evaluates the item and filters out, if item does not match the filtering logic criteria.It's important that the script referenced by the
scriptUriwould implementWebhookFilterinterface. Otherwise, the filtering won't work, i.e. all items should be filtered out by the implementations.Any exception thrown by the filter script eliminates the item from being sent to the webhook.
If the script returns an ItemModel type that differs from the input
itemtype, the item will be filtered out. However, if the returned ItemModel type is a subtype of the inputitemtype, the item will be sent.- Specified by:
filterin interfaceWebhookFilterService- Type Parameters:
T- The type of the ItemModel- Parameters:
item- an item being sent to a webhook.scriptUri- a URI for the item filter logic (script) location. SeeScripting Engine documentation - Returns:
- an
Optionalcontaining the item to send to the webhook, if the item passes the filter; or anOptional.empty(), if the item is filtered out from the webhook notification.
-