[rules-users] Test for null object, not null property

Edson Tirelli tirelli at post.com
Tue Aug 14 10:02:38 EDT 2007


   I don't think it makes sense to assert null into working memory... null
does not matches any object type anyway...
   Maybe what you want to do is to check for the non-existance of a fact:

when
    not Building()
then
   ...
end

   So, don't ever assert null into working memory.

   Edson

2007/8/14, Stuart Moffatt <stuart.moffatt at utah.edu>:
>
> The incoming building was initialized like this:
>
> Building building = null;
> FactHandle buildingFact = businessRuleSession.insert( building );
> businessRuleSession.setFocus("validate delete or get building");
> businessRuleSession.fireAllRules();
>
> Can drools test for this null building?
> What should the rule look like?
>
> rule "building is null"
>     agenda-group "validate delete or get building"
>     salience 10
>     when
>         boException : BOException()
>         Building() == null  /* this is the problem here -- not sure what
> this should look like */
>     then
>         boException.setCode("BO-0008");
> end
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070814/e588d115/attachment.html 


More information about the rules-users mailing list