First version of expression evaluation#9756
Conversation
| test.expr1 = ${= ${test.vmin} * factor } | ||
|
|
||
| # Embedded expression should be used to reference properties that do contain dots | ||
| test.expr2 = ${= ${test.vmin} * ${test.v3} } |
There was a problem hiding this comment.
Het zijn nu alleen rekenvoorbeelden. Ik ben ook wel een beetje zoekende naar string concatenatie en iets met booleans. Dit moet gebruikt kunnen worden voor #8872
There was a problem hiding this comment.
Die rekenvoorbeelden waren makkelijk... Ik voeg wat meer tests toe met voorbeelden van string checks en concatenatie.
7f124c1 to
4c55e78
Compare
…; add some tests and features to raise an application-warning from script evaluation
…to top level class
ee7c6f5 to
ab8b019
Compare
evandongen
left a comment
There was a problem hiding this comment.
Ziet er goed uit, paar vragen en 1 suggestie.
| @@ -50,11 +62,12 @@ private StringResolver() { | |||
|
|
|||
| /** | |||
| * Do variable substitution on a string to resolve ${x2} to the value of the | |||
There was a problem hiding this comment.
toen ik dit begon te lezen dacht ik echt dat dit 'keer twee' betekende. Na wat verder lezen wordt het duidelijk dat het 'letter x twee' betekent (-:
There was a problem hiding this comment.
Veel copy-paste hier en veel bestaande doc aangepast. Maar misschien niet helemaal correct en misschien niet helemaal duidelijk.
Bedankt, ik ga er nog een beetje aan sleutelen!
...n-evaluator/src/main/java/org/frankframework/extentions/script/EmbeddedScriptEvaluation.java
Show resolved
Hide resolved
...n-evaluator/src/main/java/org/frankframework/extentions/script/EmbeddedScriptEvaluation.java
Show resolved
Hide resolved
| int stopPos = startPos - delimStop.length(); | ||
| int numEmbeddedStart = 0; | ||
| int numEmbeddedStop = 0; | ||
| startPos += delimStart.length(); |
There was a problem hiding this comment.
This should be done outside the loop, otherwise the start-position from which opening braces are counted shifts every iteration and we do not properly find the last closing brace!
This was an existing problem that caused some mysterious errors in property resolution occassionally even before adding the new evaluation engine.
| map.put("key", "value"); | ||
|
|
||
| // Act | ||
| Optional<String> value = embeddedScriptEvaluation.resolve("=key.toUpperCase()", map, null, null, StringResolver.DELIM_START, StringResolver.DELIM_STOP, false); |
There was a problem hiding this comment.
Deze is leuk, kan je ook =${instance.name}.toUpperCase() doen? en wat gebeurd er als hij niet bestaat?
There was a problem hiding this comment.
Je moet doen ${=instance.name.toLowerCase(), de string-referentie niet evalueren binnen de expressie want dan wordt de string als identifier gezien ipv string!
Maar ja in principe is het mogelijk om instance.name.lc nu direct in de properties-file te definieren ipv in code. En als instance.name niet is gezet, dan is het resultaat een lege string.
Er is nu ook een test voor toegevoegd.
| # Embedded expression should be used to reference properties that do contain dots | ||
| test.expr2 = ${= ${test.vmin} * ${test.v3} } | ||
|
|
||
| str.c1 = We |
There was a problem hiding this comment.
Nu beter zo, hoop ik
| test.expr2 = ${= ${test.vmin} * ${test.v3} } | ||
|
|
||
| str.c1 = We | ||
| str.c2 = Are |
There was a problem hiding this comment.
Nu beter zo, hoop ik
credentialProvider/pom.xml
Outdated
| </dependency> | ||
| <dependency> | ||
| <groupId>org.frankframework</groupId> | ||
| <artifactId>script-property-substitution</artifactId> |
|



Closes #9065