You make me hesitating :-).<br><br>I just tried to make a pojo. But i will have to do a single Pojo called "Map" with all the properties? Right now i had 4 Enum. Here i will have to have all in the same POJO with name "Map".<br>
<br>The advantage i suppose is that with the Pojo, we can directly tell this attribute is a String, this one is a Integer, this one a Double and this one a Long and in the rules all will be done automatically without casting?<br>
<br>I can still assign $m1 for example to a Map found with "set variable name".<br><br>But in my example of 2 mails ago, to verify that it's not the same Map with verifying $m1["id"]!=$m2["id"] i have to write it by hand with adding a Map and choose formula then adding "$m1["id"]!=$m2["id"]"? Same for testing timestamp of $m1 is before timestamp of $m2? Or is there a way to add it in Pojo? I tried adding methods in the Pojo but i cannot call them.<br>
<br><br><br>I can have a look for taking the compiled package but this will mean change a lot of code. I had to implement something that watch if the drl file was change before creating the Knoledge base otherwise we keep the old knowledge base. Because i do it in a multi threaded environement and it was crashing.<br>
<br>If i take th ecompiled one, can i easily split this in 4 compiled package with each its rules? using Category? <br><br>The solution to do it with drl is a little too complicated.<br><br>Thanks again.<br><br><br><div class="gmail_quote">
On Fri, Mar 4, 2011 at 4:42 PM, Vincent Legendre [via Drools - Java Rules Engine] <span dir="ltr"><<a href="/user/SendEmail.jtp?type=node&node=2634675&i=0&by-user=t" target="_top" rel="nofollow" link="external">[hidden email]</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">
        
<html>
<head>
</head>
<body text="#000000" bgcolor="#ffffff">
<br>
</div><blockquote style="border-left: 2px solid rgb(204, 204, 204); padding: 0pt 1em;" type="cite">
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><div class="im">
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>
</div><blockquote style="border-left: 2px solid rgb(204, 204, 204); padding: 0pt 1em;" type="cite"> <br><div class="im">
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>
</div></blockquote><div class="im">
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>
</div><div class="im"><blockquote style="border-left: 2px solid rgb(204, 204, 204); padding: 0pt 1em;" 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></div><div class="im">
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>
</div><blockquote style="border-left: 2px solid rgb(204, 204, 204); padding: 0pt 1em;" type="cite"> <br><div class="im">
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?</div></blockquote>
Don't know if global can contains Enum and DSL. I think it can only
contain rules<br>
<br>
<blockquote style="border-left: 2px solid rgb(204, 204, 204); padding: 0pt 1em;" type="cite"> <br><div class="im">
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.</div></blockquote>
Don't known, sorry.<br>
<br>
</body>
</html>
<br><div class="im">_______________________________________________
<br>rules-users mailing list
<br><a href="http://user/SendEmail.jtp?type=node&node=2634103&i=0&by-user=t" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br></div><div class="im"><a href="https://lists.jboss.org/mailman/listinfo/rules-users" rel="nofollow" link="external" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
        
        <br>
        <br>
        </div><hr color="#cccccc" noshade size="1">
        <div style="color: rgb(68, 68, 68); font: 12px tahoma,geneva,helvetica,arial,sans-serif;"><div class="im">
                <div style="font-weight: bold;">If you reply to this email, your message will be added to the discussion below:</div>
                </div><a href="http://drools-java-rules-engine.46999.n3.nabble.com/Guvnor-and-drools-implementation-questions-tp2602641p2634103.html?by-user=t" target="_blank" rel="nofollow" link="external">http://drools-java-rules-engine.46999.n3.nabble.com/Guvnor-and-drools-implementation-questions-tp2602641p2634103.html</a>
        </div><div><div></div><div class="h5">
        <div style="color: rgb(102, 102, 102); font: 11px tahoma,geneva,helvetica,arial,sans-serif; margin-top: 0.4em;">
                
                
        </div></div></div></blockquote></div><br>
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Guvnor-and-drools-implementation-questions-tp2602641p2634675.html">Re: Guvnor and drools implementation - questions</a><br/>
Sent from the <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Drools-User-f47000.html">Drools - User mailing list archive</a> at Nabble.com.<br/>