Skip to content

[NAE-2423] Extend Action API with wrapper support#440

Merged
machacjozef merged 8 commits into
release/7.0.0-rev10from
NAE-2423
May 19, 2026
Merged

[NAE-2423] Extend Action API with wrapper support#440
machacjozef merged 8 commits into
release/7.0.0-rev10from
NAE-2423

Conversation

@renczesstefan
Copy link
Copy Markdown
Member

@renczesstefan renczesstefan commented May 15, 2026

Description

Implements NAE-2423

Dependencies

No new dependencies were introduced

Third party dependencies

No new dependencies were introduced

Blocking Pull requests

There are no dependencies on other PR

How Has Been This Tested?

This was tested manually and with unit tests.

Test Configuration

Name Tested on
OS macOS Tahoe 26.3
Runtime Java 21
Dependency Manager Maven 3.9.9n
Framework version Spring Boot 3.4.4
Run parameters
Other configuration

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes have been checked, personally or remotely, with @machacjozef
  • I have commented my code, particularly in hard-to-understand areas
  • I have resolved all conflicts with the target branch of the PR
  • I have updated and synced my code with the target branch
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes:
    • Lint test
    • Unit tests
    • Integration tests
  • I have checked my contribution with code analysis tools:
  • I have made corresponding changes to the documentation:
    • Developer documentation
    • User Guides
    • Migration Guides

Summary by CodeRabbit

  • New Features

    • Search and count operations for cases and tasks now accept additional parameters, enabling enhanced filtering and customization of results.
  • Refactor

    • Improved authentication principal implementation for better code maintainability.
    • Standardized system user identification using dedicated constants instead of hardcoded values.

Review Change Stack

Introduced methods to handle additional parameters across case and task search and count operations. Created a constants class for default process parameter names and added overloads with parameter maps to improve flexibility.
Replaced the `AuthPrincipalDto` class with a Java record for improved immutability and concise representation. Adjusted related code to align with the record's accessors and updated the system username constant in `UserConstants` for consistency.
@renczesstefan renczesstefan self-assigned this May 15, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8242cf13-3e23-43c9-8397-a8ac2b2dabaf

📥 Commits

Reviewing files that changed from the base of the PR and between 1a9c1a5 and d2c59a6.

📒 Files selected for processing (2)
  • application-engine/src/test/groovy/com/netgrif/application/engine/orgstructure/groups/GroupServiceTest.groovy
  • nae-object-library/src/main/java/com/netgrif/application/engine/objects/auth/dto/AuthPrincipalDto.java

Walkthrough

The PR converts AuthPrincipalDto from a Lombok class to a Java record, adds system user and default parameter name constants, expands the ActionApi interface with params-aware search/count method overloads, implements those overloads in ActionApiImpl with delegation logic, and updates tests to reference usernames instead of emails.

Changes

API parameter support and data model migration

Layer / File(s) Summary
AuthPrincipalDto record conversion
nae-object-library/src/main/java/com/netgrif/application/engine/objects/auth/dto/AuthPrincipalDto.java
AuthPrincipalDto redefined as a record with username, realmId, and sessionId components; custom toString, equals, and hashCode implementations exclude sessionId from equality and string representation.
System user and default param constants
nae-object-library/src/main/java/com/netgrif/application/engine/objects/auth/constants/UserConstants.java, nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/actions/ActionApiDefaultParamNames.java
SYSTEM_USER_USERNAME constant added to UserConstants; new ActionApiDefaultParamNames class defines PROCESS_IDENTIFIER, PROCESS_ID, PROCESS_VERSION, and PROCESS_RESOURCE_ID constants.
ActionApi interface expansion for params support
nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/actions/ActionApi.java
Interface imports updated; new overloads for searchCases, countCases, searchTasks, and countTasks accept Map<String, String> params for both Predicate-based and elastic query string searches.
ActionApiImpl params delegation and elastic flow
application-engine/src/main/java/com/netgrif/application/engine/actions/ActionApiImpl.java
Params-less search/count methods delegate to params-aware overloads with empty HashMap; params-aware implementations build elastic requests, resolve principal via AuthPrincipalDto record accessors, determine locale and intersection flags, and execute elastic search/count operations.
Test updates for username and constants
application-engine/src/test/groovy/com/netgrif/application/engine/elastic/DataSearchRequestTest.groovy, application-engine/src/test/groovy/com/netgrif/application/engine/event/GroovyShellFactoryTest.groovy, application-engine/src/test/groovy/com/netgrif/application/engine/orgstructure/groups/GroupServiceTest.groovy
Tests updated to reference system user by username instead of email; DataSearchRequestTest now asserts userList values using username; GroupServiceTest imports UserConstants and uses the SYSTEM_USER_USERNAME constant.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 32.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title directly relates to the main objective of extending the Action API with parameter support, which is evident across multiple files (ActionApi.java, ActionApiImpl.java) and represents the primary change in the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot added improvement A change that improves on an existing feature breaking change Fix or feature that would cause existing functionality doesn't work as expected Medium labels May 15, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@application-engine/src/main/java/com/netgrif/application/engine/actions/ActionApiImpl.java`:
- Around line 125-128: The new params-aware overloads (e.g.,
ActionApiImpl.searchCases(String processIdentifier, Predicate predicate,
Pageable pageable, Map<String,String> params)) currently ignore the params map;
update each of these methods to incorporate or forward params into the
search/count operation instead of discarding them. Concretely: in searchCases
and the analogous countCases wrappers, either merge params into the existing
Predicate (e.g., build or augment predicate from params) or call the
workflowService overload that accepts params (e.g., workflowService.search(...)
/ workflowService.count(...) with params) so the incoming Map<String,String> is
actually used; apply the same change to every method signature that accepts
Map<String,String> params in this class. Ensure you reference and update the
methods named searchCases and the corresponding countCases wrappers so params
are read and propagated to workflowService.

In
`@nae-object-library/src/main/java/com/netgrif/application/engine/objects/auth/dto/AuthPrincipalDto.java`:
- Around line 11-16: AuthPrincipalDto is a Java record whose compiler-generated
equals, hashCode and toString include sessionId despite Lombok annotations; to
fix this either convert the record to a class-based DTO or add an explicit
record body that overrides equals(Object), hashCode(), and toString() to exclude
the sessionId component (keep the existing components username and realmId
semantics and retain Serializable), ensuring all loggable toString() calls and
equality/hash checks do not expose sessionId.

In
`@nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/actions/ActionApi.java`:
- Around line 216-223: The Javadoc for the countTasks method incorrectly states
it returns "a page of tasks"; update the `@return` description for the countTasks
method to reflect that it returns a Long representing the count of tasks (e.g.,
"the number of tasks matching the criteria") so the documentation matches the
method's return type Long in ActionApi.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c8e2e965-a2aa-4753-92f2-6f91200ee187

📥 Commits

Reviewing files that changed from the base of the PR and between c627375 and 31fc2f3.

📒 Files selected for processing (6)
  • application-engine/src/main/java/com/netgrif/application/engine/actions/ActionApiImpl.java
  • nae-object-library/src/main/java/com/netgrif/application/engine/objects/auth/constants/UserConstants.java
  • nae-object-library/src/main/java/com/netgrif/application/engine/objects/auth/dto/AuthPrincipalDto.java
  • nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/actions/ActionApi.java
  • nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/actions/ActionApiDefaultParamNames.java
  • nae-user-ce/src/main/java/com/netgrif/application/engine/auth/service/UserServiceImpl.java

Modified the countTasks method to return the number of tasks instead of a page of tasks. Also updated the corresponding JavaDoc to reflect the change accurately. Removed an unused import to improve code cleanliness.
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/actions/ActionApi.java`:
- Line 108: The six new abstract overloads (searchCases(String, Predicate,
Pageable, Map<String,String>), searchCases(List<String>, AuthPrincipalDto,
Pageable, Boolean, Map<String,String>), countCases(String, Predicate,
Map<String,String>), searchTasks(String, Predicate, Pageable,
Map<String,String>), searchTasks(List<String>, AuthPrincipalDto, Pageable,
Boolean, Map<String,String>), countTasks(String, Predicate, Map<String,String>))
must be converted to default methods on the ActionApi interface that delegate to
the existing 3- or 4-parameter variants to preserve binary compatibility;
implement each default to simply call the older overload (e.g.,
searchCases(processIdentifier, predicate, pageable) or searchTasks(...,
pageable)) ignoring the extra params Map or passing a default, so external
implementers are not forced to recompile.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: b7ea28a6-c6f8-4740-a2ef-be4b961aa530

📥 Commits

Reviewing files that changed from the base of the PR and between 31fc2f3 and 76c1367.

📒 Files selected for processing (1)
  • nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/actions/ActionApi.java

@Retoocs
Copy link
Copy Markdown
Contributor

Retoocs commented May 18, 2026

tests are failing

Updated test cases to consistently use `username` instead of `email` for identifying users. This ensures better alignment with domain constants and improved code maintainability. Changes include replacing hardcoded email references with `UserConstants.SYSTEM_USER_USERNAME` or user `username` fields where applicable.
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
application-engine/src/test/groovy/com/netgrif/application/engine/event/GroovyShellFactoryTest.groovy (1)

75-86: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Inconsistent system user lookup causes test failure.

Line 75 correctly looks up the user by getUsername(), but line 84 still uses getEmail(). If the system user's username differs from its email, line 84 will fail to find the updated user or retrieve a different user entirely, breaking the assertion on line 85.

This inconsistency is likely the root cause of the test failures mentioned in the PR comments.

🐛 Proposed fix to use consistent username lookup
-        user = userService.findUserByUsername(userService.getSystem().getEmail(), null)
+        user = userService.findUserByUsername(userService.getSystem().getUsername(), null)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@application-engine/src/test/groovy/com/netgrif/application/engine/event/GroovyShellFactoryTest.groovy`
around lines 75 - 86, The test uses inconsistent system user lookups causing
failures: in GroovyShellFactoryTest replace the second lookup that calls
userService.findUserByUsername(userService.getSystem().getEmail(), ...) with the
same username-based lookup used earlier (userService.getSystem().getUsername())
so both searches use userService.findUserByUsername and the assertion on
processRoles (after roleService.assignRolesToUser) checks the updated system
user reliably.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In
`@application-engine/src/test/groovy/com/netgrif/application/engine/event/GroovyShellFactoryTest.groovy`:
- Around line 75-86: The test uses inconsistent system user lookups causing
failures: in GroovyShellFactoryTest replace the second lookup that calls
userService.findUserByUsername(userService.getSystem().getEmail(), ...) with the
same username-based lookup used earlier (userService.getSystem().getUsername())
so both searches use userService.findUserByUsername and the assertion on
processRoles (after roleService.assignRolesToUser) checks the updated system
user reliably.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 11e1c546-2a64-416f-94cf-5ded1884da23

📥 Commits

Reviewing files that changed from the base of the PR and between 76c1367 and eeb7ba6.

📒 Files selected for processing (3)
  • application-engine/src/test/groovy/com/netgrif/application/engine/elastic/DataSearchRequestTest.groovy
  • application-engine/src/test/groovy/com/netgrif/application/engine/event/GroovyShellFactoryTest.groovy
  • application-engine/src/test/groovy/com/netgrif/application/engine/orgstructure/groups/GroupServiceTest.groovy

…hCode

Enhanced the AuthPrincipalDto class by overriding toString, equals, and hashCode methods for better readability and consistency in object comparisons and hashing. This change improves debugging and ensures hash-based collections work as expected. The sessionId remains excluded from these methods to preserve confidentiality.
Copy link
Copy Markdown
Contributor

@Retoocs Retoocs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx for the fix but the tests are still failing

Updated the test to retrieve the system user by username instead of email. This aligns with the correct method usage and improves test accuracy.
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@nae-object-library/src/main/java/com/netgrif/application/engine/objects/auth/dto/AuthPrincipalDto.java`:
- Around line 26-32: The equals method in AuthPrincipalDto currently calls
username.equals(...) and realmId.equals(...) which can throw NPE if either
component is null; change the implementation of AuthPrincipalDto.equals(Object
o) to use Objects.equals(this.username, that.username) and
Objects.equals(this.realmId, that.realmId) for null-safe comparisons (consistent
with the existing Objects.hash usage in hashCode).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8e516e08-294e-40cc-afd1-41c9eddecc6b

📥 Commits

Reviewing files that changed from the base of the PR and between eeb7ba6 and 1a9c1a5.

📒 Files selected for processing (2)
  • application-engine/src/test/groovy/com/netgrif/application/engine/event/GroovyShellFactoryTest.groovy
  • nae-object-library/src/main/java/com/netgrif/application/engine/objects/auth/dto/AuthPrincipalDto.java

Added validation to prevent null pointer exceptions by checking if `username` or `realmId` is null before proceeding with equality checks. This change improves robustness and avoids potential runtime errors.
@renczesstefan renczesstefan requested a review from Retoocs May 19, 2026 08:18
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 19, 2026
Retoocs
Retoocs previously approved these changes May 19, 2026
@machacjozef machacjozef dismissed stale reviews from Retoocs and coderabbitai[bot] via d2c59a6 May 19, 2026 11:30
@machacjozef machacjozef merged commit 179ecbf into release/7.0.0-rev10 May 19, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Fix or feature that would cause existing functionality doesn't work as expected improvement A change that improves on an existing feature Medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants