feat: ESPI 4.0 Schema Compliance - Phase 16c: UsagePoint Repository Cleanup #85
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.
Summary
This PR implements Phase 16c of the UsagePoint schema compliance work, cleaning up the repository to remove non-indexed queries and convert to Spring Data JPA derived query methods for optimal performance.
Phase 16 Strategy
Phase 16 (UsagePoint) is being split into sub-phases:
Changes in Phase 16c
🗑️ Removed Methods (Non-Indexed or Redundant)
findByResourceUri(String uri)urifield which is NOT indexed AND is a legacy field NOT in ESPI 4.0 XSDfindAllIds()existsByUuid(UUID uuid)existsById(UUID id)insteaddeleteByUuid(UUID uuid)deleteById(UUID id)instead✅ Retained Methods (All Use Indexed Columns)
findAllByRetailCustomerId(Long)retail_customer_idfindAllByUpdatedAfter(LocalDateTime)updatedfindByRelatedHref(String)usage_point_related_links(usage_point_id)findAllIdsByRetailCustomerId(Long)retail_customer_id📊 Database Index Analysis
Current indexed columns on
usage_pointstable:kindstatusretail_customer_idservice_delivery_point_idlocal_time_parameters_idcreatedupdatedKey Findings:
kindfield: Indexed but NOT in ESPI 4.0 XSD (legacy field, no queries use it)urifield: Not indexed, NOT in ESPI 4.0 XSD (legacy field, removed from queries)🧪 Test Updates
Removed 4 test methods for deleted repository methods:
shouldFindUsagePointByResourceUri()shouldFindAllUsagePointIds()shouldCheckIfUsagePointExistsByUuid()shouldDeleteUsagePointByUuid()Updated tests:
shouldHandleEmptyResultsGracefully()- Removed references to deleted methodsshouldFindAllUsagePointsUpdatedAfterTimestamp()- Updated method call tofindAllByUpdatedAfter()Technical Details
Performance Benefits
findAllIds)uri)Spring Data JPA Patterns
findAllByRetailCustomerId) are automatically implemented by Spring Data JPA at runtimefindAllByRetailCustomerId→ Spring generatesSELECT ... WHERE retail_customer_id = ?Repository Documentation
Added comprehensive JavaDoc to repository interface explaining:
Test Results
Note: Was 584 tests, now 580 (removed 4 tests for deleted methods)
Migration Impact
The following public repository methods have been removed:
findByResourceUri(String uri)- Use alternative approach or migrate away from legacyurifieldfindAllIds()- UsefindAll()and extract IDs, orfindAllIdsByRetailCustomerId()for filtered IDsexistsByUuid(UUID uuid)- Use built-inexistsById(UUID id)insteaddeleteByUuid(UUID uuid)- Use built-indeleteById(UUID id)instead✅ No Service Layer Changes Required
Checked all usages in service layer:
UsagePointServiceImplusesfindAllIdsByRetailCustomerId()- Still available ✅Related
Next Steps (Phase 16d)
🤖 Generated with Claude Code