Skip to content
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

#3884 Expression language support for conditional sequence flow and conditional events #3889

Merged

Conversation

rasmusfaber
Copy link
Contributor

This fixes #3884 by adding support for other expression languages as specified by the language tag in the FormalExpression, i.e.

   <sequenceFlow id="flow">
      <conditionExpression xsi:type="tFormalExpression" language="groovy">
          customer.addresses.any { it.country == 'US' }
      </conditionExpression>
    </sequenceFlow>

Check List:

  • Unit tests: YES
  • Documentation: NA (I couldn't find anything at least)

@filiphr
Copy link
Contributor

filiphr commented Aug 28, 2024

@rasmusfaber thanks for the PR can you looked into org.flowable.engine.impl.Condition, org.flowable.engine.impl.scripting.ScriptCondition and org.flowable.engine.impl.el.UelExpressionCondition? I think that what you are looking for fits more into using ScriptCondition instead of the UelExpressionCondition.

With that approach we won't need the ScriptEngineExpression and we won't need to get the process engine configuration in the way we are doing it now.

@rasmusfaber
Copy link
Contributor Author

@rasmusfaber thanks for the PR can you looked into org.flowable.engine.impl.Condition, org.flowable.engine.impl.scripting.ScriptCondition and org.flowable.engine.impl.el.UelExpressionCondition?

@filiphr Oh, yes. That was much cleaner. Thank you. I have updated the PR.

@filiphr
Copy link
Contributor

filiphr commented Aug 28, 2024

Thanks @rasmusfaber.

I see now that you did some changes in the ScriptCondition. I would instead prefer to have a new method in the ConditionUtil and create a Condition from there. If the language is null or empty then we create the UelExpressionCondition otherwise we create a ScriptCondition. The ScriptCondition should not behave like a UelExpressionCondition if there is no language

@rasmusfaber
Copy link
Contributor Author

rasmusfaber commented Aug 28, 2024

I would instead prefer to have a new method in the ConditionUtil and create a Condition from there.

@filiphr Sure. How is this? I also renamed the sequenceFlowId parameter to elementId, since it could now also be the id of an event.

@filiphr
Copy link
Contributor

filiphr commented Aug 28, 2024

Looks good, thanks @rasmusfaber

@tijsrademakers tijsrademakers merged commit d1a8c91 into flowable:main Oct 3, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Conditions should support more than JUEL expressions
3 participants