MVEL Expression Language Studio
MVEL Expression Language Studio
Table of Contents
1 MVEL Expressions................................................................................................... 5
1.1 Naming Conventions................................................................................................5
1.2 MVEL Autocomplete:............................................................................................... 5
1.3 MVEL 2.x expressions............................................................................................. 6
2 Operators...................................................................................................................8
2.1 Unary Operator:....................................................................................................... 8
2.2 Comparison Operator...............................................................................................8
2.3 Logical Operators...................................................................................................10
2.4 Arithmetic Operators..............................................................................................11
2.5 Other Operators.....................................................................................................12
3 Assignment............................................................................................................. 13
3.1 Literals:.................................................................................................................. 13
3.2 Difference b/w Assignment and Equal...................................................................14
4 Launch Parameter:................................................................................................. 15
4.1 Simple Type Parameter:........................................................................................ 15
4.2 Reference Type Parameter:...................................................................................16
4.3 Convert Array Values to String...............................................................................17
4.4 Date From Launch Parameter................................................................................19
5 Integration Attributes:............................................................................................20
5.1 Simple Type Parameter:........................................................................................ 20
5.2 Reference Type Parameter:...................................................................................20
5.3 Convert Array Values to String...............................................................................20
6 Integration MAP.................................................................................................22
7 Sequence Generator...............................................................................................24
8 Da: Document Accessor(To retrieve Input File)...................................................25
9 Evaluate Xpath: parts[]........................................................................................26
9.1 Format Date........................................................................................................... 26
9.2 Format Number......................................................................................................27
9.3 Right/Left Justification (Padding)...........................................................................27
10 Mvel Functions........................................................................................................28
10.1 Substring............................................................................................................. 28
10.2 Index of................................................................................................................28
10.3 Substring-before..................................................................................................29
2
MVEL Expression Language
10.4 Substring-after.....................................................................................................29
10.5 Replace or Translate...........................................................................................29
10.6 Contains.............................................................................................................. 29
10.7 Normalize space:.................................................................................................29
10.8 Length:................................................................................................................ 30
10.9 Concat................................................................................................................. 30
10.10 Substring and Contains.................................................................................... 30
10.11 Equal Ingnore Case:.........................................................................................30
10.12 Aggregate Function.......................................................................................... 30
10.13 Lowercase........................................................................................................ 31
10.14 UpperCase:.......................................................................................................31
10.15 Starts With........................................................................................................31
10.16 Ends with.......................................................................................................... 31
10.17 Clear and remove.............................................................................................32
10.18 Append............................................................................................................. 32
11 Control Flow: MVEL Expression Capabale Property:..........................................33
11.1 if...........................................................................................................................33
11.2 If else...................................................................................................................33
11.3 else if................................................................................................................... 33
12 Ternary Operator:................................................................................................... 34
12.1 Ternary statements:............................................................................................ 34
12.2 Nested Ternary Statements:................................................................................34
13 Hash Map and Array list.........................................................................................35
13.1 Hash Map............................................................................................................35
13.2 Array List to Hash Map........................................................................................35
13.3 List to For Loop................................................................................................... 36
13.4 Remove Duplicates Using Array List...................................................................37
13.5 CleanUp or remove Hash Map............................................................................37
14 MVEL Template Capabale Property on webservice.............................................39
14.1 Foreach-Statement Example on webservice.......................................................39
14.2 If-Statement Example on webservice..................................................................39
15 Before and After Splitter........................................................................................40
15.1 Last Row or Employee in Batch..........................................................................40
15.2 To find total employees from input file.................................................................40
15.3 To find Success count on employee incase of inbound......................................40
15.4 To find Error Count on employee incase of inbound...........................................40
3
MVEL Expression Language
4
MVEL Expression Language
1 MVEL Expressions
MVEL is an incredibly powerful expression language which is tightly integration into the
Workday ESB's Assembly framework. With MVEL is it possible to construct powerful
and flexible expressions for manipulating Assembly context variables and associated
Java objects, but as ever, with great power comes great responsibility!
1.1 Naming Conventions
A large number of properties are added to the mediation context by the ESB and some
of the shared components. Prefixing the properties you declare within your integration
name will making them easier to find when debugging the assembly and add a
conceptual scope to the properties. For example:
props['payforce.company.name']
If you set properties to contain the values of integration attributes, use "ia" as the prefix.
For example:
props['ia.include.job.code']
For Launch parameter : props['lp.include.job.code']
Always ensure that your property names are meaningful. Do not be tempted to
abbreviate property names. Descriptive and meaningful property names aid readability,
and reduce the overall cost of maintaining the code over subsequent revision.
Need help with the syntax of particular operations or with the names of
elements in your flow?, you can always access MVEL suggestions by
pressing Ctrl + Space Bar.
5
MVEL Expression Language
Property expressions
Boolean expressions
Method invocations
Variable expression
Function definitions
context.getProperty('myProperty')
6
MVEL Expression Language
The following expression returns the property value set by a custom Spring bean:
Syntax for property: props['bean.property']
You may write scripts with an arbitrary number of statements using the
semi-colon to denote the termination of a statement. This is required in all
cases except in cases where there is only one statement, or for the last
statement in a script.
statement1; statement2; statement3
Syntax:
vars['payroll.payee.in.extract']
props[‘user.name’] = vars['payroll.payee.in.extract']
7
MVEL Expression Language
8
MVEL Expression Language
2 Operators
10 == 10 then true
9
MVEL Expression Language
Less Than Check. Checks to see if the value on the left side of the operator is
less than value
props['count'] = 10; on the right.
props['employee.count'] =5
2.2.7 Contains
Value Containment Check. Checks to see if the value on the left contains the value on
the right
2.3.2 Logical OR : ||
Logical OR. Checks to see if either the value on the left or the right is true.
props['count'] || props['employee.count']
11
MVEL Expression Language
2.3.3 Chained OR : or
Chained OR. Checks a sequence of values for emptiness and returns the first non-
empty value
props['count'] = 'Employee' props['employee.count'] = 'Contingent'
Result: props['emp'] = 'Employee' since first property has value so it won’t check next property.
Result: props['emp'] = 'Contingent' since first property is null So it checked next property and
returned it value.
2.4.1 Addition: +
props['count'] = 10; props['employee.count'] = 5
Result: props['emp'] = 15
2.4.2 Subtraction: -
props['count'] = 10; props['employee.count'] = 5
Result: props['emp'] = 5
12
MVEL Expression Language
2.4.3 Division: /
props['count'] = 4; props['employee.count'] = 2
Result: props['emp'] = 2
2.4.4 Multiplication: *
props['count'] = 4; props['employee.count'] = 2
Result: props['emp'] = 8
2.4.5 Modulus: %
props['count'] = 9; props['employee.count'] = 4
props['emp']="Contingent"; props['emp1']="Worker"
2.5.3 Assignment: =
Assignment. Assigns the value on the right to the variable on the left.
props['num'] = 12
props['num'] = true
props['emp'] = ''
14
MVEL Expression Language
3 Assignment
MVEL allows you assign variable in your expression, either for extraction
from the runtime, or for use inside the expression.
3.1 Literals:
3.1.1 Strings
props[‘user.name’] = '<hello>world</hello>'
props['employee_id_string'] = '<wd:Employee_Reference><wd:Integration_ID_Reference><wd:ID
wd:System_ID="WD-EMPLID">' + props['file_empid'] +
'</wd:ID></wd:Integration_ID_Reference></wd:Employee_Reference>'
Assigning mimeType:
15
MVEL Expression Language
3.1.2 Numerics
Assigning Numeric Value:
props['count'] = 0
3.1.3 props['count']
Boolean = 1+2
Boolean literals are represented by the reserved keywords true and
false.
props['count'] = true
props['count'] = false
props['count'] = null
props['count'] = nil
props['count'] = ''
props['count'] = empty
props['count'] = 0
props['count'] = empty
props['count'] = true
Equal: Here checking or testing this property is equal to that value or not
16
props['count'] == 0
MVEL Expression Language
17
MVEL Expression Language
4 Launch Parameter:
Mvel helper class is lp: Provides access to the integration launch parameters.
The lp variable is only applicable to Workday internal server and integration
Cloud developers.
Mvel helper class for launch parameter is lp and to get data from simple type launch
parameter need to use getSimpleData('label') and here label should be your
prompt name “Tax Frequency Value”.
Type lp. then press CNTRL + Space Bar then you will get all related
methods.
EG: lp.getSimpleData('label')
if we want to pass this below simple type prompt property value to Raas
Report prompt should convert it to string then you call this property to raas
call to give input to your raas report prompt.
props['lp.cc.wid']=lp.getSimpleData('Cost Centers')
props['get.cc.wid.prompt'] = props['lp.cc.wid'].toString()
18
MVEL Expression Language
@{intsys.reportService.getExtrapath('costcenterpromptvaluegiven')}?Cost_Center!
WID=@{props['get.cc.wid.prompt']}
Reference Type Parameter is nothing but prompt on your webservices fields. By clicking
yellow arrow mark in the below screenshot you can access webservice fields. There to
find the fields directly you can select CRF(class report fields) and you can type the fields
on search bar or else you can take it by expanding the webservice requests.
19
MVEL Expression Language
or
To convert an array list to a string, the following can be used (Array of Workers
converted to a string to be used in a REST URL for RaaS):
20
MVEL Expression Language
To get the multiple values or list of values selected in Launch Parameter prompt use below
methods :
or
output: [6cb77610a8a543aea2d6bc10457e35d4,
bc33aa3152ec42d4995f4791a106ed09, 80938777cac5440fab50d729f9634969,
c4f78be1a8f14da0ab49ce1162348a5e]
Should convert this output format to following format which would be supported by raas
report. To convert as below should use below property.
6cb77610a8a543aea2d6bc10457e35d4!bc33aa3152ec42d4995f4791a106ed09!
80938777cac5440fab50d729f9634969!c4f78be1a8f14da0ab49ce1162348a5e
props['get.cc.wid.prompt']=props['lp.cc.wid']!=empty?
util.listToCommaDelimString(context.getProperty('lp.cc.wid')).replace(',','!') : null
21
MVEL Expression Language
should pass this property props['get.cc.wid.prompt'] to raas Report now. will now be a
string of cost center WIDs. The commas (,) are replaced by exlamation marks (!) as this
is how you separate IDs in a REST URL for Workday RaaS end points.
output: 6cb77610a8a543aea2d6bc10457e35d4!bc33aa3152ec42d4995f4791a106ed09!
80938777cac5440fab50d729f9634969!c4f78be1a8f14da0ab49ce1162348a5e
@{intsys.reportService.getExtrapath('costcenterpromptvaluegiven')}?Cost_Center!
WID=@{props['get.cc.wid.prompt']}
customreport2/medtronic4/jthangaraj/MyCustomReport?CostCenters!
WID=6cb77610a8a543aea2d6bc10457e35d4!
bc33aa3152ec42d4995f4791a106ed09!
80938777cac5440fab50d729f9634969!c4f78be1a8f14da0ab49ce1162348a5e
props['date'] = lp.getDate('label')
22
MVEL Expression Language
props['lp.lastsuccessful.date']=props['lp.lastsuccessful.datetime'].substring(0,10)
23
MVEL Expression Language
5 Integration Attributes:
Mvel helper class is intsys: Provides access to the integration system configuration
for this assembly.
Syntax: props['sftpEndPoint']=intsys.getAttribute('label')
props['sftpEndPoint']=intsys.getAttribute('SFTP Endpoint')
props['ia.run.category']=intsys.getAttributeReferenceData('RunCategoryType','Run_Category_ID')
or
props['ia.run.category']=intsys.getAttributeReferenceData('RunCategoryType','WID')
24
MVEL Expression Language
To convert an array list to a string, the following can be used (Array of Workers
converted to a string to be used in a REST URL for RaaS):
To Access Reference type multi instance integration attribute prompt,
intsys.getAttributeReferenceDataList ('label', 'type') or intsys.getWIDs('label')
method should be used.
props['ia.ledger.account.no.emp'] = intsys.getAttributeReferenceDataList('Ledger Account No
Employee Detail', 'WID')
xmlns:is="java:com.workday.esb.intsys.xpath.ParsedIntegrationSystemFunctions"
is:getIntegrationAttributeValue('Entity Name')
(note the alternative mechanism for passing attribute values into XSLT in the
next paragraph):
25
MVEL Expression Language
26
MVEL Expression Language
6 Integration MAP
Syntax:
simpleTextTypeMap
enumTypeMap
referenceTypeMap
Syntax:
simpleTextTypeMap
27
MVEL Expression Language
enumTypeMap
props['ia.enum.map'] = intsys.integrationMapReverseLookup('enumTypeMap', 1)
referenceTypeMap
In XSLT or STX, first declare the "is" namespace in stylesheet: Then call the method
from an XPath expression
xmlns:is="java:com.workday.esb.intsys.xpath.ParsedIntegrationSystemFunctions"
is:getIntegrationMapValue('Time_Off_Codes','Time_Off_Type_ID')
(note the alternative mechanism for passing attribute values into XSLT in the next
paragraph):
<xsl:value-of select="$ia.simple.map"></xsl:value-of>
28
MVEL Expression Language
29
MVEL Expression Language
7 Sequence Generator
which you can use to generate unique, sequenced file names. If your integration system
needs to create a different file name each time it runs, you can associate a sequence
generator service with your Workday-in transport to generate the file name. You define
the service with one or more named sequencers in Studio, then configure the
sequencers in Workday.
props['lp.batch.id.seq'] = lp.getSequencedValue('label')
props['lp.batch.id.seq'] = lp.getSequencedValue('BatchIDSequence')
30
MVEL Expression Language
Within a Workday Studio integration, you can use the Document Accessor
(da) variable within an eval step's MVEL expression to access a document or
input file from tenant or some sftp server.
The following example gets a document from the Integration Event with filename
eib_transform_output.txt and adds is as a variable named var1:
da.toVar('eib_transform_output.txt', 'var1')
or
31
MVEL Expression Language
For example, to get the content of first attachment, the root part:
parts[0].text
parts[1].text
props['eval.xpath']=parts[0].xpath('/env:Envelope/env:Body/wd:Get_Workers_Response/wd:Response_Data/
wd:Worker/wd:Worker_Data/wd:User_ID')
props['row.employee.id'] = parts[0].xpath('payment_Offcycle/EMPLID',props['namespace.row'])
To format a date using MVEL instead of XSLT, it can be done using the following
example (yyyy-MM-dd converted to MM/dd/yyyy):
props['p.input.date'] = '2013-10-03'
32
MVEL Expression Language
To format a number using MVEL instead of XSLT, it can be done using the following
example (##0.0000 converted to ##0.00):
Output: 0000001234
Output: 1234000000
33
MVEL Expression Language
10 Mvel Functions
10.1 Substring
Returns the substring from the start position to the specified length. Index of the first
character is 1 here. If length is omitted it returns the substring from the start position to
the end
Example: substring('Beatles',1,4)
Result: 'Beat'
For String:
props['lastupddttm'] = 'Beatles'
props['lastupd_dt'] = props['lastupddttm'].toString().substring(1, 4)
For Integer:
props['Birth.Date']=props['birth.date'].substring(0,10)
props['payment'] = parts[0].xpath("//Payment_Date").substring(2)
props['payment'] = 14-03-30T00:00:00.000-07:00
34
MVEL Expression Language
10.2 Index of
Returns the positions within the sequence of items that are equal to the
search item argument. Index starts with 0 here.
Result: 2
props['p.index.separator'] = parts[0].xpath("//Payment_Date").indexOf("-")
10.3 Substring-before
parts[0].xpath("//Payment_Date") returns 2014-03-30T00:00:00.000-07:00
props['p.index.separator'] = parts[0].xpath("//Payment_Date").indexOf("-")
props['p.substring.before']= parts[0].xpath("//Payment_Date").substring(0,props['p.index.separator']);
Result: 2014
10.4 Substring-after
props['p.index.separator'] = parts[0].xpath("//Payment_Date").indexOf("-")
props['p.substring.after']=parts[0].xpath("//
Payment_Date").substring(props['p.index.separator']+1);
props['Worker_Type'] = "Active_Worker"
input: gray12345-2014.pdf
props['p'] = gray12345-2014.pdf
35
props['p.cleaned'] = props['p'].replaceAll('[^0-9]','')
output: 123452014
You could then substring the first 5 characters:
10.7 Contains
Example: Employee Id is not a valid id contains not a valid id string then returns true
props['row.plan.id']= parts[0].xpath("normalize-space(/record/PLAN_ID)")
10.9 Length:
props['EmployeeID'] = '20558'
props['emp.length'] = (props['EmployeeID'].length()
Result: props['emp.length'] = 5
36
MVEL Expression Language
10.10 Concat
props['lp.batch.id.seq']= lp.getSequencedValue('BatchIDSequence').toString().concat(props['Location'])
props['payment']=parts[0].xpath("//Payment_Date").equalsIgnoreCase('2014')
Result: props['payment']= true (If it equals will return true otherwise false)
props['total.taxes.paid.processed']= parts[0].xpath("sum(//Total_SOT_Processed)")
10.13.2 Count
EG: Do count the number of nodes
props['multiple.state.tax.election']=parts[0].xpath("count(/Worker_Tax_Election/State_Tax_Election)")
count with namespace used:
props['total_message_count_from_report']=
parts[0].xpath("count(Cost_Center_Data/Cost_Centers)",props['namespace.row'])
37
MVEL Expression Language
10.14 Lowercase
props['lowercas']=parts[0].xpath('/Off-cycle_Input_Data/Deduction_Reference/ID').toLowerCase()
10.15 UpperCase:
props['lowercas'] =parts[0].xpath('/Off-cycle_Input_Data/Deduction_Reference/ID').startsWith('prefix')
props['lowercas'] =parts[0].xpath('/Off-cycle_Input_Data/Deduction_Reference/ID').startsWith('W')
EG: Word starts with W (Condition satisfies then returns true or else returns false).
props['lowercas'] =parts[0].xpath('/Off-cycle_Input_Data/Deduction_Reference/ID').endsWith('suffix')
props['lowercas'] =parts[0].xpath('/Off-cycle_Input_Data/Deduction_Reference/ID').endsWith('r')
EG: Colour ends with r (Condition satisfies then returns true or else returns false)
38
MVEL Expression Language
props['ap.worker.past.map'].clear()
props['p.ee.hash.map'].remove(props['p.employee.id'])
10.19 Append
props['ap.page.worker.wids.sb'] = new java.lang.StringBuilder()
if(props['worker.hired.exists']==false){props['ap.page.worker.wids.sb'].append(props['current.worker.wid']).append(',') }
39
MVEL Expression Language
11.1 if
11.2 If else
if(props['row.employee.id']!=props['last.employee.id']){props['worker.offcycle.priority.out']=0;}
else{props['worker.offcycle.priority.out']=empty;}
11.3 else if
Syntax:if(props['p.is.boolean']){/*dosomethinghere*/}elseif(props['row.employee.id']==props['last.employee.id']) {/*do
something here*/}else{/*do something here*/}
if(props['row.employee.id']!=props['last.employee.id'])
{ props['worker.offcycle.priority.out']=0;}elseif(props['row.employee.id']==props['last.employee.id'])
{props['worker.offcycle.priority.out']=1;}else{props['worker.offcycle.priority.out']=empty;}
40
MVEL Expression Language
41
MVEL Expression Language
12 Ternary Operator:
if props['count'] > 0 it returns Employee otherwise it will check whether props['count'] == 1 returns Contingent
Otherwise returns Worker
42
MVEL Expression Language
43
MVEL Expression Language
props['p.hash.key.value']=parts[0].xpath("wd:Report_Entry/wd:Employee_ID")
props['p.ee.hash.map'].put(props['p.hash.key.value'], parts[0].text)
After splitter Compare Input File with rass or websrvice call and get employee id:
props['p.employee.id']=parts[0].xpath("record/EmployeeID")
vars['p.ee.node']=props['p.ee.hash.map'].get(props['p.employee.id'])
if employee is found get custom id which is put along with employee id in hashmap
props['p.current.custom.id'] =if(vars['p.ee.node']!=empty){vars['p.ee.node'].xpath("wd:Report_Entry/wd:Custom_ID");}
Use this logic to convert an array into a single HashMap. In this example, we are just
checking that a value exists in the HashMap. A common use case is you only want to
process employees who are in a certain organization defined by an integration multi-
value attribute. If the Map returns a '1' value, this translates to a the get() being
successful
44
MVEL Expression Language
2) Get your Array list. In this case, it's a multi-value integration attribute
props['p.myAttributesList.count'] = props['p.myAttributeList'].size()
4) Loop through the Array for each p.myAttributesList.count and put the list values in the HashMap
foreach(x : props['p.myAttributesList.count']){props['p.myHashMap'].put(props['p.myAttributeList'].get(x-1),'1')}
Note:If we add or put our data to list or array list then only we can use for loop or for-
each statement in mvel expressions.
list = context.getProperty('list');
props['id']=parts[0].xpath('/Put_Payroll_Off-cycle_Payment_Request/Payroll_Off-cycle_Payment_Data/Payment_ID')
list.add(props['id']); context.setProperty('list',list);
After aggregator
list = context.getProperty('list');
45
MVEL Expression Language
props['excluded-dce'] = false
props['p.my.value']=parts[0].xpath("wd:Report_Entry/wd:Employee_ID")
if(!props['p.my.array.list'].contains(props['p.my.value'])) {props['p.my.array.list'].add(props['p.my.value']); }
When you need to check if the data exists, you can do the following which returns a boolean:
46
MVEL Expression Language
props['p.hash.key.value']=parts[0].xpath("wd:Report_Entry/wd:Employee_ID")
props['p.ee.hash.map'].put(props['p.hash.key.value'], parts[0].text)
props['p.remaining.keys'] = props['p.ee.hash.map'].keySet()
props['p.employee.id']=parts[0].xpath("record/EmployeeID")
vars['p.ee.node']=props['p.ee.hash.map'].get(props['p.employee.id'])
47
props['p.ee.hash.map'].remove(props['p.employee.id'])
MVEL Expression Language
48
MVEL Expression Language
<wd:Workday_Account_for_Worker_Update
xmlns:wd="urn:com.workday/bsvc"
wd:version="v21.1">
<wd:Worker_Reference>
@{props['employee_id_string']}
</wd:Worker_Reference>
<wd:Workday_Account_for_Worker_Data>
@if{(props['worker_status'] == 'Inactive' && props['company_reference_id'] == 'MNA' &&
props['ia_allow_inactive_accounts'] == true) || (props['worker_status'] == 'Active' && props['company_reference_id'] ==
'MNA') || (props['worker_status'] == 'Inactive' && props['ia_allow_inactive_accounts'] == true)}
<wd:Account_Disabled>true</wd:Account_Disabled>
@end{}
@if{props['worker_status'] == 'Active' && props['company_reference_id'] != 'MNA'}
<wd:Account_Disabled>false</wd:Account_Disabled>
@end{}
</wd:Worker_Reference>
</wd:Workday_Account_for_Worker_Update> 49
</env:Body>
</env:Envelope>
MVEL Expression Language
props['total.count'] =0
After Splitter
props['total.count'] = props['total.count'] + 1
props['total.count']=parts[0].xpath("count(/Worker_Tax_Election/State_Tax_Election)")
props['prop.success.count']=0
props['prop.success.count'] = props['prop.success.count'] + 1
props['prop.error.count'] =0
After handling send error component where we use our webservice request
props['prop.error.count'] = props['prop.error.count'] + 1
props['prop.percentage.change'] == true
props['prop.current.percentage']+'% complete.'
51
MVEL Expression Language
Va
ria Description Usage examples
ble
c Provides access to the The following expression gets the value of the
o MediationContext object, property myProperty on the MediationContext:
n which is the main context
t object used to pass context.getProperty('myProperty')
e information around in
assemblies. This class
x
contains various objects
t used to store and pass
the data between the
assembly components,
including:
MediationMessag
e
variables
properties
assembly audit
customer id
dynamic endpoint
52
MVEL Expression Language
Va
ria Description Usage examples
ble
env['cc.hostname']
epg.getStartDate('payGroupWid,
'periodWid')
epg.getEndDate('periodWid')
epg.getEndDate('payGroupWid,
'periodWid')
epg.getPaymentDate('periodWid')
epg.getPaymentDate('payGroupWid
', 'periodWid')
53
MVEL Expression Language
Va
ria Description Usage examples
ble
epg.getWIDForStartDate('date')
epg.getWIDForStartDate('payGrou
pWid', 'date')
epg.getWIDForEndDate('date')
epg.getWIDForEndDate('payGroupW
id', 'date')
epg.getWIDForPaymentDate('date'
)
epg.getWIDForPaymentDate('payGr
oupWid', 'date')
epg.getCurrentPeriod('date')
epg.getCurrentPeriod('payGroupW
id', 'date')
epg.getPreviousPeriod('date')
epg.getPreviousPeriod('payGroup
Wid', 'date')
epg.getNextPeriodReference()
epg.getNextPeriodReference('pay
GroupWid')
54
MVEL Expression Language
Va
ria Description Usage examples
ble
55
MVEL Expression Language
Va
ria Description Usage examples
ble
56
MVEL Expression Language
Va
ria Description Usage examples
ble
exists.
wd.launchparameters
variable. An integration lp.getSimpleData('label'), which
can also construct the only applies to parameters of simple
wd:Launch_Integrati type, such as string, date, or number.
on_Event_Data XML
message in the case of lp.getDate('label'), which returns
an externally launched an xsd:date value as a string. This
integration such as only applies to parameters of simple
Payforce. type, such as string, date, or number.
Time portions are excluded if the
underlying data value includes them.
lp.getDescriptor('label',
'wid'), which is used for parameters
that have multiple values with
Instance_Set_Reference elements.
It returns the wd:Descriptor attribute
associated with the instance with the
given WID.
m Provides access to the The following expression gets the root part of
e MediationMessage the message as text from the
s interface. MediationMessage interface:
s
57
MVEL Expression Language
Va
ria Description Usage examples
ble
a message.rootPartAsText
g
e
mtable['my_property'].get(0,
'Data_Column')
parts[0].getHeader('someHeader')
parts[0].mimeType
58
MVEL Expression Language
Va
ria Description Usage examples
ble
parts[0].getAs(DOMSource)
parts[0].getAs(String)
parts[0].xpath('/a/b')
parts[0].xpath('/xx:a/xx:b', 'xx
http://www.somewhere.com')
parts[0].xpathB('/a/b')
59
MVEL Expression Language
Va
ria Description Usage examples
ble
parts[0].xpathF('/a/b')
parts[0].setHeader('SomeHeader',
'SomeValue');
props['bean.property']
60
MVEL Expression Language
Va
ria Description Usage examples
ble
r WSAR using the context:
i ApplicationContext
n interface. spring.getBean('fred').name
g
v Provides access to the For example, to get the text of the variable
a MessageContextVariabl myVariable:
r es interface as a Map. To
s access variables, use the vars['myVariable'].text
following notation:
To determine if a variable is defined:
vars['myVariable']
vars['myVariable'] != null
vars['myVariable'].mimeType
61
MVEL Expression Language
Va
ria Description Usage examples
ble
vars['myVariable'].xpath('/a/b')
vars['myVariable'].xpath('/xx:a/xx:b', 'xx
http://www.somewhere.com')
vars['myVariable'].xpathB('/a/b')
vars['myVariable'].xpathF('/a/b')
x Returns the result of the The following expression checks whether there
m xmldiff step as a Java are differences between the two documents:
l object of type
d xmldiff.isDifferent() == true
XMLDiffStepResult,
i which is also available as For more examples of the xmldiff MVEL
f a property called variable usage, see “Sample MVEL Usage”.
f wd.xmldiff.step.result in
the MediationContext.
62
MVEL Expression Language
<wd:Request_References wd:Skip_Non_Existing_Instances="true">
@foreach{props['Workers'] as emp}
<wd:Worker_Reference>
<wd:ID wd:type="Employee_ID">@{emp}</wd:ID>
</wd:Worker_Reference>
@end{}
</wd:Request_References>
</wd:Get_Workers_Request>
<root>
@if{props['p.is.boolean']}
@elseif{props['p.numeric.value'] == 1}
63
MVEL Expression Language
@else{}
<ee>*Else*</ee>
@end{}
</root>
64
MVEL Expression Language
17 USEFUL Links:
http://mvel.codehaus.org/Home
http://www.mulesoft.org/documentation/display/current/Mule+Fundamentals
http://mulesoft.github.io/mule-module-mvel/usage.html#mvel-fundamentals
http://www.w3schools.com/xpath/xpath_nodes.asp
65