-
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 enhances the project by upgrading the Java base image from version 17 to 21, adding a Maven repository for snapshot dependencies, and updating critical libraries. New entity views for user details improve data retrieval capabilities. Tests have also been updated to integrate necessary configurations, ensuring a smoother development experience and better alignment with the latest changes. 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 Configuration 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
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 (1 hunks)
- src/test/java/com/learning/mfscreener/repository/SchemaValidationPostgresTest.java (2 hunks)
Additional comments not posted (3)
src/test/java/com/learning/mfscreener/repository/SchemaValidationPostgresTest.java (2)
5-5
: Confirm the necessity of the new import.Ensure that
BlazePersistenceConfiguration
is required for the functionality being tested in this file.
14-14
: Confirm the necessity of the annotation change.Ensure that including
BlazePersistenceConfiguration
in the@Import
annotation is necessary and does not introduce unintended side effects.build.gradle (1)
6-6
: Confirm the necessity of the new Maven repository.Ensure that adding the snapshot repository from Sonatype is necessary and does not introduce potential issues with dependency management.
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 (9)
- build.gradle (2 hunks)
- src/main/java/com/learning/mfscreener/config/db/BlazePersistenceConfiguration.java (1 hunks)
- src/main/java/com/learning/mfscreener/models/entityviews/InvestorInfoEntityView.java (1 hunks)
- src/main/java/com/learning/mfscreener/models/entityviews/UserCASDetailsEntityView.java (1 hunks)
- src/main/java/com/learning/mfscreener/models/entityviews/UserFolioDetailsEntityView.java (1 hunks)
- src/main/java/com/learning/mfscreener/models/entityviews/UserSchemeDetailsEntityView.java (1 hunks)
- src/main/java/com/learning/mfscreener/models/entityviews/UserTransactionDetailsEntityView.java (1 hunks)
- src/test/java/com/learning/mfscreener/archunit/ModelRulesTest.java (1 hunks)
- src/test/java/com/learning/mfscreener/repository/SchemaValidationPostgresTest.java (2 hunks)
Files skipped from review due to trivial changes (1)
- src/test/java/com/learning/mfscreener/archunit/ModelRulesTest.java
Files skipped from review as they are similar to previous changes (2)
- build.gradle
- src/test/java/com/learning/mfscreener/repository/SchemaValidationPostgresTest.java
Additional comments not posted (30)
src/main/java/com/learning/mfscreener/models/entityviews/InvestorInfoEntityView.java (1)
1-31
: LGTM! Consider adding method documentation.The code changes are approved. Adding Javadoc comments to the methods would improve readability and maintainability.
src/main/java/com/learning/mfscreener/models/entityviews/UserTransactionDetailsEntityView.java (1)
1-40
: LGTM! Consider adding method documentation.The code changes are approved. Adding Javadoc comments to the methods would improve readability and maintainability.
src/main/java/com/learning/mfscreener/models/entityviews/UserFolioDetailsEntityView.java (1)
1-37
: LGTM! Consider adding method documentation.The code changes are approved. Adding Javadoc comments to the methods would improve readability and maintainability.
src/main/java/com/learning/mfscreener/models/entityviews/UserCASDetailsEntityView.java (9)
18-18
: LGTM!The method
getCreatedBy
is correctly defined.
20-20
: LGTM!The method
getCreatedDate
is correctly defined.
22-22
: LGTM!The method
getLastModifiedBy
is correctly defined.
24-24
: LGTM!The method
getLastModifiedDate
is correctly defined.
26-27
: LGTM!The method
getId
is correctly defined and annotated.
29-29
: LGTM!The method
getCasTypeEnum
is correctly defined.
31-31
: LGTM!The method
getFileTypeEnum
is correctly defined.
33-33
: LGTM!The method
getInvestorInfoEntity
is correctly defined.
35-36
: LGTM!The method
getFolioEntities
is correctly defined and annotated.src/main/java/com/learning/mfscreener/models/entityviews/UserSchemeDetailsEntityView.java (16)
16-16
: LGTM!The method
getCreatedBy
is correctly defined.
18-18
: LGTM!The method
getCreatedDate
is correctly defined.
20-20
: LGTM!The method
getLastModifiedBy
is correctly defined.
22-22
: LGTM!The method
getLastModifiedDate
is correctly defined.
24-25
: LGTM!The method
getId
is correctly defined and annotated.
27-27
: LGTM!The method
getScheme
is correctly defined.
29-29
: LGTM!The method
getIsin
is correctly defined.
31-31
: LGTM!The method
getAdvisor
is correctly defined.
33-33
: LGTM!The method
getRtaCode
is correctly defined.
35-35
: LGTM!The method
getRta
is correctly defined.
37-37
: LGTM!The method
getType
is correctly defined.
39-39
: LGTM!The method
getAmfi
is correctly defined.
41-41
: LGTM!The method
getMyopen
is correctly defined.
43-43
: LGTM!The method
getClose
is correctly defined.
45-45
: LGTM!The method
getCloseCalculated
is correctly defined.
47-48
: LGTM!The method
getTransactionEntities
is correctly defined and annotated.src/main/java/com/learning/mfscreener/config/db/BlazePersistenceConfiguration.java (2)
42-48
: LGTM!The method
createCriteriaBuilderFactory
is correctly defined and annotated.
50-56
: LGTM!The method
createEntityViewManager
is correctly defined and annotated.
Summary by CodeRabbit
New Features
InvestorInfo
,UserCASDetails
,UserFolioDetails
,UserSchemeDetails
, andUserTransactionDetails
, improving data retrieval and manipulation.Enhancements
Refactor
UserCASDetailsEntity
withUserCASDetailsEntityView
in service and repository methods for better entity management.Tests