Questions tagged [mvel]

MVEL is a powerful expression language for Java-based applications.

MVEL is a powerful expression language for Java-based applications.

201 questions
1
vote
2 answers

How do I avoid MVEL PropertyAccessExceptions

How do you get around PropertyAccessExceptions when the top level key in the hash map may or may not exist? In the example below, if the property exists, it works just fine, but if the property does not exist in the variable map, it throws a…
mcampster
  • 47
  • 5
1
vote
0 answers

drools doesn't recognize ! with custom operators

I am getting issue when i use ! along with drools string operations like matches, str[startsWith] . Any idea why drools doesn't allow ! with operators like matches , not matches, str[startsWith], str[endsWith], length The ! works for other…
1
vote
2 answers

How to evaluate if a value is in a list of values in DROOLS

In DROOLS, if we are looking to see if the value "foo" is in the list {fu, fa, fe, fi, fo, foo, fum, doodle, dee}, when MVEL parses that into a DRL we get something like this: if("foo" == "fu" || "foo" == "fa" || "foo" == "fe" || ...) Which is fine…
JTryon
  • 33
  • 2
  • 5
1
vote
1 answer

Drools unable to resolve logger

I have a rule similar to the below one. When I use logger.debug in THEN sections of the rule, it works and not while I use it in WHEN sections. Any ideas why? package com.util; import com.rulemodel.*; global org.slf4j.Logger logger; rule "My…
Spear A1
  • 525
  • 1
  • 7
  • 20
1
vote
2 answers

Easy-Rules Rule engine, cannot fire on multiple facts at once

I am trying to extend the Shop Tutorial for easy rules (shop) to run on multiple facts. While writing the conditions in the rule we call functions using the "fact name" as below, condition: "people.isAdult() == false" Since, people is just the name…
E.Bülbül
  • 39
  • 1
  • 9
1
vote
0 answers

Loop over the properties of member variable for conditional check in MVEL

Member variable categories must have MAIN type and url. Stream boolean mainCatImage=categories.stream() .anyMatch(categories -> categories.getType() .equals("MAIN") && StringUtils.isNotBlank(categories.getUrl())); I have rewritten the same…
Patan
  • 17,073
  • 36
  • 124
  • 198
1
vote
1 answer

Drools MVEL Dialect - Semi-Colon Requirement

I am just curious as to why my Eclipse Drools compiler (6.5.0) requires semi-colons at the end of statements in the For loop, as below: Map businessRulesRequest = $root.containsKey("BusinessRulesRequest") ? $root.get("BusinessRulesRequest") :…
Neil
  • 413
  • 4
  • 22
1
vote
2 answers

Comparing a field in a List of objects with a List of Strings in Drools

Assume I have a Policy object in Drools, that object contains a List of Cover objects, called covers and a List of String objects, which are called requestedCovers. The Cover object contains type field, which is a String object. I want to fire a…
Martijn Burger
  • 7,315
  • 8
  • 54
  • 94
1
vote
1 answer

Can't import static method using MVEL

According to MVEL's documentation, it's possible to import static java methods in a script: http://mvel.codehaus.org/Programmatic+Imports+for+2.0 . The following example is taken from that page, however is not working (I get an Error: unable to…
Óscar López
  • 232,561
  • 37
  • 312
  • 386
1
vote
1 answer

Mule expression language unable to resolve method

I'm having an issue with this : package com.acme; Class CircuitBreakerUtil { public static boolean canAttempt(String breakerName) { return true; } } my spring declaration
Pat B
  • 1,915
  • 23
  • 40
1
vote
1 answer

Intercept input and output of each function in an MVEL expression

I am quite new to MVEL. What I am trying to achieve is to log input and outputs of every function in an expression. For example, having the following expression h.function1('value1') != h.function2('value2') what I am trying to log is the input…
riccardo.cardin
  • 7,971
  • 5
  • 57
  • 106
1
vote
1 answer

MVEL case-insensentive

anybody knows how to adjust MVEL to use case-insensetive comparison? Map map = new HashMap<>(); map.put("Name", "Igor"); String property = "name"; Object res = MVEL.eval(property, map); System.out.println(res); In this case I got…
idmitriev
  • 4,619
  • 4
  • 28
  • 44
1
vote
1 answer

String replace for Roman numerals

I am getting user Input like following. "Both ix is viii are roman numeral. mcmlxxxvii is wow year. Year is mmxvi." I have to search all roman numerals present in i/p and convert it to upper case. So i want to use string replace like below where xxx…
1
vote
1 answer

Does MVEL or Drools cannot resolve fact that its type is Map>?

my rules are just like this: rule "calcitonin evaluation" lock-on-active true salience 0 when $p : Patient($labtestItem : labtests.get("calcitonin").get("0")) LabTestItem($result : result.substring(1,(result.length)-1),…
Young Harry
  • 97
  • 2
  • 14
1
vote
1 answer

MVEL Expression not evaluating properly when pre-compiled

Lets assume a, b are integers, and pets is of type HashMap When I pre-compile the expression below, the pets.containsKey(\"Dogs\") node is a null inside the CompiledExpression object. CompiledExpression compiledExpression = new…
Ramie
  • 1,171
  • 2
  • 16
  • 35