chore: refactor datasource storage to use custom repo method#38143
chore: refactor datasource storage to use custom repo method#38143AnaghHegde merged 4 commits intoreleasefrom
Conversation
WalkthroughThe changes in this pull request involve modifications to the Changes
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
🔇 Additional comments (4)app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomDatasourceStorageRepositoryCE.java (2)
The imports for Mono and Flux are correctly added for reactive programming support.
The interface is well-designed with:
app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomDatasourceStorageRepositoryCEImpl.java (2)
Add parameter validation and error handling for findByDatasourceId. Similar to the other method, this one needs proper validation and error handling. @Override
public Flux<DatasourceStorage> findByDatasourceId(String datasourceId) {
+ if (datasourceId == null) {
+ return Flux.error(new IllegalArgumentException("datasourceId cannot be null"));
+ }
final BridgeQuery<DatasourceStorage> q =
Bridge.<DatasourceStorage>equal(DatasourceStorage.Fields.datasourceId, datasourceId);
- return queryBuilder().criteria(q).all();
+ return queryBuilder().criteria(q).all()
+ .switchIfEmpty(Flux.empty());
}
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomDatasourceStorageRepositoryCE.java(1 hunks)app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomDatasourceStorageRepositoryCEImpl.java(1 hunks)app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/DatasourceStorageRepositoryCE.java(1 hunks)
🔇 Additional comments (2)
app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomDatasourceStorageRepositoryCE.java (1)
7-9: LGTM! Clean interface definition.
The interface follows Spring Data repository patterns and reactive programming principles.
app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/DatasourceStorageRepositoryCE.java (1)
9-11: Verify Spring repository configuration.
The repository structure looks correct, but let's verify the bean configuration.
✅ Verification successful
Let me verify the Spring repository configuration by checking for any component scanning issues.
Let me check the component scanning configuration in ServerApplication.java to verify the repository setup.
Repository configuration is correctly set up
The Spring configuration is properly structured with:
- Component scanning enabled for "com.appsmith" package
- Clear repository hierarchy (DatasourceStorageRepository -> DatasourceStorageRepositoryCE)
- Proper implementation classes present (CustomDatasourceStorageRepositoryImpl)
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if there are any conflicting repository definitions
rg -l "interface.*DatasourceStorageRepository.*extends" | while read -r file; do
echo "=== $file ==="
rg "interface.*DatasourceStorageRepository.*extends" "$file"
done
Length of output: 1691
Script:
#!/bin/bash
# Check for Spring component scanning configuration
rg -l "ComponentScan|EnableJpaRepositories" app/server/appsmith-server/src/main/java/
Length of output: 171
Script:
#!/bin/bash
# Check repository implementation
rg -l "class.*DatasourceStorageRepository.*implements" app/server/appsmith-server/src/main/java/
Length of output: 98
Script:
#!/bin/bash
# Check for any repository bean configuration in XML or Java config
fd -e xml -e java | xargs rg "bean.*[\"']datasourceStorageRepository[\"']"
Length of output: 80
Script:
#!/bin/bash
# Check ServerApplication.java for repository configuration
rg -A 5 "ComponentScan|EnableJpaRepositories" app/server/appsmith-server/src/main/java/com/appsmith/server/ServerApplication.java
Length of output: 430
Script:
#!/bin/bash
# Check for repository implementation in CustomDatasourceStorageRepositoryImpl
fd -e java | rg "CustomDatasourceStorageRepository.*Impl"
Length of output: 298
...c/main/java/com/appsmith/server/repositories/ce/CustomDatasourceStorageRepositoryCEImpl.java
Show resolved
Hide resolved
...-server/src/main/java/com/appsmith/server/repositories/ce/DatasourceStorageRepositoryCE.java
Outdated
Show resolved
Hide resolved
…refactor-datasource-storage-crud-repository
## Description As part of transaction support in PG, we are moving from using the jpa methods for database operations. This PR is refactoring the code to use custom repository class for DatasourceStorageRepository from the default CrudRepository. ## Automation /ok-to-test tags="@tag.ImportExport" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!WARNING] > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/12313769237> > Commit: 977d50e > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12313769237&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: @tag.Datasource > Spec: > It seems like **no tests ran** 😔. We are not able to recognize it, please check <a href="https://github.com/appsmithorg/appsmith/actions/runs/12313769237" target="_blank">workflow here</a>. > <hr>Sat, 14 Dec 2024 11:00:53 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added methods to retrieve `DatasourceStorage` by `datasourceId` and `environmentId`. - Enhanced functionality for fetching `DatasourceStorage` based on `datasourceId`. - **Bug Fixes** - Removed the ability to find a datasource by both its ID and environment ID in the repository interface. - **Documentation** - Updated repository annotations to reflect new functionalities and integrations. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
…horg#38143) ## Description As part of transaction support in PG, we are moving from using the jpa methods for database operations. This PR is refactoring the code to use custom repository class for DatasourceStorageRepository from the default CrudRepository. ## Automation /ok-to-test tags="@tag.ImportExport" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!WARNING] > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/12313769237> > Commit: 977d50e > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12313769237&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: @tag.Datasource > Spec: > It seems like **no tests ran** 😔. We are not able to recognize it, please check <a href="https://github.com/appsmithorg/appsmith/actions/runs/12313769237" target="_blank">workflow here</a>. > <hr>Sat, 14 Dec 2024 11:00:53 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added methods to retrieve `DatasourceStorage` by `datasourceId` and `environmentId`. - Enhanced functionality for fetching `DatasourceStorage` based on `datasourceId`. - **Bug Fixes** - Removed the ability to find a datasource by both its ID and environment ID in the repository interface. - **Documentation** - Updated repository annotations to reflect new functionalities and integrations. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Description
As part of transaction support in PG, we are moving from using the jpa methods for database operations. This PR is refactoring the code to use custom repository class for DatasourceStorageRepository from the default CrudRepository.
Automation
/ok-to-test tags="@tag.ImportExport"
🔍 Cypress test results
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12388971717
Commit: 977d50e
Cypress dashboard.
Tags:
@tag.ImportExportSpec:
Wed, 18 Dec 2024 09:08:53 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
New Features
DatasourceStoragebydatasourceIdandenvironmentId.DatasourceStoragebased ondatasourceId.Bug Fixes
Documentation