[rules-users] Driving License application

Mauricio Salatino salaboy at gmail.com
Tue Dec 24 05:13:48 EST 2013


Yeah, that will do the work.



On Tue, Dec 24, 2013 at 10:34 AM, seyfullah <seyfullahtikic at 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-tp4027403p4027407.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
>



-- 
 - MyJourney @ http://salaboy.com <http://salaboy.wordpress.com>
 - Co-Founder @ http://www.jugargentina.org
 - Co-Founder @ http://www.jbug.com.ar

 - Salatino "Salaboy" Mauricio -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20131224/8407d141/attachment-0001.html 


More information about the rules-users mailing list