<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
<br>
<blockquote cite="mid:4D70FA9B.70407@gmail.com" type="cite">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
I will rethink of POJO but i think, it will be more ennoying to
update any change. I will need a reference to these maps in almost
every case in the THEN clause so not a big problem finally.<br>
</blockquote>
It's up to you. With a POJO you can implement Comparable using your
time slots, and all other common behaviour that you will need later
... and don't be forced to set a tricky DSL ... and have
validation/compilation telling you that you are using a non-existent
field instead of getting NPE at runtime ... but it's up to you :)<br>
<br>
<blockquote cite="mid:4D70FA9B.70407@gmail.com" type="cite"> <br>
For the second question :<br>
<br>
In fact i have to make rules using these Enum and DSL and put
rules in their specific files.<br>
For example now i am working with 4 different drl files :<br>
</blockquote>
Files ? <br>
According to your DSL questions, I guess that you are working with
Guvnor, so you are getting your file via the package URL for the
generated DRL file ?<br>
You should create compiled package, because :<br>
- rules are compiled so the KB loading is faster<br>
- Guvnor (since 5.1) ca generate compiled package with only a
subset of the rules, filtering them by category and/or status (or by
a custom selection using rules :) ).<br>
<br>
But if you can't,or don't want to create binaries, and still want to
store all rules inthe same package (to avoid duplicating DSL and
enums), may be you can <br>
- assign your rules a 'ruleflow-group' and create a ruleflow that
branch on the suitable group.<br>
- use 'agenda-group'. <br>
- With no rule flow, you can add to all your rules a condition
that match a fact telling which group is executing<br>
<tt> rule r1 <br>
when<br>
Exec(task == "task1")<br>
$m1 : ...<br>
then<br>
...<br>
end<br>
</tt><br>
It depends on how you group your rules in files.<br>
<br>
<blockquote cite="mid:4D70FA9B.70407@gmail.com" type="cite"> These
files have to have this specific name and the name cannot change
because the java code use this name to load the drl file in the
session.<br>
</blockquote>
You can also access compiled binary package by a snapshot name.<br>
Or if you have one single set of rules, create a single KB and
provide methods that create new session ans add the specific control
fact (not sure of the exact syntax, just to show the idea) :<br>
<tt> task1() {<br>
session = getKb().newStatelessSession();<br>
session.insert(new Exec("task1")<br>
...<br>
session.execute(...)<br>
}<br>
task2() {<br>
session = getKb().newStatelessSession();<br>
session.insert(new Exec("task2")<br>
...<br>
session.execute(...)<br>
}<br>
</tt>and you can obviously make that generic ...<br>
<br>
<br>
<blockquote cite="mid:4D70FA9B.70407@gmail.com" type="cite"> <br>
To put each rule in its specific file, do i have to create a
package per file and name the package with the name of the file i
want? And copy Enum and DSL in each package or can i put this in
global?</blockquote>
Don't know if global can contains Enum and DSL. I think it can only
contain rules<br>
<br>
<blockquote cite="mid:4D70FA9B.70407@gmail.com" type="cite"> <br>
To use the Test Scenario, do you know if we have to do special
things? I tried to add Maps in the Given part and run the scenario
but i get an error ; "unable to find constructor for
java.util.Map" and the same if i put a boolean, string... Is the
Guvnor Test Scenario not able to find java class and how to make
it reachable? <br>
I have already tried Test Scenario with adding object for which i
gave a Pojo but never with basic java type.</blockquote>
Don't known, sorry.<br>
<br>
</body>
</html>