[rules-users] Rule Templates

FrankVhh frank.vanhoenshoven at agserv.eu
Thu Apr 14 11:02:32 EDT 2011


Hi,

After trying the example from the documentation, eclipse returned the same
error. So, I got the same idea and just worked further ignoring eclipse.

I saw what I saw and that was that it works fine now, even with the error
still displayed in the problems view.

Thanks for the help ;-)

Regards,
Frank


Wolfgang Laun-2 wrote:
> 
> Not that I can see any problem. Disregard the Eclipse error, expand the
> template as documented, and then we'll see what we'll see...
> -W
> 
> On 14 April 2011 15:36, FrankVhh <frank.vanhoenshoven at agserv.eu>
> wrote:
> 
>> Hi W.,
>>
>> Thanks for the fast reply.
>>
>> Meanwhile, I have been trying to play with the templates. Unfortunately,
>> I
>> run into a nullpointerexception in the problems view of Eclipse. At
>> first,
>> I
>> hoped it was the same error as in
>> http://lists.jboss.org/pipermail/rules-users/2010-November/017229.html
>> but
>> that does not seem to be the case.
>>
>> Underneath, you can find my drl file. This is the only artifact that I am
>> having right now. There is no Java code yet, apart from the Price object.
>> This shouldn't be necessary to fix the problem either.
>>
>> I tried to comment out some pieces of code to narrow down on the problem.
>> The nullpointerexception persists even if you comment everything from
>> "package" to the bottom of the file. This should indicate the problem has
>> to
>> be in the template header, but I do not have a clue.
>>
>> Could anyone help with this?
>>
>> Thanks in advance.
>>
>> ======================================================================
>>
>> template header
>> minimumValue
>> maximumValue
>> precision
>> startlevel
>> endlevel
>> roundingvalue
>>
>> package rounding
>>
>> import rounding.Price;
>>
>> template "Determine evaluated decimals"
>> rule "Determine evaluated decimals @{row.rowNumber}"
>>        salience 25
>>        lock-on-active true
>>        when
>>                $price: Price(integerpart >= @{minimumValue} &&
>> integerpart
>> <
>> @{maximumValue} && evaluateddecimals == 9999999)
>>        then
>>                $price.setRoundedPrecision(@{precision});
>>                $price.calculateNumberOfRoundedDecimals();
>>                $price.calculateEvaluatedDecimals();
>>                $price.calculateBasenumber();
>>                update($price);
>> end
>> end template
>>
>> template "Determine rounding value"
>> rule "Determine rounding value @{row.rowNumber}"
>>        salience 0
>>        no-loop true
>>        when
>>                $price: Price(integerpart >= @{minimumValue} &&
>> integerpart
>> <
>> @{maximumValue} && evaluateddecimals >= @{startlevel} &&
>> evaluateddecimals
>> <
>> @{endlevel})
>>        then
>>                $price.setRoundedPrice($price.getBasenumber() +
>> @{roundingvalue});
>>                System.out.println($price.getPrice() + " => " + (double)
>> $price.getRoundedPrice() /
>> Math.pow(10,$price.getNumberofroundeddecimals())
>> );
>> end
>> end template
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/Rule-Templates-tp2820139p2820343.html
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 


--
View this message in context: http://drools.46999.n3.nabble.com/Rule-Templates-tp2820139p2820731.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list