refactor: ESPI 4.0 Schema Compliance - Phase 0: Fix Object-based entities#66
Merged
refactor: ESPI 4.0 Schema Compliance - Phase 0: Fix Object-based entities#66
Conversation
This commit completes Phase A of ESPI 4.0 schema compliance by removing 11 database tables for related_links that were incorrectly created for entities that either extend Object (not IdentifiedObject) or use direct foreign key relationships instead of Atom links. Changes: - V1 migration: Removed 4 related_links tables - retail_customer_related_links (direct FK pattern) - service_delivery_point_related_links (extends Object) - subscription_related_links (direct FK for OAuth2) - batch_list_related_links (wrapper type, not IdentifiedObject) - V3 migration: Removed 7 related_links tables - interval_reading_related_links (extends Object, espi.xsd:1016) - reading_quality_related_links (extends Object, espi.xsd:1062) - pnode_ref_related_links (extends Object, espi.xsd:1539) - aggregated_node_ref_related_links (extends Object, espi.xsd:1570) - line_item_related_links (extends Object, espi.xsd:1444) - phone_number_related_links (custom, not in XSD) - statement_ref_related_links (extends Object, customer.xsd:285) - Vendor V2 files: Updated documentation comments to reflect that interval_reading and reading_quality do NOT have related_links tables Documentation: - PHASE_A_ANALYSIS_FINDINGS.md: Entity inheritance analysis - Phase_A-DTO_Analysis.md: DTO Atom link analysis - Phase_A-Flyway_Migration_Inventory.md: Migration inventory - PHASE_A_COMPLETE_SUMMARY.md: Phase A completion summary Testing: All tests pass successfully across H2, MySQL, and PostgreSQL databases. No side effects detected in dependent modules (datacustodian, thirdparty). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ties (Issue #28) This commit fixes PnodeRefEntity and ServiceDeliveryPointEntity to comply with ESPI 4.0 XSD specification. Both entities extend Object (not IdentifiedObject) and therefore should use Long IDs instead of UUID, and should not have Atom metadata fields (timestamps, links, related_links tables). Changes: - PnodeRefEntity: Removed IdentifiedObject inheritance, changed from UUID to Long ID - ServiceDeliveryPointEntity: Removed IdentifiedObject inheritance, mRID field, changed from UUID to Long ID - PnodeRefMapper & ServiceDeliveryPointMapper: Removed BaseIdentifiedObjectMapper - Repositories: Changed from JpaRepository<Entity, UUID> to <Entity, Long> - Flyway migrations: Moved service_delivery_points and pnode_refs table creation from base migrations (V1, V3) to vendor-specific V2 files due to auto-increment syntax differences (H2/MySQL: AUTO_INCREMENT, PostgreSQL: BIGSERIAL) - Tests: Updated to remove IdentifiedObject assertions and mRID references All 550 tests passing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Contributor
Author
|
Updated PR title with conventional commit prefix. Re-running checks. |
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.
Summary
This PR implements Phase 0 of ESPI 4.0 schema compliance, fixing
PnodeRefEntityandServiceDeliveryPointEntityto correctly extendObject(notIdentifiedObject) per the ESPI 4.0 XSD specification.Changes Made
Entity Updates
IdentifiedObjectinheritance, changed from UUID to Long IDIdentifiedObjectinheritance andmridfield, changed from UUID to Long ID@GeneratedValue(strategy = GenerationType.IDENTITY)for Long IDsMapper Updates
BaseIdentifiedObjectMapperinheritanceBaseIdentifiedObjectMapperinheritance, added ignore mappings for uuid and descriptionRepository Updates
JpaRepository<Entity, UUID>toJpaRepository<Entity, Long>Longinstead ofUUIDfor IDsDatabase Migration Updates
BIGSERIAL PRIMARY KEYBIGINT AUTO_INCREMENT PRIMARY KEYaggregated_node_refs.pnode_ref_idandusage_points.service_delivery_point_idFK columns to BIGINTTest Updates
Test Results
✅ All 550 tests passing (0 failures, 0 errors)
ESPI 4.0 XSD Compliance
Per ESPI 4.0 XSD specification:
Object, notIdentifiedObjectObject, notIdentifiedObject, has NO mRID fieldObject-based entities:
Files Changed
14 files changed: 234 insertions(+), 280 deletions(-)
Core Entity Files
PnodeRefEntity.javaServiceDeliveryPointEntity.javaPnodeRefMapper.javaServiceDeliveryPointMapper.javaPnodeRefRepository.javaServiceDeliveryPointRepository.javaMigration Files
V1__Create_Base_Tables.sql- Removed service_delivery_points tableV3__Create_additiional_Base_Tables.sql- Removed pnode_refs table, updated aggregated_node_refs FKdb/vendor/h2/V2__H2_Specific_Tables.sql- Added both tables with H2 syntaxdb/vendor/mysql/V2__MySQL_Specific_Tables.sql- Added both tables with MySQL syntaxdb/vendor/postgres/V2__PostgreSQL_Specific_Tables.sql- Added both tables with PostgreSQL syntaxTest Files
PnodeRefRepositoryTest.javaServiceDeliveryPointRepositoryTest.javaapplication-test.yml- Updated Flyway test configurationBreaking Changes
Migration Strategy:
Affected tables:
service_delivery_points- Changed from CHAR(36) to BIGINT, removed IdentifiedObject columnspnode_refs- Changed from CHAR(36) to BIGINT, removed IdentifiedObject columnsaggregated_node_refs- FK columnpnode_ref_idchanged to BIGINTusage_points- FK columnservice_delivery_point_idchanged to BIGINTRelated Issues
Closes #28 (Phase 0)
Checklist
🤖 Generated with Claude Code