-
Notifications
You must be signed in to change notification settings - Fork 218
more event filters #1309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
more event filters #1309
Conversation
metacosm
commented
Jul 1, 2022
•
edited
Loading
edited
- refactor: share filter handling (wip)
…ner reference can be added (#1197)
Note: I don't think that the unit tests are correct, see todos. The filters should come from the configuration and we shouldn't override them like is currently done but got through the ConfigurationOverrider mechanism.
Kudos, SonarCloud Quality Gate passed! |
|
||
public void setOnDeleteFilter(BiPredicate<R, Boolean> onDeleteFilter) { | ||
this.onDeleteFilter = onDeleteFilter; | ||
public void initFilters(Predicate<R> onAddFilter, BiPredicate<R, R> onUpdateFilter, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a very nice API, with all the null values required.
propagateEvent(resource); | ||
} | ||
} | ||
|
||
private synchronized void onAddOrUpdate(Operation operation, R newObject, R oldObject, | ||
private synchronized void onAddOrUpdate(ResourceAction operation, R newObject, R oldObject, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The separate Operation was intentional to exclude delete. I don't think this needs to be changed, it is more explicit that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is something completely different from filters.
@@ -25,11 +25,7 @@ default Optional<R> getSecondaryResource(P primary) { | |||
|
|||
Set<R> getSecondaryResources(P primary); | |||
|
|||
void setOnAddFilter(Predicate<R> onAddFilter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is not initFilters
better than having setters?
|
||
public void setOnDeleteFilter(BiPredicate<R, Boolean> onDeleteFilter) { | ||
this.onDeleteFilter = onDeleteFilter; | ||
public void initFilters(Predicate<R> onAddFilter, BiPredicate<R, R> onUpdateFilter, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When this is intended to be called? Since it should be afterinitEventSource
, but that is called after the event source initialized. Can we add an integration test for this?