You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Review Current Usage and Customer Entity Classes to ensure they match their ESPI Schema XSD files #28
The following Usage Entity files extend IdentifiedObject, but extend Object in the ESPI Usage schema:
Entity
Current Definition
Schema Definition
AggregatedNodeRefEntity
IdentifiedObject
Object
BatchListEntity
IdentifiedObject
BatchListType
IntervalReadingEntity
IdentifiedObject
Object
LineItemEntity
IdentifiedObject
Object
PnodeRefEntity
IdentifiedObject
Object
ReadingQualityEntity
IdentifiedObject
Object
RetailCustomerEntity
IdentifiedObject
Object (Not Defined by espi.xsd)
ServiceDeliveryPointEntity
IdentifiedObject
Object
The above-listed Entities are not ESPI Resources and therefore should not be wrapped in Atom Protocol statements but should be emitted as elements of an existing ESPI Resource. Consequently, they should be associated collections within their related ESPI Resources.
The BatchListEntity is a standalone XML message and not related to any ESPI Resource.
Reverting the above not to extend IdentifiedObject will affect the following directories and classes:
This plan reviews domain entities in /domain/usage, /domain/customer, and /domain/common to ensure compliance with NAESB ESPI 4.0 schema (espi.xsd and customer.xsd) element sequences.
Excluded Entities (already completed):
ApplicationInformationEntity
AuthorizationEntity
Processing Order:
Usage domain entities (Phases 1-16)
Customer domain entities (Phases 17-26)
Branch Strategy:
Each phase uses a separate feature branch for single entity and all associated files
Dependencies: None (standalone entity with embedded RationalNumber and ReadingInterharmonic) Referenced By: MeterReading (via Atom rel='related' links), IntervalBlock (indirectly via MeterReading)
Tasks:
Entity Updates (ReadingTypeEntity.java):
Review field order against espi.xsd ReadingType element sequence
Verify embedded RationalNumber and ReadingInterharmonic field order
Verify JPA @AttributeOverrides match schema constraints
Ensure JAXB annotations align with XML element names and order
DTO Updates (ReadingTypeDto.java):
Match DTO field order to espi.xsd ReadingType element sequence
Verify embedded RationalNumber and ReadingInterharmonic DTOs
Dependencies: TimeConfiguration (via bidirectional Atom rel='related' links), UsagePoint (cross-stream reference via href URL from espi.xsd), EndDevice (via bidirectional Atom rel='related' links) Referenced By: CustomerAgreement (via bidirectional Atom rel='related' links), EndDevice (via bidirectional Atom rel='related' links)
Note: ServiceLocation exists in customer.xsd PII data stream, UsagePoint exists in espi.xsd non-PII data stream. ServiceLocation stores UsagePoint's rel="self" href URL directly, NOT via Atom link element.
Tasks:
Entity Updates (ServiceLocationEntity.java):
Review field order against customer.xsd ServiceLocation element sequence
Dependencies: Asset (base class), ServiceLocation (via bidirectional Atom rel='related' links) Referenced By: Meter (subclass), ServiceLocation (via bidirectional Atom rel='related' links)
Note: EndDevice and ServiceLocation have bidirectional Atom rel='related' links. Since ServiceLocation is processed in Phase 23, the EndDevice → ServiceLocation link will be added in this phase.
Tasks:
Entity Updates (EndDeviceEntity.java):
Review field order against customer.xsd EndDevice element sequence
This 26-phase plan ensures comprehensive schema compliance review for all NAESB ESPI 4.0 domain entities and associated classes. Each phase focuses on a single entity and includes:
Entity field order verification against XSD schema
DTO field order verification and JAXB annotations
Bidirectional MapStruct mapper updates (Entity-to-DTO and DTO-to-Entity)
✅ EndDevice - Fully compliant with customer.xsd lines 539-881
✅ All Customer DTOs - Strictly XSD-compliant (no Atom metadata)
✅ All Usage DTOs - Strictly XSD-compliant (no Atom metadata)
✅ AtomEntryDto Pattern - Properly separates Atom protocol from ESPI resources
✅ MapStruct Mappings - Correct ignore patterns for id fields
✅ Service Layer - Proper entity.id ↔ AtomEntryDto.id mapping
Next Steps
This phase completes EndDevice implementation. The issue remains open for:
Additional entity reviews as needed
Tracking remaining XSD compliance work across other entities
Pull Request:#96 Branch:feature/schema-compliance-phase-21-service-supplier Status: Ready for review
Overview
Phase 21 implements full ESPI 4.0 schema compliance for ServiceSupplier and refactors all Organisation phone number handling from the legacy PhoneNumberEntity polymorphic table pattern to embedded TelephoneNumber fields. This comprehensive update affects ServiceSupplier, Customer, CustomerAccount, ServiceLocation, and all related infrastructure.
Key Achievements
1. New DTOs (JAXB/XML Marshalling)
Created three standalone DTOs with proper JAXB annotations:
Why Critical: ESPI standard uses ordinal values (0-5) for serialization. Sequence must match XSD exactly for compatibility with ESPI Sandbox and CMD Certification Platform.
4. Phone Number Architecture Refactoring
From: PhoneNumberEntity polymorphic table with discriminator column To: Embedded TelephoneNumber fields (phone1, phone2)
SupplierKind enum values changed to match XSD specification
Any code referencing deleted classes needs updates
⚠️Migration Required:
Existing deployments must run Flyway migrations. Data in phone_numbers table will be lost if not manually migrated before deployment.
Activity
dfcoffin commentedon Dec 26, 2025
Multi-Phase NAESB ESPI Schema Compliance Plan
Overview
This plan reviews domain entities in
/domain/usage,/domain/customer, and/domain/commonto ensure compliance with NAESB ESPI 4.0 schema (espi.xsd and customer.xsd) element sequences.Excluded Entities (already completed):
Processing Order:
Branch Strategy:
feature/schema-compliance-phase-{number}-{entity-name}Entity Ordering Principles:
Usage Domain Entities (Phases 1-16)
Phase 1: TimeConfiguration (LocalTimeParameters)
Branch:
feature/schema-compliance-phase-1-time-configurationDependencies: None (standalone entity)
Referenced By: UsagePoint, Customer, ServiceLocation (via bidirectional Atom rel='related' links)
Tasks:
Entity Updates (TimeConfigurationEntity.java):
DTO Updates (TimeConfigurationDto.java):
MapStruct Mapper Updates (TimeConfigurationMapper.java):
Repository Updates (TimeConfigurationRepository.java):
Service Updates (TimeConfigurationService.java, TimeConfigurationServiceImpl.java):
Flyway Migration Updates:
db/migration/V1__Create_Base_Tables.sqlanddb/migration/V3__Create_additiional_Base_Tables.sqldb/vendor/h2/V2__H2_Specific_Tables.sqldb/vendor/mysql/V2__MySQL_Specific_Tables.sqldb/vendor/postgres/V2__PostgreSQL_Specific_Tables.sqlTesting:
Commit, Push, PR:
git add .git commit -m "Phase 1: TimeConfiguration schema compliance"git push origin feature/schema-compliance-phase-1-time-configurationPhase 2: ReadingType
Branch:
feature/schema-compliance-phase-2-reading-typeDependencies: None (standalone entity with embedded RationalNumber and ReadingInterharmonic)
Referenced By: MeterReading (via Atom rel='related' links), IntervalBlock (indirectly via MeterReading)
Tasks:
Entity Updates (ReadingTypeEntity.java):
DTO Updates (ReadingTypeDto.java):
MapStruct Mapper Updates (ReadingTypeMapper.java):
Repository Updates (ReadingTypeRepository.java):
Service Updates (ReadingTypeService.java, ReadingTypeServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 3: IntervalReading
Branch:
feature/schema-compliance-phase-3-interval-readingDependencies: None (embedded DateTimeInterval, owned by IntervalBlock)
Referenced By: IntervalBlock (via collection, parent owns child), ReadingQuality (via Atom rel='related' links)
Tasks:
Entity Updates (IntervalReadingEntity.java):
DTO Updates (IntervalReadingDto.java):
MapStruct Mapper Updates (IntervalReadingMapper.java):
Repository Updates (IntervalReadingRepository.java):
Service Updates (IntervalReadingService.java, IntervalReadingServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 4: ReadingQuality
Branch:
feature/schema-compliance-phase-4-reading-qualityDependencies: IntervalReading (via Atom rel='related' links)
Referenced By: None
Tasks:
Entity Updates (ReadingQualityEntity.java):
DTO Updates (ReadingQualityDto.java):
MapStruct Mapper Updates (ReadingQualityMapper.java):
Repository Updates (ReadingQualityRepository.java):
Service Updates (ReadingQualityService.java, ReadingQualityServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 5: IntervalBlock
Branch:
feature/schema-compliance-phase-5-interval-blockDependencies: IntervalReading (contains collection), ReadingQuality (indirectly via IntervalReading)
Referenced By: MeterReading (via bidirectional Atom rel='related' links)
Tasks:
Entity Updates (IntervalBlockEntity.java):
DTO Updates (IntervalBlockDto.java):
MapStruct Mapper Updates (IntervalBlockMapper.java):
Repository Updates (IntervalBlockRepository.java):
Service Updates (IntervalBlockService.java, IntervalBlockServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 6: MeterReading
Branch:
feature/schema-compliance-phase-6-meter-readingDependencies: ReadingType (via Atom rel='related' links), IntervalBlock (via bidirectional Atom rel='related' links)
Referenced By: UsagePoint (via bidirectional Atom rel='related' links)
Note: MeterReading has NO child elements, ONLY Atom links to IntervalBlock and ReadingType
Tasks:
Entity Updates (MeterReadingEntity.java):
DTO Updates (MeterReadingDto.java):
MapStruct Mapper Updates (MeterReadingMapper.java):
Repository Updates (MeterReadingRepository.java):
Service Updates (MeterReadingService.java, MeterReadingServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 7: ServiceDeliveryPoint
Branch:
feature/schema-compliance-phase-7-service-delivery-pointDependencies: None (standalone ESPI resource)
Referenced By: UsagePoint (via @OnetoOne)
Tasks:
Entity Updates (ServiceDeliveryPointEntity.java):
DTO Updates (ServiceDeliveryPointDto.java):
MapStruct Mapper Updates (ServiceDeliveryPointMapper.java):
Repository Updates (ServiceDeliveryPointRepository.java):
Service Updates (ServiceDeliveryPointService.java, ServiceDeliveryPointServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 8: PnodeRef
Branch:
feature/schema-compliance-phase-8-pnode-refDependencies: None (embedded in UsagePoint)
Referenced By: UsagePoint (via collection)
Tasks:
Entity Updates (PnodeRefEntity.java):
DTO Updates (PnodeRefDto.java):
MapStruct Mapper Updates (PnodeRefMapper.java):
Repository Updates (PnodeRefRepository.java):
Service Updates (PnodeRefService.java, PnodeRefServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 9: AggregatedNodeRef
Branch:
feature/schema-compliance-phase-9-aggregated-node-refDependencies: None (embedded in UsagePoint)
Referenced By: UsagePoint (via collection)
Tasks:
Entity Updates (AggregatedNodeRefEntity.java):
DTO Updates (AggregatedNodeRefDto.java):
MapStruct Mapper Updates (AggregatedNodeRefMapper.java):
Repository Updates (AggregatedNodeRefRepository.java):
Service Updates (AggregatedNodeRefService.java, AggregatedNodeRefServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 10: LineItem
Branch:
feature/schema-compliance-phase-10-line-itemDependencies: None (embedded child of UsageSummary)
Referenced By: UsageSummary (via costAdditionalDetailLastPeriod embedded collection)
Tasks:
Entity Updates (LineItemEntity.java):
DTO Updates (LineItemDto.java):
MapStruct Mapper Updates (LineItemMapper.java):
Repository Updates (LineItemRepository.java):
Service Updates (LineItemService.java, LineItemServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 11: UsageSummary
Branch:
feature/schema-compliance-phase-11-usage-summaryDependencies: LineItem (embedded child via costAdditionalDetailLastPeriod)
Referenced By: UsagePoint (via bidirectional Atom rel='related' links)
Tasks:
Entity Updates (UsageSummaryEntity.java):
DTO Updates (UsageSummaryDto.java):
MapStruct Mapper Updates (UsageSummaryMapper.java):
Repository Updates (UsageSummaryRepository.java):
Service Updates (UsageSummaryService.java, UsageSummaryServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 12: ElectricPowerQualitySummary
Branch:
feature/schema-compliance-phase-12-electric-power-quality-summaryDependencies: None (standalone summary entity)
Referenced By: UsagePoint (via bidirectional Atom rel='related' links)
Tasks:
Entity Updates (ElectricPowerQualitySummaryEntity.java):
DTO Updates (ElectricPowerQualitySummaryDto.java):
MapStruct Mapper Updates (ElectricPowerQualitySummaryMapper.java):
Repository Updates (ElectricPowerQualitySummaryRepository.java):
Service Updates (ElectricPowerQualitySummaryService.java, ElectricPowerQualitySummaryServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 13: RetailCustomer
Branch:
feature/schema-compliance-phase-13-retail-customerDependencies: None (standalone entity)
Referenced By: UsagePoint (via @manytoone), Subscription (via @manytoone)
Tasks:
Entity Updates (RetailCustomerEntity.java):
DTO Updates (RetailCustomerDto.java):
MapStruct Mapper Updates (RetailCustomerMapper.java):
Repository Updates (RetailCustomerRepository.java):
Service Updates (RetailCustomerService.java, RetailCustomerServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 14: Subscription
Branch:
feature/schema-compliance-phase-14-subscriptionDependencies: RetailCustomer (via @manytoone)
Referenced By: UsagePoint (via @manytomany and @OnetoOne)
Tasks:
Entity Updates (SubscriptionEntity.java):
DTO Updates (SubscriptionDto.java):
MapStruct Mapper Updates (SubscriptionMapper.java):
Repository Updates (SubscriptionRepository.java):
Service Updates (SubscriptionService.java, SubscriptionServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 15: BatchList
Branch:
feature/schema-compliance-phase-15-batch-listDependencies: None (standalone entity)
Referenced By: None
Tasks:
Entity Updates (BatchListEntity.java):
DTO Updates (BatchListDto.java):
MapStruct Mapper Updates (BatchListMapper.java):
Repository Updates (BatchListRepository.java):
Service Updates (BatchListService.java, BatchListServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 16: UsagePoint
Branch:
feature/schema-compliance-phase-16-usage-pointDependencies: ServiceDeliveryPoint, PnodeRef, AggregatedNodeRef, TimeConfiguration (via Atom links), MeterReading (via Atom links), UsageSummary (via Atom links), ElectricPowerQualitySummary (via Atom links), RetailCustomer (via @manytoone), Subscription (via @manytomany and @OnetoOne)
Referenced By: ServiceLocation (cross-stream href reference from customer.xsd PII stream)
Tasks:
Entity Updates (UsagePointEntity.java):
DTO Updates (UsagePointDto.java):
MapStruct Mapper Updates (UsagePointMapper.java):
Repository Updates (UsagePointRepository.java):
Service Updates (UsagePointService.java, UsagePointServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Customer Domain Entities (Phases 17-26)
Phase 17: ProgramDateIdMappings
Branch:
feature/schema-compliance-phase-17-program-date-id-mappingsDependencies: None (standalone entity)
Referenced By: CustomerAgreement (via bidirectional Atom rel='related' links)
Tasks:
Entity Updates (ProgramDateIdMappingsEntity.java):
DTO Updates (ProgramDateIdMappingsDto.java):
MapStruct Mapper Updates (ProgramDateIdMappingsMapper.java):
Repository Updates (ProgramDateIdMappingsRepository.java):
Service Updates (ProgramDateIdMappingsService.java, ProgramDateIdMappingsServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 18: CustomerAccount
Branch:
feature/schema-compliance-phase-18-customer-accountDependencies: None (standalone entity)
Referenced By: CustomerAgreement (via bidirectional Atom rel='related' links), Statement (via bidirectional Atom rel='related' links), Customer (via bidirectional Atom rel='related' links)
Tasks:
Entity Updates (CustomerAccountEntity.java):
DTO Updates (CustomerAccountDto.java):
MapStruct Mapper Updates (CustomerAccountMapper.java):
Repository Updates (CustomerAccountRepository.java):
Service Updates (CustomerAccountService.java, CustomerAccountServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 19: Statement
Branch:
feature/schema-compliance-phase-19-statementDependencies: None (standalone entity)
Referenced By: Customer (via bidirectional Atom rel='related' links), CustomerAccount (via bidirectional Atom rel='related' links)
Tasks:
Entity Updates (StatementEntity.java):
DTO Updates (StatementDto.java):
MapStruct Mapper Updates (StatementMapper.java):
Repository Updates (StatementRepository.java):
Service Updates (StatementService.java, StatementServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 20: Customer
Branch:
feature/schema-compliance-phase-20-customerDependencies: TimeConfiguration (via bidirectional Atom rel='related' links), Statement (via bidirectional Atom rel='related' links), CustomerAccount (via bidirectional Atom rel='related' links)
Referenced By: None
Tasks:
Entity Updates (CustomerEntity.java):
DTO Updates (CustomerDto.java):
MapStruct Mapper Updates (CustomerMapper.java):
Repository Updates (CustomerRepository.java):
Service Updates (CustomerService.java, CustomerServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 21: ServiceSupplier
Branch:
feature/schema-compliance-phase-21-service-supplierDependencies: None (standalone entity)
Referenced By: CustomerAgreement (via bidirectional Atom rel='related' links)
Tasks:
Entity Updates (ServiceSupplierEntity.java):
DTO Updates (ServiceSupplierDto.java):
MapStruct Mapper Updates (ServiceSupplierMapper.java):
Repository Updates (ServiceSupplierRepository.java):
Service Updates (ServiceSupplierService.java, ServiceSupplierServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 22: Asset
Branch:
feature/schema-compliance-phase-22-assetDependencies: None (base class for EndDevice)
Referenced By: EndDevice (subclass)
Tasks:
Entity Updates (AssetEntity.java):
DTO Updates (AssetDto.java):
MapStruct Mapper Updates (AssetMapper.java):
Repository Updates (AssetRepository.java):
Service Updates (AssetService.java, AssetServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 23: ServiceLocation
Branch:
feature/schema-compliance-phase-23-service-locationDependencies: TimeConfiguration (via bidirectional Atom rel='related' links), UsagePoint (cross-stream reference via href URL from espi.xsd), EndDevice (via bidirectional Atom rel='related' links)
Referenced By: CustomerAgreement (via bidirectional Atom rel='related' links), EndDevice (via bidirectional Atom rel='related' links)
Note: ServiceLocation exists in customer.xsd PII data stream, UsagePoint exists in espi.xsd non-PII data stream. ServiceLocation stores UsagePoint's rel="self" href URL directly, NOT via Atom link element.
Tasks:
Entity Updates (ServiceLocationEntity.java):
DTO Updates (ServiceLocationDto.java):
MapStruct Mapper Updates (ServiceLocationMapper.java):
Repository Updates (ServiceLocationRepository.java):
Service Updates (ServiceLocationService.java, ServiceLocationServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 24: CustomerAgreement
Branch:
feature/schema-compliance-phase-24-customer-agreementDependencies: CustomerAccount (via bidirectional Atom rel='related' links), ServiceLocation (via bidirectional Atom rel='related' links), ServiceSupplier (via bidirectional Atom rel='related' links), ProgramDateIdMappings (via bidirectional Atom rel='related' links)
Referenced By: ServiceSupplier (via bidirectional Atom rel='related' links), ServiceLocation (via bidirectional Atom rel='related' links), ProgramDateIdMappings (via bidirectional Atom rel='related' links)
Tasks:
Entity Updates (CustomerAgreementEntity.java):
DTO Updates (CustomerAgreementDto.java):
MapStruct Mapper Updates (CustomerAgreementMapper.java):
Repository Updates (CustomerAgreementRepository.java):
Service Updates (CustomerAgreementService.java, CustomerAgreementServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 25: EndDevice
Branch:
feature/schema-compliance-phase-25-end-deviceDependencies: Asset (base class), ServiceLocation (via bidirectional Atom rel='related' links)
Referenced By: Meter (subclass), ServiceLocation (via bidirectional Atom rel='related' links)
Note: EndDevice and ServiceLocation have bidirectional Atom rel='related' links. Since ServiceLocation is processed in Phase 23, the EndDevice → ServiceLocation link will be added in this phase.
Tasks:
Entity Updates (EndDeviceEntity.java):
DTO Updates (EndDeviceDto.java):
MapStruct Mapper Updates (EndDeviceMapper.java):
Repository Updates (EndDeviceRepository.java):
Service Updates (EndDeviceService.java, EndDeviceServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Phase 26: Meter
Branch:
feature/schema-compliance-phase-26-meterDependencies: EndDevice (base class), ServiceLocation (inherited from EndDevice via Atom links)
Referenced By: None
Tasks:
Entity Updates (MeterEntity.java):
DTO Updates (MeterDto.java):
MapStruct Mapper Updates (MeterMapper.java):
Repository Updates (MeterRepository.java):
Service Updates (MeterService.java, MeterServiceImpl.java):
Flyway Migration Updates:
Testing:
Commit, Push, PR
Summary
This 26-phase plan ensures comprehensive schema compliance review for all NAESB ESPI 4.0 domain entities and associated classes. Each phase focuses on a single entity and includes:
Processing Order:
Key Notes:
Git Branch Naming Pattern:
feature/schema-compliance-phase-{number}-{entity-name}Test Requirements:
Add multi-phase ESPI schema compliance plan and reference diagrams
Add multi-phase ESPI schema compliance plan and reference diagrams (#49
docs: Add DTO pattern guide and update schema compliance plan
refactor: remove 11 incorrect related_links tables (Issue #28 Phase A)
refactor: ESPI 4.0 Schema Compliance - Phase 0: Fix Object-based enti…
refactor: ESPI 4.0 Schema Compliance - Phase 0: Fix Object-based enti…
dfcoffin commentedon Jan 7, 2026
Only Phase 1 and 2 have been completed
refactor: Phase 2 - ReadingType ESPI 4.0 schema compliance (field order)
dfcoffin commentedon Jan 8, 2026
Phase 2 Complete: ReadingType Schema Compliance ✅
Completed: ReadingType field ordering to match ESPI 4.0 XSD specification (espi.xsd:382-481)
Changes Merged (PR #67):
timeAttribute → tou → uom → cpp → interharmonic → measuringPeriod → argumentdescriptionfrom ReadingType propOrder (belongs to IdentifiedObject/Atom wrapper)Progress: Phase 2 of 26 completed
Next: Phase 3 - IntervalReading schema compliance
Part of ESPI 4.0 Schema Compliance - Multi-Phase Plan
dfcoffin commentedon Jan 8, 2026
Phase 3 Completed ✅
IntervalReadingEntity has been updated to comply with ESPI 4.0 schema (espi.xsd:1016).
Changes Merged in PR #68
IntervalReadingEntity:
@GeneratedValue(strategy = GenerationType.IDENTITY)Database Migrations:
interval_readingstable to useBIGINT AUTO_INCREMENT(MySQL/H2) orBIGSERIAL(PostgreSQL)reading_qualities.interval_reading_idFK fromCHAR(36)toBIGINTTest Results:
Updated Status
Next Steps
Remaining entities to update:
Related: Phase 3 tracked in multi-phase compliance plan
Commit: b9127e2
48 remaining items
dfcoffin commentedon Jan 29, 2026
Phase 25: EndDevice - Complete ✅
Phase 25 implementation is complete with full ESPI 4.0 XSD compliance for EndDevice entity.
Pull Request
feature/schema-compliance-phase-25-end-devicePhase 25 Deliverables
1. EndDevice Implementation
2. XSD Compliance Verification
EndDevice 16 Fields (customer.xsd):
All fields properly mapped to:
3. Test Coverage
Unit Tests (18 tests):
Integration Tests (16 tests):
4. Integration Tests Backfill
Created 8 integration test files for Phases 18, 23, 24, 25:
ESPI 4.0 DTO Cleanup (Critical Achievement)
All DTOs Now Strictly XSD-Compliant
Cleaned 13 DTOs across customer and usage domains:
Customer Domain (4 DTOs):
Usage Domain (9 DTOs):
Changes Applied
idfield (Long) from all DTOsuuidfield (String) from all DTOs@Mapping(target = "id", ignore = true)in toEntity methods onlyBug Fixes
1. NotificationMethodKind Enum Alignment
Issue: Java enum values didn't match customer.xsd specification
Before:
After (matches XSD lines 1961-1996):
2. JAXB OffsetDateTime Marshalling
Issue: OffsetDateTime fields serializing as empty XML elements
Fix: Added
@XmlJavaTypeAdapter(OffsetDateTimeAdapter.class)to:Result: Proper ISO-8601 timestamp serialization
3. Test Constructor Fixes
Fixed 46 constructor calls across 16 test files to match cleaned DTO signatures.
Test Results
Database Migration
ESPI 4.0 Compliance Status
✅ EndDevice - Fully compliant with customer.xsd lines 539-881
✅ All Customer DTOs - Strictly XSD-compliant (no Atom metadata)
✅ All Usage DTOs - Strictly XSD-compliant (no Atom metadata)
✅ AtomEntryDto Pattern - Properly separates Atom protocol from ESPI resources
✅ MapStruct Mappings - Correct ignore patterns for id fields
✅ Service Layer - Proper entity.id ↔ AtomEntryDto.id mapping
Next Steps
This phase completes EndDevice implementation. The issue remains open for:
Files Changed: 60 files
Lines Added: 4,310 insertions
Lines Removed: 406 deletions
New Files: 16
🤖 Generated with Claude Code
feat: ESPI 4.0 Schema Compliance - Phase 24: CustomerAgreement Comple…
feat: ESPI 4.0 Schema Compliance - Phase 21: ServiceSupplier Complete…
dfcoffin commentedon Jan 31, 2026
Phase 21: ServiceSupplier Complete Implementation ✅
Pull Request: #96
Branch:
feature/schema-compliance-phase-21-service-supplierStatus: Ready for review
Overview
Phase 21 implements full ESPI 4.0 schema compliance for ServiceSupplier and refactors all Organisation phone number handling from the legacy PhoneNumberEntity polymorphic table pattern to embedded TelephoneNumber fields. This comprehensive update affects ServiceSupplier, Customer, CustomerAccount, ServiceLocation, and all related infrastructure.
Key Achievements
1. New DTOs (JAXB/XML Marshalling)
Created three standalone DTOs with proper JAXB annotations:
All DTOs follow the XSD-compliant pattern: NO IdentifiedObject fields (id, uuid) - these are handled by AtomEntryDto.
2. New MapStruct Mappers
Implemented three mappers for entity ↔ DTO conversion:
3. SupplierKind Enum Fix (Critical)
Issue: Enum values didn't match customer.xsd specification (lines 2231-2271)
Before (WRONG):
After (CORRECT - matches XSD):
Why Critical: ESPI standard uses ordinal values (0-5) for serialization. Sequence must match XSD exactly for compatibility with ESPI Sandbox and CMD Certification Platform.
4. Phone Number Architecture Refactoring
From: PhoneNumberEntity polymorphic table with discriminator column
To: Embedded TelephoneNumber fields (phone1, phone2)
Benefits:
Entities Updated:
Organisation- Added phone1/phone2 embedded fieldsServiceSupplierEntity- 16 phone @AttributeOverride annotationsCustomerEntity- 16 phone @AttributeOverride annotationsCustomerAccountEntity- 16 phone @AttributeOverride annotationsServiceLocationEntity- Already had embedded phones, sizes optimized5. TelephoneNumber Column Size Optimization
Issue: MySQL row size limit (65,535 bytes) exceeded with VARCHAR(256) columns
Solution: Optimized column sizes based on actual data requirements:
Impact: Reduced row size by ~1,648 bytes per embedded Organisation (2 phones × 8 fields × 103 bytes saved per field)
6. Legacy Code Cleanup
Deleted Files (No Longer Needed):
OrganisationRole.java- Unused wrapper with no additional fieldsPhoneNumberEntity.java- Replaced with embedded TelephoneNumberPhoneNumberService.java- Service for managing PhoneNumberEntity relationshipsMapper Cleanup:
extends BaseMapperUtilsfromCustomerMapper(wasn't using any methods)extends BaseMapperUtilsfromServiceSupplierMapper(wasn't using any methods)BaseMapperUtils.classfromElectricPowerQualitySummaryMapperuses clauseDTO Cleanup:
usagePointIdfield fromElectricPowerQualitySummaryDto(@XmlTransient field serving no purpose)Issue Resolved: Spring bean conflict -
NoUniqueBeanDefinitionExceptionwhen multiple mappers extended BaseMapperUtils7. Database Migration Updates
File:
V3__Create_additiional_Base_Tables.sqlChanges:
service_supplierstablecustomerstablecustomer_accountstableservice_locationstablephone_numberstable (no longer needed)Column Naming Pattern:
8. Mapper Updates
CustomerMapper.java:
@Mapping(target = "phoneNumbers", ignore = true)extractPhoneByType()method (30+ lines)mapOrganisationToDto()to use direct phone1/phone2 mappingtelephoneNumberToDto()helper methodServiceLocationMapper.java:
TelephoneNumberMapper.classto uses clausemapTelephone()methods9. DtoExportService Updates
File:
DtoExportServiceImpl.javaChanges:
ServiceSupplierMapperinjectionServiceSupplierDto.classin CustomerExportService JAXBContext@XmlElementfor ServiceSupplier inCustomerAtomEntryDto.javaResult: ServiceSupplier can now be properly marshalled to XML with correct namespace and element name
New Tests (24 Tests Added)
ServiceSupplierDtoTest (8 tests)
shouldMarshalServiceSupplierWithAllFields()shouldMarshalServiceSupplierWithMinimalFields()shouldUnmarshalServiceSupplierXml()shouldHandleNullFields()shouldVerifyXmlNamespaceAndElements()shouldVerifySupplierKindEnumValues()shouldVerifyServiceSupplierFieldOrder()shouldMarshalWithEmbeddedOrganisation()OrganisationDtoTest (8 tests)
shouldMarshalOrganisationWithAllFields()shouldMarshalOrganisationWithMinimalFields()shouldUnmarshalOrganisationXml()shouldHandleNullFields()shouldVerifyXmlNamespaceAndElements()shouldVerifyOrganisationFieldOrder()shouldMarshalWithEmbeddedPhoneNumbers()shouldMarshalWithEmbeddedAddresses()TelephoneNumberDtoTest (8 tests)
shouldMarshalTelephoneNumberWithAllFields()shouldMarshalTelephoneNumberWithMinimalFields()shouldUnmarshalTelephoneNumberXml()shouldHandleNullFields()shouldVerifyXmlNamespaceAndElements()shouldVerifyTelephoneNumberFieldOrder()shouldFormatInternationalNumber()shouldFormatNorthAmericanNumber()Test Results
Test Count Evolution:
Breaking Changes
phone_numberstable removedservice_suppliers,customers,customer_accountstablesservice_locationstablePhoneNumberEntity,OrganisationRole,PhoneNumberServicedeletedSupplierKindenum values changed to match XSD specificationExisting deployments must run Flyway migrations. Data in
phone_numberstable will be lost if not manually migrated before deployment.Files Changed
Total: 34 files changed
Created (6 files):
Deleted (3 files):
Modified (25 files):
ESPI 4.0 Compliance Status
✅ ServiceSupplier - Fully compliant with customer.xsd lines 1159-1186
✅ Organisation - Fully compliant with customer.xsd lines 1089-1125
✅ TelephoneNumber - Fully compliant with customer.xsd lines 1428-1478
✅ SupplierKind - Enum matches XSD lines 2231-2271 (correct sequence for ordinal serialization)
✅ ServiceSupplierDto - Strictly XSD-compliant (no Atom metadata)
✅ OrganisationDto - Strictly XSD-compliant with embedded phone1/phone2
✅ TelephoneNumberDto - All 8 XSD fields implemented
✅ AtomEntryDto Pattern - Properly separates Atom protocol from ESPI resources
✅ MapStruct Mappings - Correct ignore patterns, no BaseMapperUtils conflicts
✅ Embedded Pattern - XSD-compliant, type-safe, performant
Next Steps
Phase 21 is complete. This issue remains open for:
Upcoming Phases:
🤖 Generated with Claude Code
feat: ESPI 4.0 Schema Compliance - Phase 21: ServiceSupplier Complete…
docs: Update Phase 17 plan to include EndDevice and Meter in Phase A0
feat: Issue #97 - Standardize relatedLinks Infrastructure with Compos…
feat: Phase 17 (Part 1) - ProgramDateIdMapping Core Structure
feat: ESPI 4.0 Schema Compliance - Phase 17: ProgramDateIdMappings C-…
feat: ESPI 4.0 Schema Compliance - Phase 17: ProgramDateIdMappings Co…
dfcoffin commentedon Feb 2, 2026
Phase 17: ProgramDateIdMappings - ✅ COMPLETE
PR: #100 (Merged)
Merge Commit:
18a8e8bbStatus: All tasks completed and merged into main
Completed Tasks:
Test Results:
Implementation Notes:
Next Phase: Phase 18 (CustomerAccount) - Ready to begin
feat: ESPI 4.0 Schema Compliance - Phase 19: Statement Complete Imple…
dfcoffin commentedon Feb 3, 2026
✅ Phase 19: Statement - COMPLETE
PR #102 Merged: #102
Implementation Summary
Schema Compliance
Entity Enhancements
Repository & Service
Testing
All Phases Complete! 🎉
This completes the full ESPI 4.0 Schema Compliance effort for customer.xsd entities.
🤖 Generated with Claude Code
feat: ESPI 4.0 Schema Compliance - Phase 19: Statement Complete Imple…