Yeah, that will do the work.
On Tue, Dec 24, 2013 at 10:34 AM, seyfullah <seyfullahtikic(a)outlook.com>wrote:
Ok, I changed my drl file and main method as follows, and it works.
Thank
you.
package MyPackage
import MyPackage.Applicant;
rule "Is of not valid age"
when
$a : Applicant( age < 18 )
then
$a.setValid ( false );
end
rule "Is of valid age"
when
$a : Applicant( age > 17 )
then
$a.setValid ( true );
end
KieServices kieServices = KieServices.Factory.get();
KieContainer kContainer =
kieServices.getKieClasspathContainer();
StatelessKieSession kSession =
kContainer.newStatelessKieSession();
Applicant applicant = new Applicant("Mr John Smith", 16);
assertFalse( applicant.isValid() );
kSession.execute( applicant ) ;
assertFalse ( applicant.isValid() );
Applicant applicant2 = new Applicant("Mr Bill Wayne", 22);
assertFalse( applicant2.isValid() );
kSession.execute( applicant2 ) ;
assertTrue ( applicant2.isValid() );
--
View this message in context:
http://drools.46999.n3.nabble.com/Driving-License-application-tp4027403p4...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users