Re: [rules-users] nested condition in from collect
You're right, it worked without the eval and I did have the import. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/nested-condition-in-from-collect-tp1637479p1646029.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] nested condition in from collect
I'm trying to determine if a user has a certain immunization on record or a group of immunizations but when I attempt to put additional the rule will not compile. rule "Immunizations_Determine if a user has a valid tetanus immunization" dialect 'mvel' no-loop true salience 100 when $user : User($profile : profile) $got : List() from collect ( UserImmunization( immunization != null, eval( immunization.immunizationName == "Td or Tet/Dip (Tetanus/Diphtheria)" || immunization.immunizationName == "Tdap (Tetanus/Diphtheria & Pertussis)" || immunization.immunizationName == "DT (Diphtheria/Tetanus)" || immunization.immunizationName == "TT or Tet Tox (Tetanus Toxoid)" || immunization.immunizationName == "Tetanus")) from $profile.userImmunizations ) then System.out.println("The user has has a valid tetanus immunization "); end The profile contains a list of UserImmunizations. UserImmunizations: private Long id; private Immunization immunization; private Date dateReceived; Immunizations: private Long id; private String immunizationName; I'm not sure if this is a good place to use 'from accumulate'. Is it possible to do the condition for the Immunization object within the 'from collect' or should it be evaluated separately? -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/nested-condition-in-from-collect-tp1637479p1637479.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] LHS compare two lists
That worked perfectly. Thank you so much. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/LHS-compare-two-lists-tp1521979p1525468.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] LHS compare two lists
Hi, I'm trying to determine if a user has the required certifications for a position. So I'm comparing the list of required certifications to the list of User Certifications but I'm throwing a nullPointerException even though I check to make sure the list are not null on their respective objects. How do I iterate between both list? rule "Determine if the user has the required certifications" dialect 'mvel' no-loop true salience 80 when $user : User() $profile : UserProfile($userCertifications : userCertifications, eval(userCertifications != null)) from $user.userProfile $position : Position($certifications : requiredCertifications, eval(requiredCertifications != null)) exists ($certification: Certification() from $certifications and UserCertification(certification == $certification) from $userCertifications) then System.out.println("The user has the required certifications"); end public UserProfile { List userCertifications; //more fields } public Position { List requiredCertifications; //more fields } public Certification { Long id; String name; //more fields } public UserCertification { Long id; Date certificationDate; Certification certification; //more fields } -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/LHS-compare-two-lists-tp1521979p1521979.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Verify if an objects attribute exists
Sorry here is some additional details...I hope I'm not making this sound more complicated than it really is but I am attempting to restrict access to view an account based on the logged in user. public class User { private Long id; ... private UserProfile userProfile; } public class UserProfile { private Long id; private User supervisor; } So I created a function called isUserMatching to determine if the currentUser is looking at their own account or if their supervisor is looking at an employees account: function boolean isUserMatching(User user) { User currentUser = (User) Component.getInstance("currentUser"); User supervisor = (User) user.getUserProfile().getSupervisor(); boolean result = false; if(currentUser == user) { System.out.println("## currentUser = user is TRUE #"); result = true; } else if((supervisor != null) && (currentUser.getId().equals(supervisor.getId( { System.out.println("## currentUser = supervisor is TRUE #"); result = true; } else { System.out.println("## currentUser/supervisor != user is FALSE #"); } return result; } This function works as desired but not all users have a supervisor. What I'd like to know is how can I check if a supervisor is null so that I can prevent passing null values into functions? Doing this "eval (isUserMatching($supervisor))" results in an runtime error of course when there is no supervisor. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Verify-if-an-objects-attribute-exists-tp1455073p1470638.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Verify if an objects attribute exists
I'm having difficulty writing this rule. Background information: A User can have a supervisor but it's not required. When viewing User information I want to verify that the logged in user is either the current user or the currentUser's supervisor but I throw an exception when the supervisor object is null on the currentUser. The target is the User being viewed and I have a global object that is the current user. How can I check to see if the supervisor exists before evaluating if the currentUser and the supervisor are equal? rule 'CanViewUserData' dialect 'mvel' when $user : User() $supervisor : User( ) from $user.userProfile.supervisor $check: PermissionCheck(target == $user, action == "viewUserData") eval(isUserMatching($user)) || eval (isUserMatching($supervisor)) then System.out.println("The currentUser CanViewUserData"); $check.grant(); end -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Verify-if-an-objects-attribute-exists-tp1455073p1455073.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Drools 5.1.1 KnowledgeAgent and SecurityRules
I recently upgraded from drools guvnor 5.0.1 to 5.1.1 but I haven't seen any examples on how to change securityRules now that RuleBase has been replaced with KnowledgeBase. Originally I had... https://127.0.0.1:7002/drools-guvnor-5.0.1/org.drools.guvnor.Guvnor/package/Security/LATEST"; local-cache-dir="/tmp/" poll="60" auto-create="true"/> I tried to leave this way but then i get an error but the 5.1.1 guvnor secures the URL so I get the following: RuleAgent(default) EXCEPTION Response: '401: Unauthorized' for url: ... How do configure the application security to use the KnowledgeBase? -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-5-1-1-KnowledgeAgent-and-SecurityRules-tp1445839p1445839.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] create .pkg file with or without BRMS
I think the DroolsCompilerAntTask generates a serialized RuleBase, not a Package. Linh Arnaud Bouzinac wrote: > > Hi, > > I'm using BRMS to generate a .pkg for an application > > i need to generate the same file without BRMS: > i'm trying to use a drools-ant task, but, pkg file generated with > drools-ant > task is not the same !!! > i don't found a specific documentation to do that ? > > Somebody can help me please ? > > thanks for your help > > > > > > > > > > > > > > > > /> > > > srcdir="${eclipsepath}../rules/" > tofile="${eclipsepath}../rules/FLIResultsUpdateRules.pkg" > classpathref="qirules.classpath" > > > > > > > > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > > -- View this message in context: http://www.nabble.com/create-.pkg-file-with-or-without-BRMS-tf4803289.html#a13749958 Sent from the drools - user mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How to get the Eclipse Rules View to show my rules?
Thanks for your reply. After converting to a Drools project, I now get the "Only a type can be imported" errors on all my import statements in the DRLs (and other errors as consequences of that). I compare the structures of my project to the examples and can't find much different. What do you think I'm still missing? (As a Java project, the project still works fine. All my jUnit tests still run ok) Thanks. Linh ekke wrote: > > have you tried your-eclipse-project - right-click - convert to Drools > project ? > ekke > > LNguyen wrote: >> >> Hello everyone, >> >> I'm using Drools 4.0.3 and Eclipse 3.3. The Rules View shows the rules >> in the drools-examples-drl package, but not my own rules. >> >> Is there any configuration or registration needed for the Rules View to >> recognize my rules? The rest of Drools work fine. >> >> TIA >> Linh >> > > -- View this message in context: http://www.nabble.com/How-to-get-the-Eclipse-Rules-View-to-show-my-rules--tf4800253.html#a13736443 Sent from the drools - user mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] How to get the Eclipse Rules View to show my rules?
Hello everyone, I'm using Drools 4.0.3 and Eclipse 3.3. The Rules View shows the rules in the drools-examples-drl package, but not my own rules. Is there any configuration or registration needed for the Rules View to recognize my rules? The rest of Drools work fine. TIA Linh -- View this message in context: http://www.nabble.com/How-to-get-the-Eclipse-Rules-View-to-show-my-rules--tf4800253.html#a13733594 Sent from the drools - user mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Can a rule be assigned both agenda-group and ruleflow-group ?
Hi everybody: I would like to use Drools to capture validation logics that will be shared at UI level and back-end level. That is, I need to fire a specific rule on-demand to validate a field input and fire it again as part of the final validation. To fire a specific rule, I use the agenda-group attribute. To fire it again as part of a larger group, I then try to create a ruleflow. I found that if I add a ruleflow-group to a rule, it's can no longer be fired by setFocus(). Is that normal, or I did something wrong? I thought of creating a ruleflow for each rule, but that sounds like a hack to me, Drools probably offer a more elegant solution (I'm only 2 wks into Drools). What is best way to implement my problem: to fire a rule individually and to fire it again as part of a group? TIA Linh -- View this message in context: http://www.nabble.com/Can-a-rule-be-assigned-both-agenda-group-and-ruleflow-group---tf4772952.html#a13653679 Sent from the drools - user mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users