<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:Verdana;
        color:black;}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:Verdana;
        color:windowtext;
        font-weight:normal;
        font-style:normal;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Verdana;
        color:navy;
        font-weight:normal;
        font-style:normal;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor=white lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'>I was not able to portray the right picture </span></font><font
color=navy face=Wingdings><span style='font-family:Wingdings;color:navy'>L</span></font><font
color=navy><span style='color:navy'>. Here’s another shot at clarifying
my situation.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'>Let’s say we have a commission rule as follows<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'>rule "Commission Calculation <b><span style='font-weight:
bold'>07-08</span></b>" <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'> <b><span
style='font-weight:bold'>date-effective "01-Apr-2007"<o:p></o:p></span></b></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'> <b><span
style='font-weight:bold'>date-expires "30-Mar-2008"<o:p></o:p></span></b></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'> when<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'> ....<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'> then<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'> ....<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'>end<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'>Now for the next financial year we define a new rule as
follows<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'>rule "Commission Calculation <b><span style='font-weight:
bold'>08-09</span></b>" <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'> <b><span
style='font-weight:bold'>date-effective "01-Apr-2008"<o:p></o:p></span></b></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'> <b><span
style='font-weight:bold'>date-expires "30-Mar-2009"<o:p></o:p></span></b></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'> when<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'> ....<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'> then<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'> ....<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'>end<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'>Now let’s say <i><u><span style='font-style:italic'>today’s
date is 15<sup>th</sup> April 2008</span></u></i>. An agent is promoted today
with <i><u><span style='font-style:italic'>effective date as 1<sup>st</sup> March
2008</span></u></i>. Hence his commission needs to be recalculated as per the “Commission
Calculation <b><span style='font-weight:bold'>07-08</span></b>” rule and <b><u><span
style='font-weight:bold'>not</span></u></b> the effective rule as on today i.e.
“Commission Calculation <b><span style='font-weight:bold'>08-09</span></b>”.
For rest of the agents commission would be calculated based on the rule
effective today i.e. 15<sup>th</sup> April 2008. Hence a need to pass a date
during execution of rule based on which the right rule would be chosen.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'>Basically there is no legacy code as part of my example but
a need to fire the rules that are effective on a date other than the system
date always.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'>I have seen similar functionality in other rules engines
too. Can this be done in JBoss Rules? If yes, is TimeMachine the right way of
doing it?<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'>Regards,<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'>- Nimesh<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;color:navy'><o:p> </o:p></span></font></p>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
color=black face="Times New Roman"><span style='font-size:12.0pt;font-family:
"Times New Roman";color:windowtext'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 color=black face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;color:windowtext;font-weight:bold'>From:</span></font></b><font
color=black face=Tahoma><span style='font-family:Tahoma;color:windowtext'>
rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <b><span style='font-weight:bold'>On
Behalf Of </span></b>Scott Reed<br>
<b><span style='font-weight:bold'>Sent:</span></b> Wednesday, March 05, 2008
8:40 PM<br>
<b><span style='font-weight:bold'>To:</span></b> Rules Users List<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [rules-users] Setting
date during execution of rules.</span></font><font size=3 color=black
face="Times New Roman"><span style='font-size:12.0pt;font-family:"Times New Roman";
color:windowtext'><o:p></o:p></span></font></p>
</div>
<p class=MsoNormal><font size=2 color=black face=Verdana><span
style='font-size:10.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=black face=Verdana><span
style='font-size:10.0pt'>As I understand it, the problem is that you have
legacy code that uses the system date in it's calculations and you cannot fix
that so it will take a date parameter, right? If so, then my recommendation is
to fix the legacy software if possible since messing with the system date gives
me the willies. If you can't fix it, then anything that can be called from Java
to set the system date (e.g.Runtime.exec(...).waitfor()?) should be callable
from the 'then' part of a rule. Make that call, call your legacy code, then
make the call to set the date back. But that is so ugly, please don't tell
anyone I had anything to do with it.<br>
<br>
<st1:PersonName w:st="on">Nimesh Muley</st1:PersonName>'s message received
3/5/2008 1:25 AM: <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=black face=Verdana><span
style='font-size:10.0pt'>Hi,<u1:p></u1:p><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=black face=Verdana><span
style='font-size:10.0pt'><u1:p> </u1:p><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=black face=Verdana><span
style='font-size:10.0pt'>Is there a way to set the date while executing the
rules? The effective dates would be checked against this date instead of
today’s date. By default the effective dates would be checked with System
date. But in some cases we would need to execute the rules in a
‘back-dated’ mode.<u1:p></u1:p><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=black face=Verdana><span
style='font-size:10.0pt'><u1:p> </u1:p><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=black face=Verdana><span
style='font-size:10.0pt'>Use case.<u1:p></u1:p><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=black face=Verdana><span
style='font-size:10.0pt'>Let’s say in insurance industry there are
commission calculation rules for an agent. On these rules the effective dates
are appropriate (as per their needs). Now when an agent is promoted and his/her
promotion date is couple of months back then we would want to calculate the
commission once again with the date as 2 months back.<u1:p></u1:p><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=black face=Verdana><span
style='font-size:10.0pt'><u1:p> </u1:p><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=black face=Verdana><span
style='font-size:10.0pt'>The nearest I could see is TimeMachine, as this is
being used during execution of rules. Although I could not find a way to set
the TimeMachine in release 4.0.4.<u1:p></u1:p><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=black face=Verdana><span
style='font-size:10.0pt'><u1:p> </u1:p><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=black face=Verdana><span
style='font-size:10.0pt'>Has anyone tried something like this before?<u1:p></u1:p><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=black face=Verdana><span
style='font-size:10.0pt'> <u1:p></u1:p><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=black face=Verdana><span
style='font-size:10.0pt'>Regards,<u1:p></u1:p><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=black face=Verdana><span
style='font-size:10.0pt'>- Nimesh<u1:p></u1:p><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=black face=Verdana><span
style='font-size:10.0pt'>"The first 90% of a project takes 90% of the
time, the last 10% takes the other 90% of the time" - Murphy's Law<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3 color=black
face="Times New Roman"><span style='font-size:12.0pt;font-family:"Times New Roman"'>While
so very true, this is not Murphy's Law, which I think of as "Whatever can
go wrong, probably will." (see <a
href="http://en.wikipedia.org/wiki/Murphy%27s_law">http://en.wikipedia.org/wiki/Murphy%27s_law</a>)<br>
Your rule here is called the 90-90 rule: <a
href="http://en.wikipedia.org/wiki/Ninety-ninety_rule">http://en.wikipedia.org/wiki/Ninety-ninety_rule</a><br>
<br>
<o:p></o:p></span></font></p>
<table class=MsoNormalTable border=0 cellpadding=0 bgcolor=white
style='background:white'>
<tr>
<td style='padding:.75pt .75pt .75pt .75pt'>
<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;font-family:"Times New Roman"'><o:p> </o:p></span></font></p>
</td>
</tr>
</table>
<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;font-family:"Times New Roman";color:windowtext'><o:p> </o:p></span></font></p>
</div>
<br><br><table bgcolor=white style="color:black"><tr><td><br>MASTEK LTD.<br>
Making a valuable difference<br>
Mastek in NASSCOM's 'India Top 20' Software Service Exporters List.<br>
In the US, we're called MAJESCOMASTEK<br>
<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
</td></tr></table></body>
</html>