-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat : using blaze MultiSelect View #363
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThis update aims to enhance the project by upgrading the Java base image from version 17 to 21, adding a new Maven repository for snapshot dependencies, and updating critical dependencies. Additionally, there have been significant modifications to the repository and service layers to support improved data retrieval with the introduction of Changes
Poem
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this 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
Outside diff range and nitpick comments (1)
src/main/java/com/learning/mfscreener/repository/CustomUserCASDetailsEntityRepository.java (1)
5-7
: Consider adding Javadoc comments to thefindByInvestorEmailAndName
method.Providing documentation can help other developers understand the purpose of the method and its parameters more clearly.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- .gitpod.yml (1 hunks)
- gradle.properties (1 hunks)
- src/main/java/com/learning/mfscreener/repository/CustomUserCASDetailsEntityRepository.java (1 hunks)
- src/main/java/com/learning/mfscreener/repository/CustomUserCASDetailsEntityRepositoryImpl.java (1 hunks)
- src/main/java/com/learning/mfscreener/repository/UserCASDetailsEntityRepository.java (1 hunks)
Files skipped from review due to trivial changes (2)
- .gitpod.yml
- gradle.properties
public class CustomUserCASDetailsEntityRepositoryImpl implements CustomUserCASDetailsEntityRepository { | ||
|
||
private final EntityManager entityManager; | ||
|
||
private final CriteriaBuilderFactory criteriaBuilderFactory; | ||
|
||
private final EntityViewManager entityViewManager; | ||
|
||
public CustomUserCASDetailsEntityRepositoryImpl( | ||
EntityManager entityManager, | ||
CriteriaBuilderFactory criteriaBuilderFactory, | ||
EntityViewManager entityViewManager) { | ||
this.entityManager = entityManager; | ||
this.criteriaBuilderFactory = criteriaBuilderFactory; | ||
this.entityViewManager = entityViewManager; | ||
} | ||
|
||
@Override | ||
public UserCASDetailsEntityView findByInvestorEmailAndName(String email, String name) { | ||
return entityViewManager | ||
.applySetting( | ||
EntityViewSetting.create(UserCASDetailsEntityView.class), | ||
criteriaBuilderFactory.create(entityManager, UserCASDetailsEntity.class)) | ||
.where("investorInfoEntity.email") | ||
.eq(email) | ||
.where("investorInfoEntity.name") | ||
.eq(name) // Adding condition for the name | ||
.getSingleResult(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add exception handling and documentation to findByInvestorEmailAndName
.
Handling exceptions and providing documentation will improve the robustness and maintainability of this method.
src/main/java/com/learning/mfscreener/repository/UserCASDetailsEntityRepository.java
Show resolved
Hide resolved
There was a problem hiding this 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- build.gradle (2 hunks)
- gradle.properties (1 hunks)
- src/main/java/com/learning/mfscreener/repository/UserCASDetailsEntityRepository.java (2 hunks)
- src/main/java/com/learning/mfscreener/service/PortfolioService.java (4 hunks)
- src/main/java/com/learning/mfscreener/service/UserCASDetailsService.java (2 hunks)
Files skipped from review due to trivial changes (1)
- build.gradle
Files skipped from review as they are similar to previous changes (1)
- src/main/java/com/learning/mfscreener/repository/UserCASDetailsEntityRepository.java
Additional comments not posted (4)
gradle.properties (2)
11-11
: Update to Spring Boot version 3.2.6 approved.
12-12
: Update to Blaze Persistence version 1.6.12-SNAPSHOT approved.src/main/java/com/learning/mfscreener/service/UserCASDetailsService.java (2)
5-5
: Import ofUserCASDetailsEntityView
is appropriate for the new method implementation.
29-29
: MethodfindByInvestorEmailAndName
correctly usesUserCASDetailsEntityView
. Consider adding error handling for potential null values or exceptions.
@@ -133,45 +134,46 @@ UploadResponseHolder findDelta(String email, String name, CasDTO casDTO) { | |||
long userTransactionCount = portfolioServiceHelper.countTransactionsByUserFolioDTOList(inputUserFolioDTOList); | |||
List<UserTransactionDetailsEntity> userTransactionDetailsEntityList = | |||
this.userTransactionDetailsService.findAllTransactionsByEmailAndName(email, name); | |||
UserCASDetailsEntity userCASDetailsEntity = userCASDetailsService.findByInvestorEmailAndName(email, name); | |||
UserCASDetailsEntityView userCASDetailsEntityView = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updates to use UserCASDetailsEntityView
are consistent with PR objectives. Ensure completion of TODO items.
Would you like assistance in completing the TODO items mentioned in the code?
Also applies to: 146-146, 153-153, 164-164, 176-176, 338-338
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@coderabbitai, please help me with fixing TODO as per above comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rajadilipkolli, I can help you address the TODO items in your code. Here are the suggested changes:
1. Adding Folios to UserCASDetailsEntityView
You have a TODO comment where you need to add folio entities to UserCASDetailsEntityView
. Here's how you can do it:
// In the processNewFolios method
userFolioDTOList.forEach(userFolioDTO -> {
String folio = userFolioDTO.folio();
if (!existingFolioNumbers.contains(folio)) {
LOGGER.info("New folio: {} created that is not present in the database", folio);
userCASDetailsEntityView.addFolioEntity(
casDetailsMapper.mapUserFolioDTOToUserFolioDetailsEntity(userFolioDTO));
folioCounter.incrementAndGet();
int newTransactions = userFolioDTO.schemes().stream()
.map(UserSchemeDTO::transactions)
.flatMap(List::stream)
.toList()
.size();
transactionsCounter.addAndGet(newTransactions);
}
});
2. Bulk Insert for Transactions
For the second TODO, you mentioned converting to bulk insert. This typically involves collecting all entities and using a method that supports batch processing to minimize database hits. Here's a conceptual change:
// Collect all transactions to be inserted
List<UserTransactionDetailsEntity> transactionsToInsert = new ArrayList<>();
userSchemaTransactionMap.forEach((isinFromRequest, requestTransactions) -> {
List<UserTransactionDetailsEntity> dbTransactions =
userSchemaTransactionMapFromDB.getOrDefault(isinFromRequest, List.of());
if (requestTransactions.size() != dbTransactions.size()) {
requestTransactions.forEach(userTransactionDTO -> {
LocalDate newTransactionDate = userTransactionDTO.date();
if (!transactionDateListDB.contains(newTransactionDate)) {
UserTransactionDetailsEntity userTransactionDetailsEntity =
casDetailsMapper.transactionDTOToTransactionEntity(userTransactionDTO);
transactionsToInsert.add(userTransactionDetailsEntity);
}
});
}
});
// Use a method to bulk insert
userTransactionDetailsService.bulkInsert(transactionsToInsert);
Make sure to implement or update the bulkInsert
method in your UserTransactionDetailsService
to handle the batch insert operation efficiently.
These changes should help you complete the TODO items and improve the efficiency of your application. Let me know if you need further assistance!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- build.gradle (2 hunks)
- src/main/java/com/learning/mfscreener/repository/impl/CustomUserCASDetailsEntityRepositoryImpl.java (1 hunks)
- src/test/java/com/learning/mfscreener/repository/SchemaValidationPostgresTest.java (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- build.gradle
Additional comments not posted (3)
src/test/java/com/learning/mfscreener/repository/SchemaValidationPostgresTest.java (2)
5-5
: The import ofBlazePersistenceConfiguration
is correctly added to support the configuration needed for the tests.
18-18
: Correct use of the@Import
annotation to ensureBlazePersistenceConfiguration
is part of the Spring context for testing.src/main/java/com/learning/mfscreener/repository/impl/CustomUserCASDetailsEntityRepositoryImpl.java (1)
1-40
: New classCustomUserCASDetailsEntityRepositoryImpl
correctly implementsCustomUserCASDetailsEntityRepository
. Dependency injection is properly used, and the methodfindByInvestorEmailAndName
correctly utilizes Blaze-Persistence for querying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- build.gradle (2 hunks)
- gradle.properties (1 hunks)
Files skipped from review due to trivial changes (2)
- build.gradle
- gradle.properties
Summary by CodeRabbit
New Features
Enhancements
Refactor
UserCASDetailsEntity
withUserCASDetailsEntityView
in service and repository methods for better entity management.Tests