Additional Methods in ActionHook to retrieve Settings #70
Closed
kschmiechen
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Hi Kevin, We've just merged the changes you requested. There were slight modifications to the method signatures, but everything should work as you expected. Please let us know if there's anything we missed. Thanks for your suggestion. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi SBB Team,
I want to suggest some methods in ActionHook to make it easier to retrieve the hook settings.
I analyzed the settings of my existing hooks, had a look at what is already implemented in the new interceptor manager and also considered the methods available for workflow functions and conditions.
The basic methods would be
These work like the methods available for functions and conditions. The methods return
null
if the setting is not available.In the code of the interceptor manager, I already saw
isCommaSeparatedSettingsHasItem(String itemToCheck, String settingsName, String projectId)
to filter the setting by project ID and also supporting the wildcard*
in the saved settings.I want to take this idea one step further and suggest
where every list element of
settingsId
orsettingsPrefix
is one part of the settingId stored in the dot notation.Example:
List.of("projectId", "typeId", "fieldId")
matchesprojectId.typeId.fieldId
in the hook settings.Moreover, it matches the following wildcard combinations but always returns the first one in this order:
The method
getSettingsValuesWithPrefix(List<String> settingsPrefix, boolean getAll)
has the special behavior ifgetAll == true
that it returns not just the entries with the highest priority according to the above order, but all entries matching the prefix as long as they don't overwrite higher priority settings.Example (both are added):
Example (only first is added since the second would overwrite the first entry in the map):
Since this approach is generic, it does not matter how each hook implements it's parameters. Based on my existing hooks, I identified the following examples which I think all work with the above approach:
Beta Was this translation helpful? Give feedback.
All reactions