-
Notifications
You must be signed in to change notification settings - Fork 19
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
[WIP] Allow Fact(s) to be grouped and routed by multiple criteria #40
Open
Wedjaa
wants to merge
22
commits into
redhat-italy:master
Choose a base branch
from
Wedjaa:feature/multi-groups
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Align with upstream
Facts that return only one Key are inserted only once, no change. Facts that have multiple Key(s) will be reinserted - and redistributed - over the grid multiple times - the rules should check for the appropriate keys when processing a Fact to avoid duplication.
This Key will group by game name.
This outcome will keep tabs on the number of times and the amount spent on a game.
A Fact can be transformed depending on a Key value. This means that a Fact implementation could add a property to the fact to allow the rules to fire depending on the specific group this Fact has been routed to.
…he Key forKey has been implemented so that it will return the Fact with a different factGroup depending on the Key that was passed. This will allow the rules to discriminate based on this criteria.
The criteria property is a description of the criteria used to create this Key. Something in the lines of "playerId" or "gameName". This will allow a Fact to populate a property with this criteria, so that rules will be able to trigger on specific Fact(s).
Minor fixes in other files.
Added a rule - rule3 - to detect a users that is the Nth player for a game in D days. Added a rule to collect game playing statistics.
Thanks for your PR, I saw there's a lot of changes compared to master branch. Are you available sometimes in the future to talk about it? |
I could try and get you on Skype. When are you available. |
We are both available now on IRC, channel #drools |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The concept is quite simple: a Fact may have multiple Keys and can transform - enrich - a Fact based on the Key that's being used.
The
Fact
class has two changes:extractKey
was changed toextractKeys
: this method, rather than returning a single Key will return a Set of one or more keys. It's up to the implementation of the Fact to decide what Key(s) it should return. In the Gameplay example:extractKeys
will return two Key(s) - one for Player grouping, that uses theplayerId
as grouping key, and one for Game grouping, that uses thegameName
as grouping key;forKey
was added to the Fact class: the Fact classes implementing this method will decide how to enrich the instance of a Fact depending on the Key value and return the enriched instance. In the Gameplay example: the fact will have afactGroup
set to the Keycriteria
[see below]. This allows the rules to filter duplicate Facts coming their way.The
Key
class has one main change: it has a new property - calledcriteria
- that is a label for a specificKey
implementation. This change allows theforKey
method of theFact
to have some more information about aKey
to make an informed decision on what to do about it.Lastly the
Putter
class was changed to take advantage of these changes: when aFact
is received it will insert in theCache
one instance of theFact
for every Key returned byextractKeys
, transformed by theforKey
method.This is a WIP.