Skip to content

feat: Add collectInOrgUnitGroups to Expression [DHIS2-21245]#97

Merged
enricocolasante merged 1 commit intomainfrom
DHIS2-21245
Apr 9, 2026
Merged

feat: Add collectInOrgUnitGroups to Expression [DHIS2-21245]#97
enricocolasante merged 1 commit intomainfrom
DHIS2-21245

Conversation

@enricocolasante
Copy link
Copy Markdown
Collaborator

Summary

Adds a new method to extract org unit group identifiers referenced in expressions via d2:inOrgUnitGroup(...) calls.
This is needed by rule-engine clients to load all and only the needed orgUnitGroup members of the orgUnitGroup(s) referenced by the program rules.

Changes

New public API

  • Expression.collectInOrgUnitGroups(): Set<String> — returns the set of org unit group names/UIDs found as string arguments to all d2:inOrgUnitGroup(...) calls in the expression.
  • ExpressionJs.collectInOrgUnitGroups(): Array<String> — JS binding for the above.

Internal

  • Api.collectFunctionStringArguments(root, function, argIndex) — generic internal helper that aggregates string arguments at a given position from all calls to a named function in the AST. Implemented using Node.aggregate with a FUNCTION node filter.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 8, 2026

@enricocolasante enricocolasante requested a review from jbee April 9, 2026 07:17
@enricocolasante enricocolasante marked this pull request as ready for review April 9, 2026 07:17
@enricocolasante enricocolasante merged commit 852ec57 into main Apr 9, 2026
4 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.

2 participants