Enough talk let's rock :
In the beginning ! There was preparation !
- Download a brand new Eclipse from here.
- Download Drools binaries from here.
- An Eclipse plugin we are going to use you may download from here but i recommend to use update site .
If the downloads are complete then we are ready for action!
First install your Eclipse Plugin. You may find the instructions how to install an (JBoss Drools) eclipse plugin here.
And now you are able to create your own JBoss Drools Project in Eclipse :
Create new Project
Type Drools and Select Drools Project Then Press Next (In pic Drools Project is not selected so Next is disabled )
Name your project and press next!
The first two should be selected..
If the "Drools Runtime" is missing then click "Configure Workspace Settings..."
Click to "Add" then Browser for your "Drools Binaries" folder that you just downloaded (and extracted).
Select the runtime that you created.
And Finish!
The plugin is going to generate the files. And you have a project like this :
The .drl file consist of your rules. The syntax is easy.. When Part checks the condition and Then part acts like needed..
The code is easy too.
- Read the knowledge base..
- Create a session..
- Create the object that is going to be checked by rules
- Set all the fields that are going to be checked.. (This is important)
- Put the object to the session (so the rule be able to read it)
- And Call the rules or Fire Them :) fireAllRules();
No comments:
Post a Comment