Skip to content

Conversation

@martinkranec
Copy link
Contributor

@martinkranec martinkranec commented Jul 31, 2025

Description

Implements NAE-2147

Dependencies

Third party dependencies

No new dependencies were introduced

Blocking Pull requests

There are no dependencies on other PR

How Has Been This Tested?

Manually

Name Tested on
OS Windows 11
Runtime Java 21
Dependency Manager Maven 3.9.9
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 @...
  • 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

  • Bug Fixes

    • Improved conditional logic in dashboard item configuration to correctly handle empty or missing menu item lists, enhancing field visibility and value assignment.
    • Added explicit version conflict detection during Petri net imports to prevent duplicate version entries.
  • New Features

    • Introduced version comparison functionality for Petri nets to support accurate version ordering.
    • Added comprehensive tests validating Petri net version increments and conflict handling.
  • Refactor

    • Updated process import logic to ensure each process is imported only once during startup, reducing redundant imports.
    • Streamlined folder creation methods and removed unused or redundant code in menu item management.
    • Cleaned up and optimized method calls and imports across several services.
  • Chores

    • Enhanced test setup by integrating additional runner execution and updating test references for improved consistency.
    • Added a new class import to application configuration for better workflow domain support.
    • Added new Petri net XML test resources to support versioning tests.
  • Documentation

    • Updated visibility of certain constants for improved accessibility in tests and other modules.

- Refactor `importProcess` to `importProcessOnce` for improved idempotency and streamline dashboard and filter runners by removing redundant method calls and unused imports.
Remove redundant `parentPath` call in `MenuItemService` during node path creation.
- Replace `FilterRunner` with `MenuProcessRunner` in `MenuItemApiTest` and inject `MenuProcessRunner` in `TestHelper`.
- Refactor `FilterImportExportTest` to use `PetriNetService` for net retrieval.
- Update visibility of constants in `FilterRunner` from private to public for reuse.
- Remove redundant constants in `FilterImportExportTest`.
- Add `DashboardItemBody` to `actions.imports` in `application.yaml`.
- Refine `menu_items_list.value` checks in `dashboard_item.xml` to handle empty string cases.
@martinkranec martinkranec self-assigned this Jul 31, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 31, 2025

Walkthrough

This change renames the importProcess method to importProcessOnce in the ImportHelper class and updates all usages throughout the application to use the new method name. Several runner classes and tests are modified accordingly. Additional minor code cleanups, visibility adjustments, configuration updates, Petri net versioning enhancements, new version comparison logic, and extended test coverage for versioning are included. XML condition checks were refined, and new test resource files were added.

Changes

Cohort / File(s) Change Summary
ImportHelper method rename & update
application-engine/src/main/groovy/com/netgrif/application/engine/startup/ImportHelper.groovy
Renamed importProcess to importProcessOnce with unchanged internal logic.
Runner classes: import method usage updates
application-engine/src/main/java/com/netgrif/application/engine/startup/runner/DashboardManagementRunner.java, .../DashboardRunner.java, .../FilterRunner.java, .../MenuProcessRunner.java
Updated calls from importProcess to importProcessOnce. Changed visibility of filter net identifiers in FilterRunner. Removed unused imports.
Dashboard management service cleanup
application-engine/src/main/java/com/netgrif/application/engine/menu/services/DashboardManagementServiceImpl.java
Removed redundant calls to MenuItemUtils.sanitize; sanitized ID passed directly to method.
Menu item service refactor
application-engine/src/main/java/com/netgrif/application/engine/menu/services/MenuItemService.java
Removed unused import, deleted getOrCreateFolderRecursive2 method, and cleaned redundant code in duplicateItem.
Configuration and XML updates
application-engine/src/main/resources/application.yaml, .../petriNets/engine-processes/dashboard_item.xml
Added import entry in YAML; refined XML conditions to check for non-null and non-empty menu_items_list.value.
Test helpers and runners integration
application-engine/src/test/groovy/com/netgrif/application/engine/TestHelper.groovy
Added MenuProcessRunner injection and invoked its run() in DB truncation sequence.
Menu item API tests update
application-engine/src/test/groovy/com/netgrif/application/engine/action/MenuItemApiTest.groovy
Replaced references from FilterRunner.MENU_NET_IDENTIFIER to MenuProcessRunner.MENU_NET_IDENTIFIER.
Filter import/export tests update
application-engine/src/test/groovy/com/netgrif/application/engine/filters/FilterImportExportTest.groovy
Replaced static constants with injected runner fields; used PetriNetService for PetriNet retrieval.
Petri net versioning enhancements
application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java, application-engine/src/main/java/com/netgrif/application/engine/importer/service/Importer.java
Added explicit version conflict detection and version assignment logic during import; set PetriNet version to null on creation.
Version comparison addition
nae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/version/Version.java
Added compareTo(Version other) method comparing major, minor, and patch fields.
Petri net versioning tests and resources
application-engine/src/test/groovy/com/netgrif/application/engine/petrinet/domain/PetriNetTest.groovy, application-engine/src/test/resources/net_clone2.xml, .../net_clone3.xml
Added new test resources and extended versioning tests verifying version increments and conflict detection.
Minor test class imports and constants update
application-engine/src/test/groovy/com/netgrif/application/engine/petrinet/domain/EventTest.groovy
Added import for VersionType.
XML version attribute update
application-engine/src/test/resources/net_import_2.xml
Updated XML version attribute from "1.0.0" to "2.0.0".

Sequence Diagram(s)

sequenceDiagram
    participant Runner as StartupRunner
    participant Helper as ImportHelper
    participant PetriNetRepo as PetriNetRepository

    Runner->>Helper: importProcessOnce(msg, netId, netFile)
    Helper->>PetriNetRepo: findByIdentifier(netId)
    alt PetriNet exists
        Helper-->>Runner: Return existing PetriNet (Optional)
    else PetriNet not found
        Helper->>PetriNetRepo: createFromFile(netFile)
        Helper-->>Runner: Return new PetriNet (Optional)
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Suggested labels

Small

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 49de8f0 and effe279.

📒 Files selected for processing (1)
  • nae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/version/Version.java (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • nae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/version/Version.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Test
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch NAE-2147

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai bot added the Medium label Jul 31, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 31, 2025
@machacjozef machacjozef changed the base branch from release/7.0.0-rev4 to release/7.0.0-rev5 July 31, 2025 20:38
@machacjozef machacjozef dismissed coderabbitai[bot]’s stale review July 31, 2025 20:38

The base branch was changed.

@coderabbitai coderabbitai bot added the improvement A change that improves on an existing feature label Jul 31, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 31, 2025
Copy link

@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: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 50b0d7a and 49de8f0.

📒 Files selected for processing (7)
  • application-engine/src/main/java/com/netgrif/application/engine/importer/service/Importer.java (1 hunks)
  • application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java (2 hunks)
  • application-engine/src/test/groovy/com/netgrif/application/engine/petrinet/domain/EventTest.groovy (1 hunks)
  • application-engine/src/test/groovy/com/netgrif/application/engine/petrinet/domain/PetriNetTest.groovy (2 hunks)
  • application-engine/src/test/resources/net_clone2.xml (1 hunks)
  • application-engine/src/test/resources/net_clone3.xml (1 hunks)
  • nae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/version/Version.java (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • application-engine/src/test/groovy/com/netgrif/application/engine/petrinet/domain/EventTest.groovy
  • application-engine/src/test/resources/net_clone2.xml
  • application-engine/src/test/resources/net_clone3.xml
  • application-engine/src/main/java/com/netgrif/application/engine/importer/service/Importer.java
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: in elasticpetrinetservice class, petrinetservice is properly initialized using @lazy setter injectio...
Learnt from: tuplle
PR: netgrif/application-engine#331
File: application-engine/src/main/java/com/netgrif/application/engine/elastic/service/ElasticPetriNetService.java:45-46
Timestamp: 2025-07-29T17:19:18.300Z
Learning: In ElasticPetriNetService class, petriNetService is properly initialized using @Lazy setter injection rather than constructor injection. This pattern with @Lazy @Autowired setter methods is commonly used in Spring to resolve circular dependencies and is a valid alternative to constructor injection.

Applied to files:

  • application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: task-list-completed
  • GitHub Check: Build
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
🔇 Additional comments (4)
application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java (1)

369-371: LGTM!

The formatting improvement enhances code readability without affecting functionality.

application-engine/src/test/groovy/com/netgrif/application/engine/petrinet/domain/PetriNetTest.groovy (3)

55-59: LGTM!

The addition of new test resources supports comprehensive version testing scenarios.


106-127: LGTM!

The testVersion() method provides comprehensive test coverage for version progression through different version types (PATCH, MAJOR, MINOR). The assertions verify correct version increments and the final count validation ensures all versions are properly stored.


130-141: LGTM!

The testVersioningConflicts() method effectively tests the version conflict detection feature by verifying that importing the same version twice throws the expected IllegalArgumentException with the correct error message.

tuplle
tuplle previously approved these changes Jul 31, 2025
@coderabbitai coderabbitai bot added the Small label Jul 31, 2025
@machacjozef machacjozef merged commit 513eb36 into release/7.0.0-rev5 Aug 1, 2025
6 of 7 checks passed
@machacjozef machacjozef deleted the NAE-2147 branch August 1, 2025 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement A change that improves on an existing feature Medium Small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants