-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only GeneralUtils available as JEXL in a variable definition #485
Comments
@PatriciaPerozoUSDS In the mean time, can you explain what it is you’re trying to accomplish? Perhaps there is some other way to do what you want to do. |
Hi @cragun47 - We were hoping to simplify OID generation by adding a line to one of our extensions like config below:
We have a way to define the extension above by defining a constant and then using Ideally, we would love to be able to add our own utilities class and add that as a usable expression in the same way GeneralUtils is used. Then we could define a makeOID function in the util class and use that everywhere we wanted to instead of the inline use above. |
I'm very much interested in adding this functionality. We would like to be able to supply our own utils classes which could then interrogate our FHIR server to lookup Resources such as ValueSets and ConceptMaps for use in the HL7 mapping of many of our custom segments to our IG. |
I tracked down the reason why only There's special code in VariableGenerator - specifically targeted at GeneralUtils functions. A stop-gap solution that allows for functions from any group (so long as that group name ends in // Any custom function will work - so long as the group name ends in Utils e.g.:
// vars
// value: PID.26 , MyCustomUtils.myCustomFunction(value)
//
if (StringUtils.contains(rawVariable, "Utils.")) {
String[] values = rawVariable.split(",", 2);
// Handle * in combination with GeneralUtils function
exp = ExpressionAttributes.extractExpressionModifiers(values[0], false);
if (values.length == COMPONENT_LENGTH_FOR_VAR_EXPRESSION) {
List<String> specs = getTokens(exp.getExpression());
return new ExpressionVariable(varName, values[1], specs, exp.getExtractMultiple(), exp.getRetainEmpty());
} I wonder if we can make the customFunctions Map easily available so we can check the map keys in |
Keep an eye on #504 - we really need this to work. |
Describe the bug
In
extensionMeta.yml
, extension_4 calls GeneralUtils within a variable definitionNone of the other classes available in the explicit JEXL definition (String, StringUtils, NumberUtils) work in this style of declaration.
To Reproduce
ERROR io.github.linuxforhealth.hl7.resource.deserializer.HL7DataBasedResourceDeserializer - deserialization failure expression type RESOURCE
Expected behavior
I would expect if GeneralUtils was available to be used as a part of variable definition, that the other classes initialized in the JEXLEngineUtil constructor would be available too.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: