How to access values from the context:property-placeholder in MEL? - mule

can someone pls advise how to access values from a context:property-placeholder in MEL?
I've found an article that describes how to access the values from Java here.
Need similar for MEL.
Thanks,

It is simple mostly same as in Spring container of java. You access it using ${key} where key is present in your properties file.

OK, I had to find the answer by myself.
The syntax of accessing a property value in MEL depends on a type of the value.
For String values it should be like this:
MyStringVar='${MyProperty}';
while for numeric values the quotas not required.

you can try with ${propertyName}, where ever you want to access properties.

You should be able to access the property value as shown below:
<set-variable variableName="someName" value="${xyz.someProperty}" />

Related

Why do I get "Associated reference no longer appears to be available"?

I have explained whole issue here https://github.com/marmelab/react-admin/issues/5142 . But as far as the stackoverflow community is more active, I mention the issue here too.
Please explain me, why this sample code is working properly
<ReferenceInput label={"Specification"} perPage={20} source={"specificationName"}
reference={ResourceNames.SPECIFICATIONS}>
<SelectInput optionText={"name"}/>
</ReferenceInput>
while this code is showing the "Associated reference no longer appears to be available" error message.
<ReferenceInput label={"Specification"} perPage={20} source={"specificationName"}
reference={ResourceNames.SPECIFICATIONS}>
<SelectInput optionText={"name"} optionValue={"name"} />
</ReferenceInput>
The only difference between above given examples - is the optionValue property passed to SelectInput. What's wrong with it? I don't want my SelectInput to use ID as a value... How the optionValue property is related to the above mentioned error message?
Please help! Thank you in advance
I have found a solution. React-Admin requires the id for resources identification.
But if you need a custom identifier for your resource then have a look at the article below
See https://marmelab.com/react-admin/FAQ.html#can-i-have-custom-identifiersprimary-keys-for-my-resources
This error can occur also if your model filter doesn't accept an ids attribute, observed in the web console.
I ended up in this situation because I based my schema off the schema provided in the readme of ra-data-graphql-simple.
To solve, I added the ids property to the type filter in the graphql schema.
PS - if you're bootstrapping like I was, it will be time to swap out the Edit and List Guessers for components that make use of a reference field

OSB: Assign a value from $header to variable in error handler

Dear Stackoverflowers,
this is my first post, so I try to do everything correct.
In the error handler of an OSB component, I need to assign a value from the existing $originalHeader to another variable to reuse it, without entering the value as text.
In an assign-action, the expression $originalHeader/privateMetaAttributesHeader/LoggingCategory
for variable originalLoggingCategory does return the below:
Debugging_VariablesScreen
I do not understand why the value of LoggingCategory is not assigned to variable originalLoggingCategory. Please help me out with this.
Content of $originalHeader:
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><v1:privateMetaAttributesHeader xmlns:v1="http://www.example.org/scintilla/meta/v1"><SwingMonitoring>...</SwingMonitoring><LoggingCategory>com.schenker.scintilla.AirOcean.WWTAN.LoadPlanInstructionService.v1</LoggingCategory></v1:privateMetaAttributesHeader></soapenv:Header>
Thanks in advance.
Patrick
There is a difference between <privateMetaAttributesHeader> and <v1:privateMetaAttributesHeader>, which OSB rightly respects.
for instance
$originalHeader/privateMetaAttributesHeader/LoggingCategory may be null
$originalHeader/v1:privateMetaAttributesHeader/v1:LoggingCategory will probably return what you want (try selecting just the header at first, then work your way down to the logging category, just in case LoggingCategory isn't in the v1 namespace)
You can define what namespace 'v1' is in the OSB Proxy Stage, or if you don't know, you can use $originalHeader/*:privateMetaAttributesHeader/*:LoggingCategory but that's not recommended.

Mule Datamapper values from property file

I have use case as below
In mule flow i have configured a data mapper with source to target of types XML. At target side i have some header values which should contain username and password values.
I want to read the username and password values from properties file under src/main/resources.
Using normal MEL expression ${user},${password} is not working. Can some one help on this issue.
Pass these property values as input arguments to DataMapper, as explained here: https://stackoverflow.com/a/22248164/387927

Grails trouble saving object id

id is present in the params but does not save to the db. for example
[book.id:1, comments: good]
comments will save to db but book.id does not.
I need to figure out how to save params.book.id into the db column BOOK_ID that was created from the hasmany/belongsTo relationship.
By default value attribute of each element will be the result of a toString() call on each element. Setting it as optionKey allows the value to be a bean property of each element in the list.
Kindly change the select to
<g:form action="review">
<g:select name="book.id"
from="${item.Book.list()}"
value="${book?.id}"
/>
<g:textField name="bookreview" value="${params?.bookreview}" /><br>
kindly refer the below link
Grail example with optionkey
You have overwritten toString, therefore your books are always rendered by name and not id. If you remove your toString() method you will see the expected results.
If you want your select box work with the name, just add optionValue="name".
Well, it seems that I had misspelled a crucial parameter inside my domain. So the domain was expecting x and it was getting y. Thus the id was always null. It took me a while to spot it, and I was perplexed because I had previously successfully implemented ids in another project. Grails has some jira issues also that make one consider other possibilities, but this time it was my mistake.

How to pass a field that is an array list in a java bean, within a JasperReports?

Could some indicate a working example or a snippet of code for JasperReports regarding ArrayList as a Field in a javabean datasource.
I have a List of Employees. Each Employee has a name field, and an array of Phone with type and number as its fields.
Do i use a subreport for Phones I have not found a working example? Cant seem to compile subreport_jasper file?
Do i use a list component instead...
<c:list ...>
<datasetRun subDataset="Addresses">
<datasetParameter name="Phone">
<datasetParameterExpression><![CDATA[$F{Phone}]]></datasetParameterExpression>
</datasetParameter>
</datasetRun>
This does seems to work either?
Thank in advance
I wrote this article while working with MongoDB. It deals with handling fields that are collections. It should be exactly what you need. (You can just ignore the MongoDB part.)
The key idea is that you use this to pass data to a List or Table or Subreport:
new net.sf.jasperreports.engine.data.JRMapCollectionDataSource($F{PhoneArray})