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
5
votes
2 answers

MVEL2 on android throws exception

Did anyone has experience with MVEL2 on android? i've tried out the same code with a simple java program and later on android: The following exception is thrown when executed on android: E/AndroidRuntime(30793):…
4
votes
2 answers

How to call an external method from within an MVEL expression?

I have a JAVA class that has two methods. The first one is the main method and the second one is method1(). Let's say the following is the class: public class SomeClass() { public static void main(String[] args){ …
Anuj
  • 97
  • 1
  • 9
4
votes
1 answer

Error translating mvel script to groovy

While preparing for an update to elasticsearch 2.0, I noticed mvel scripting is being deprecated in favor of groovy. My problem is that I am new to groovy and don't know how to fix this error. boolean engineTest = false; if (!engineTest) {…
Danny
  • 77
  • 4
4
votes
2 answers

Optional Parameter in MVEL Functions

Is there a way to get MVEL 2.0 ( http://mvel.codehaus.org/ ) to work with functions with optional parameters? I would like to be able to eval this: trunc('blahblah',2) but also trunc('blahblah',2,'[...]'); Now i have tried: def…
JP-Ulm
  • 181
  • 1
  • 2
  • 6
4
votes
1 answer

Drools: Differences between the mvel and java dialects

As a newbie to Drools, I'm confused about the differences between the mvel and java dialects and the relative pros and cons of using either. After some initial research, I came across some discussions here, and here. What other differences are…
dshgna
  • 812
  • 1
  • 15
  • 34
4
votes
2 answers

ElasticSearch Get Time in Groovy Script

My application is using this script for boosting more recent items in the index: (5 / ((3.16*pow(10,-11)) * abs(time() - doc[\'date\'].date.getMillis()) + 0.2)) + 1.0 It's written in MVEL, but as of 1.3, MVEL is deprecated for Groovy. The script…
Jonah
  • 9,991
  • 5
  • 45
  • 79
4
votes
1 answer

Boolean value scripting issue with MVEL and Elasticsearch

I have a field mapping defined as {"top_seller":{"type":"boolean"}} In my query, I'm trying to do a custom score query based on the boolean value. I'm pulling my hair out. Every time I run a script such as this: return…
J.T.
  • 2,606
  • 15
  • 31
4
votes
1 answer

How do I get the count/size of an array in elasticsearch

I want to do a statistical facet on one of my arrays. I hope something like "script" : "doc['myField'].doubleValue or "script" : "doc['myField'].count would work. I havent found any array count method in mvel and I don't even know if accessing the…
Alden
  • 312
  • 5
  • 13
3
votes
1 answer

How to parse the templated sentence "#{name} invited you" using expression language

I am a new bee to Java. My intension is to use the template like sentences in Java program (no JSP or any web related pages) Example: String name = "Jon"; "#{ name } invited you"; or String user.name = "Jon"; "#{ user.name } invited…
Jon
  • 2,703
  • 3
  • 18
  • 14
3
votes
1 answer

How to use variables inside an MVEL expression?

I have pre-defined variables in my Java code which I want to use inside an MVEL expression. I don't want to pass a context. String Col1 = "C"; String Col2 = "D"; String expression = "Col1 == 'C' && Col2 == 'D'"; Boolean result = (Boolean)…
Kishan Khatanhar
  • 63
  • 1
  • 1
  • 9
3
votes
1 answer

How to pass arguments to a function written inside an MVEL expression?

I have a JAVA class that has two methods. The first one is the main method and the second one is method1(). Let's say the following is the class: public class SomeClass() { public static void main(String[] args) { SomeClass myObj = new…
Anuj
  • 97
  • 1
  • 9
3
votes
2 answers

How to do a minus operation on time-stamps in elasticsearch?

I have some server logs dumped into elasticsearch. The logs contain entries like 'action_id':'AU11nP1mYXS3pt6INMtU','action':'start','time':'March 31st 2015, 19:42:07.121' and 'action_id':'AU11nP1mYXS3pt6INMtU','action':'complete','time':'March 31st…
lingxiao
  • 1,214
  • 17
  • 33
3
votes
2 answers

Extract all particular field from JSON in mule esb

I have this json payload, I would want to collect all externalListingId in one shot - { "listings": { "numFound": 3, "listing": [ { "status": "INACTIVE", "pricePerTicket": { "amount": 100, …
user3483129
  • 137
  • 6
  • 18
3
votes
1 answer

MVEL - Error: could not access field in ReflectiveAccessorOptimizer

I am newbie to MVEL. Following steps I followed 1) Downloaded latest from http://mvel.codehaus.org/Downloading+MVEL i.e. Download mvel2-2.2.0.jar (JDK 1.5+ required) 2) Created a simple list of custom obj class TestMVEL { public static…
prash
  • 896
  • 1
  • 11
  • 18
3
votes
2 answers

Mvel evaluation

Problem Statement: Say I have a expression (a + b + c), and I want to calculate its value and assign to some variable. Later I want use that variable value in some other logic. This is all done through MVEL. Issue is if anyone out of (a,b,c) is…
Ankur Singhal
  • 26,012
  • 16
  • 82
  • 116
1
2
3
13 14