<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
<br>
<blockquote
cite="mid:AANLkTi=FbHPWeixJh6ov_dCND+V02y8vLyqQ=YvjB2nV@mail.gmail.com"
type="cite">I've just created 2 class like you show me with some
changes to fit and test all (timestamp are long in fact, i have
put int, double and string as well) <br>
</blockquote>
In the second class you don't need the attributes as members,
because Drools uses get / set methods to deduce them, and anyway you
never use them as they are stored in the map.<br>
<br>
<blockquote
cite="mid:AANLkTi=FbHPWeixJh6ov_dCND+V02y8vLyqQ=YvjB2nV@mail.gmail.com"
type="cite">Then i have imported this in Guvnor.<br>
<br>
I have made 2 categories. I have put the model (jar) in the 2
categories.</blockquote>
That is non-sense. Jars are not linked to a category but to a
package.<br>
<br>
<blockquote
cite="mid:AANLkTi=FbHPWeixJh6ov_dCND+V02y8vLyqQ=YvjB2nV@mail.gmail.com"
type="cite"> I have created 2 simple rules playing with the
attributes id, timestamp...<br>
</blockquote>
With Guided editor ?<br>
<br>
<blockquote
cite="mid:AANLkTi=FbHPWeixJh6ov_dCND+V02y8vLyqQ=YvjB2nV@mail.gmail.com"
type="cite">
<table id="ext-gen555">
<tbody id="ext-gen559">
<tr>
<td><br>
1) For the condition Map $m1 different then Map $m2. I
suppose i have to use the function define in MapPojo? I
have to write it by hand using "free from drl" : eval($m1
!= $m2) ? or is there a better way? <br>
</td>
</tr>
</tbody>
</table>
</blockquote>
Its a way.<br>
You can also test the id directly in conditions (in Guided editor,
bind the id of the first instance to a var, then compare it in the
second condition.<br>
<blockquote
cite="mid:AANLkTi=FbHPWeixJh6ov_dCND+V02y8vLyqQ=YvjB2nV@mail.gmail.com"
type="cite">
<table id="ext-gen555">
<tbody id="ext-gen559">
<tr>
<td>
<br>
The same for testing that $m1 timestamp (Long) is befor
$m2. I have to write it by hand : eval($m1.isBefore($m2))?
So they have to know it exist a method isBefore if not
said by the gui?<br>
</td>
</tr>
</tbody>
</table>
</blockquote>
Same. Add the test directly in the condition.<br>
Another solution is to use a custom operator (search this mailing
list for samples).<br>
<br>
<blockquote
cite="mid:AANLkTi=FbHPWeixJh6ov_dCND+V02y8vLyqQ=YvjB2nV@mail.gmail.com"
type="cite">
<table id="ext-gen555">
<tbody id="ext-gen559">
<tr>
<td>2) In the code It's written MapTest1(..) instead of
Map(...) so i suppose drools has to do it with the
precompiled package .pkg to know about the MapPojo and
MapTest1.. If i take only the .drl, drools won't know
about class MapTest1.<br>
</td>
</tr>
</tbody>
</table>
</blockquote>
It is MapTest1, because this is the class used .... and drools knows
it because it uses it ... You don't use Map directly anymore<br>
<blockquote
cite="mid:AANLkTi=FbHPWeixJh6ov_dCND+V02y8vLyqQ=YvjB2nV@mail.gmail.com"
type="cite"><br>
<div class="gmail_quote">Yes i can set a category to each of my
rule. </div>
</blockquote>
Yes you can !<br>
<blockquote
cite="mid:AANLkTi=FbHPWeixJh6ov_dCND+V02y8vLyqQ=YvjB2nV@mail.gmail.com"
type="cite">
<div class="gmail_quote">Do you mean create 4 categories (cat1,
cat2, cat3, cat4) and for rules of file1.drl, put them it cat1,
for file2.drl, put them in cat2... ? </div>
</blockquote>
Yes<br>
<blockquote
cite="mid:AANLkTi=FbHPWeixJh6ov_dCND+V02y8vLyqQ=YvjB2nV@mail.gmail.com"
type="cite">
<div class="gmail_quote">Set a first condition in the rules? </div>
</blockquote>
Choose between categories and first condition. Don't use both<br>
<blockquote
cite="mid:AANLkTi=FbHPWeixJh6ov_dCND+V02y8vLyqQ=YvjB2nV@mail.gmail.com"
type="cite">
<div class="gmail_quote">Am i obliged to create a package per file
and filter by category or is it possible to make a package with
all and filtering when creating the knowledgeBase or something
like that?<br>
</div>
</blockquote>
You certainly can filter your KB afterwards, but this is not really
an out-of-the-box function. To me you have two options. For both
options, you have only one Guvnor package :<b><br>
<br>
First option</b> : categories<br>
set categories for your rules as you said<br>
compile by filtering one category, do a snapshot. Redo the same for
other categories (in other snapshots). <br>
Use these 4 snapshots in your code<br>
<br>
<b>Second option </b>: First filtering condition<br>
create a new POJO having only one field to handle the task asked (or
category or group or file or whatever you call that) add a condition
to all your rules testing this fact according to their group (as
described in one of my previous mail)<br>
create a single package (or use DRL) for all your rules.<br>
when calling your rules, insert the suitable POJO according to
tehexec you want.<br>
<br>
The second is my favorite because it is less work to deploy, and
your number of rules are quite small. The second option can be
change to use a RuleFlow instead of a control fact.<br>
<br>
<br>
</body>
</html>