refactor: Phase 8 - PnodeRef ESPI 4.0 schema compliance#74
Merged
Conversation
Per ESPI 4.0 specification, PnodeRef extends Object (not IdentifiedObject), so it has NO Atom metadata fields. This phase aligns the mapper, repository, and tests with the XSD definition. Entity and DTO were already compliant. Changes: - PnodeRefMapper: Remove updateEntity method (read-only operations) - PnodeRefMapper: Remove MappingTarget import - PnodeRefRepository: Keep only indexed queries (findAllIds, findAllByUsagePointId) - PnodeRefRepository: Remove 9 non-indexed custom queries - PnodeRefRepository: Remove unused UsagePointEntity import - PnodeRefRepositoryTest: Add test for findAllIds() - PnodeRefRepositoryTest: Update test for renamed findAllByUsagePointId - PnodeRefRepositoryTest: Remove 9 tests for deleted queries All 529 tests pass. Entity and DTO already match XSD structure correctly. Co-Authored-By: Claude Sonnet 4.5 <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.
Summary
Phase 8 of Issue #28: Aligns PnodeRef mapper, repository, and tests with ESPI 4.0 XSD specification.
Key Finding: Per ESPI 4.0 specification (espi.xsd), PnodeRef extends Object (not IdentifiedObject), so it has NO id/uuid/mRID fields or Atom metadata. Entity and DTO were already correctly implemented.
Changes Made
Mapper Updates (PnodeRefMapper)
updateEntity()method (read-only operations only)MappingTargetimportRepository Updates (PnodeRefRepository)
findAllIds()(primary key index)findByUsagePointId()→findAllByUsagePointId()(foreign key index)findByUsagePointfindByApnodeTypefindByUsagePointAndApnodeTypefindByReffindValidByUsagePointIdfindValidByApnodeTypedeleteByUsagePointdeleteByUsagePointIdUsagePointEntityimportTest Updates (PnodeRefRepositoryTest)
findAllIds()findAllByUsagePointId()Verification
Entity & DTO Verification
✅ PnodeRefEntity already matches XSD correctly:
Long id(BIGINT primary key)✅ PnodeRefDto already matches XSD correctly:
Database Verification
✅ Flyway migrations verified in all vendor-specific V2 scripts:
db/vendor/mysql/V2__MySQL_Specific_Tables.sqldb/vendor/postgres/V2__PostgreSQL_Specific_Tables.sqldb/vendor/h2/V2__H2_Specific_Tables.sqlAll scripts create
pnode_refstable with:id BIGINTprimary keyapnode_type VARCHAR(64)ref VARCHAR(256) NOT NULLstart_effective_date BIGINTend_effective_date BIGINTusage_point_id CHAR(36) NOT NULLwith foreign keyTest Results
✅ All tests pass (PnodeRefRepositoryTest: 7 tests down to 2 indexed query tests)
✅ MySQL TestContainer integration tests pass
✅ H2 integration tests pass
Technical Notes
XSD Compliance
Per
espi.xsdline ~1539:Object base type has NO mRID attribute (unlike IdentifiedObject). This is consistent with other Object-based types like IntervalReading, ReadingQuality, and ServiceDeliveryPoint (Phase 7).
Repository Query Removal Rationale
Removed non-indexed queries following read-only CRUD pattern from Phases 5-7:
findValidBy*) and type-based queries were not indexedfindAllIds()(PK index) andfindAllByUsagePointId()(FK index)Pattern Consistency
Phase 8 follows the exact same pattern as:
All Object-based entities (not IdentifiedObject) have:
Related Issues
Testing Checklist
🤖 Generated with Claude Code