refactor(complex-methods): Extract batch logic, add exception wrapper, add value objects - #10
Open
maheshkumargangula wants to merge 3 commits into
Open
refactor(complex-methods): Extract batch logic, add exception wrapper, add value objects#10maheshkumargangula wants to merge 3 commits into
maheshkumargangula wants to merge 3 commits into
Conversation
…, add value objects - Extract repeated exception handler pattern from Cassandra batch methods (CM-01/CM-07) - Add CassandraException wrapper class for unified error handling (CM-02) - Add CassandraQueryOptions value object to reduce method parameter count (CM-04) - Refactor batchInsert/batchInsertLogged into shared performBatchInsert() helper (CM-06) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…aOperationImpl - handleCassandraBatchException() was defined 3 times; remove 2 duplicates - executeBatch() was defined 3 times; remove 2 duplicates - Wire batchInsert(), batchDelete(), batchInsertLogged() to call the shared handleCassandraBatchException() handler, replacing 4-5 catch blocks each - Update method signature to include keyspaceName and tableName parameters - File reduced from 5,076 to 4,620 lines (456 lines of dead code removed) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lict files 36 .rej files from a failed patch application were accidentally committed in the initial refactor commit. These are not source files and should not be in the repository. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Title
refactor(complex-methods): Extract batch logic, add exception wrapper, add value objects
Base Branch
develop
Summary
QueryExecutionException,QueryValidationException,NoHostAvailableException,IllegalStateException,Exception) was copy-pasted across 6+ Cassandra batch methods. Extracted tohandleBatchException().BatchStatement.Type). Extracted to a sharedperformBatchInsert(BatchStatement.Type, ...)helper.CassandraExceptionwrapper: Unified exception class for Cassandra-specific errors, enabling single-catch blocks in callers.CassandraQueryOptionsvalue object: Builder-pattern POJO to replace 5–8 parameter method signatures.Files Changed
core/sunbird-cassandra-utils/.../CassandraOperationImpl.java(modified)core/sunbird-cassandra-utils/.../exception/CassandraException.java(new)core/sunbird-cassandra-utils/.../helper/CassandraQueryOptions.java(new)Implements Tasks
CM-01, CM-02, CM-04, CM-06, CM-07
Test Plan
mvn test -pl core/sunbird-cassandra-utilsCassandraOperationImplTeststill passes