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.
Baseline (Spring Boot 4.0 + Java 25):
- Java: 25 (LTS - Zulu 25.28+85-CA)
- Spring Boot: 4.0.1
- Jakarta EE: 11
- Maven: 3.9+
- MapStruct: 1.6.3
- Jackson 3 XML: tools.jackson.dataformat:jackson-dataformat-xml:3.0.3
- Jackson JAXB Module: tools.jackson.module:jackson-module-jakarta-xmlbind-annotations:3.0.3
- TestContainers: 1.20.x
Testing Framework:
- JUnit: 5.x (JUnit Platform 6.0.1)
- Mockito: 5.x via @MockitoBean/@MockitoSpyBean (Spring Boot 4.0)
- AssertJ: 3.x
- Test Dependencies: Granular test starters:
spring-boot-starter-webmvc-testspring-boot-starter-data-jpa-testspring-boot-starter-validation-testspring-boot-starter-restclient-test
DTO Marshalling Approach:
- Jackson 3 (jackson-dataformat-xml) with Jakarta XML Bind annotations - Selected for all 26 phases
- Serialization Engine: Jackson XmlMapper (jackson-dataformat-xml)
- DTO Annotations: Jakarta XML Bind (JAXB 3.0) annotations (jakarta.xml.bind.annotation.*)
- Bridge Module: jackson-module-jakarta-xmlbind-annotations (enables Jackson to process JAXB annotations)
- Rationale: Combines Jackson 3's modern features and performance with JAXB's standardized annotations, leveraging Spring Boot 4's managed dependencies
IMPORTANT: All 26 phases are implemented against the Spring Boot 4.0 + Java 25 baseline established by PR #50 (merged 2025-12-29).
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
- Branch naming:
feature/schema-compliance-phase-{number}-{entity-name} - Commit, push, and create PR for each phase when completed
- Merge PR before starting next phase
Entity Ordering Principles:
- Dependency order (parents before children)
- Progress from simple to complex entities
- Field order in entities must match XSD element sequence exactly
Branch: feature/schema-compliance-phase-1-time-configuration
Dependencies: None (standalone entity) Referenced By: UsagePoint, Customer, ServiceLocation (via bidirectional Atom rel='related' links)
Tasks:
-
Entity Updates (TimeConfigurationEntity.java):
- Review field order against espi.xsd TimeConfiguration element sequence
- Verify JPA annotations match schema constraints
- Update field JavaDoc to reference XSD documentation
-
DTO Updates (TimeConfigurationDto.java):
- Match DTO field order to espi.xsd TimeConfiguration element sequence
- Verify Jakarta XML Bind annotations for XML marshalling (jakarta.xml.bind.annotation.*)
@XmlRootElement,@XmlElement,@XmlAttribute,@XmlType(propOrder)- Jackson will process these annotations via jackson-module-jakarta-xmlbind-annotations
- Add XSD constraint validation annotations
-
MapStruct Mapper Updates (TimeConfigurationMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
- Ensure field order preservation during mapping
-
Repository Updates (TimeConfigurationRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (TimeConfigurationService.java, TimeConfigurationServiceImpl.java):
- Review service methods for schema compliance
- Update any field access order to match schema sequence
-
Flyway Migration Updates:
- Update
db/migration/V1__Create_Base_Tables.sqlanddb/migration/V3__Create_additiional_Base_Tables.sql - Verify column order matches espi.xsd element sequence
- Update vendor-specific scripts if needed:
db/vendor/h2/V2__H2_Specific_Tables.sqldb/vendor/mysql/V2__MySQL_Specific_Tables.sqldb/vendor/postgres/V2__PostgreSQL_Specific_Tables.sql
- Update
-
Testing (Spring Boot 4.0 Patterns):
- Unit Tests: Update tests for TimeConfiguration entity, service, repository
- Use
@MockitoBeaninstead of deprecated@MockBean - Use
@MockitoSpyBeaninstead of deprecated@SpyBean - Add
@AutoConfigureMockMvcif using@SpringBootTestwith web layer
- Use
- Integration Tests: Add/update tests using TestContainers
- TestContainers dependency:
org.testcontainers:testcontainers-junit-jupiter(artifact ID changed in Spring Boot 4.0)
- TestContainers dependency:
- XML Marshalling Tests: Create Jackson 3 XML marshalling/unmarshalling tests with JAXB annotations
- Use pure JUnit 5 (no Spring Boot test dependencies required)
- Use Jackson XmlMapper for serialization (processes Jakarta XML Bind annotations)
- Ensure jackson-module-jakarta-xmlbind-annotations is available
- Verify element sequence matches espi.xsd
- Test round-trip serialization (marshal → unmarshal → verify equality)
- XSD Validation: Validate generated XML against espi.xsd using schema validation
- Unit Tests: Update tests for TimeConfiguration entity, service, repository
-
Commit, Push, PR:
- Stage all changes:
git add . - Commit:
git commit -m "Phase 1: TimeConfiguration schema compliance" - Push:
git push origin feature/schema-compliance-phase-1-time-configuration - Create PR and merge when approved
- Stage all changes:
Branch: feature/schema-compliance-phase-2-reading-type
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
- Add XSD constraint validation annotations
-
MapStruct Mapper Updates (ReadingTypeMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
- Handle embedded object mappings
-
Repository Updates (ReadingTypeRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (ReadingTypeService.java, ReadingTypeServiceImpl.java):
- Review service methods for schema compliance
- Update any field access order to match schema sequence
-
Flyway Migration Updates:
- Update original Flyway scripts to match espi.xsd element sequence
- Verify embedded object column order
-
Testing:
- Update unit tests for ReadingType entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate generated XML against espi.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-3-interval-reading
Dependencies: 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):
- Review field order against espi.xsd IntervalReading element sequence
- Verify embedded DateTimeInterval (timePeriod) field order
- Verify JPA annotations match schema constraints
-
DTO Updates (IntervalReadingDto.java):
- Match DTO field order to espi.xsd IntervalReading element sequence
- Verify embedded DateTimeInterval DTO
-
MapStruct Mapper Updates (IntervalReadingMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
- Handle embedded DateTimeInterval mapping
-
Repository Updates (IntervalReadingRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (IntervalReadingService.java, IntervalReadingServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match espi.xsd element sequence
-
Testing:
- Update unit tests for IntervalReading entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate generated XML against espi.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-4-reading-quality
Dependencies: IntervalReading (via Atom rel='related' links) Referenced By: None
Tasks:
-
Entity Updates (ReadingQualityEntity.java):
- Review field order against espi.xsd ReadingQuality element sequence
- Verify relationship to IntervalReading
-
DTO Updates (ReadingQualityDto.java):
- Match DTO field order to espi.xsd ReadingQuality element sequence
-
MapStruct Mapper Updates (ReadingQualityMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
-
Repository Updates (ReadingQualityRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (ReadingQualityService.java, ReadingQualityServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match espi.xsd element sequence
-
Testing:
- Update unit tests for ReadingQuality entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate generated XML against espi.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-5-interval-block
Dependencies: IntervalReading (contains collection), ReadingQuality (indirectly via IntervalReading) Referenced By: MeterReading (via bidirectional Atom rel='related' links)
Tasks:
-
Entity Updates (IntervalBlockEntity.java):
- Review field order against espi.xsd IntervalBlock element sequence
- Verify embedded DateTimeInterval (interval) field order
- Verify IntervalReading collection mapping and order
- Verify @OneToMany cascade and orphanRemoval settings
-
DTO Updates (IntervalBlockDto.java):
- Match DTO field order to espi.xsd IntervalBlock element sequence
- Verify IntervalReading collection DTO
-
MapStruct Mapper Updates (IntervalBlockMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
- Handle IntervalReading collection mapping
-
Repository Updates (IntervalBlockRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (IntervalBlockService.java, IntervalBlockServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match espi.xsd element sequence
-
Testing:
- Update unit tests for IntervalBlock entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate generated XML against espi.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-6-meter-reading
Dependencies: 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):
- Review field order against espi.xsd MeterReading element sequence
- Verify @ManyToOne relationship to UsagePoint
- Verify @OneToOne relationship to ReadingType (via Atom links, NOT embedded)
- Verify relationship to IntervalBlock collection (via Atom links, NOT embedded)
- Ensure NO embedded child elements exist
-
DTO Updates (MeterReadingDto.java):
- Match DTO field order to espi.xsd MeterReading element sequence
- Verify ReadingType reference (Atom link, not embedded)
- Verify IntervalBlock references (Atom links, not embedded collection)
-
MapStruct Mapper Updates (MeterReadingMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
- Handle ReadingType and IntervalBlock reference mappings (NOT embedded objects)
-
Repository Updates (MeterReadingRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (MeterReadingService.java, MeterReadingServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match espi.xsd element sequence
-
Testing:
- Update unit tests for MeterReading entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate that XML output contains ONLY Atom links, NO embedded elements
- Validate generated XML against espi.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-7-service-delivery-point
Dependencies: None (standalone ESPI resource) Referenced By: UsagePoint (via @OneToOne)
Tasks:
-
Entity Updates (ServiceDeliveryPointEntity.java):
- Review field order against espi.xsd ServiceDeliveryPoint element sequence
- Verify JPA annotations match schema constraints
-
DTO Updates (ServiceDeliveryPointDto.java):
- Match DTO field order to espi.xsd ServiceDeliveryPoint element sequence
-
MapStruct Mapper Updates (ServiceDeliveryPointMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
-
Repository Updates (ServiceDeliveryPointRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (ServiceDeliveryPointService.java, ServiceDeliveryPointServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match espi.xsd element sequence
-
Testing:
- Update unit tests for ServiceDeliveryPoint entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate generated XML against espi.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-8-pnode-ref
Dependencies: None (embedded in UsagePoint) Referenced By: UsagePoint (via collection)
Tasks:
-
Entity Updates (PnodeRefEntity.java):
- Review field order against espi.xsd PnodeRef element sequence
-
DTO Updates (PnodeRefDto.java):
- Match DTO field order to espi.xsd PnodeRef element sequence
-
MapStruct Mapper Updates (PnodeRefMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
-
Repository Updates (PnodeRefRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (PnodeRefService.java, PnodeRefServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match espi.xsd element sequence
-
Testing:
- Update unit tests for PnodeRef entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate generated XML against espi.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-9-aggregated-node-ref
Dependencies: None (embedded in UsagePoint) Referenced By: UsagePoint (via collection)
Tasks:
-
Entity Updates (AggregatedNodeRefEntity.java):
- Review field order against espi.xsd AggregatedNodeRef element sequence
-
DTO Updates (AggregatedNodeRefDto.java):
- Match DTO field order to espi.xsd AggregatedNodeRef element sequence
-
MapStruct Mapper Updates (AggregatedNodeRefMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
-
Repository Updates (AggregatedNodeRefRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (AggregatedNodeRefService.java, AggregatedNodeRefServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match espi.xsd element sequence
-
Testing:
- Update unit tests for AggregatedNodeRef entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate generated XML against espi.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-10-line-item
Dependencies: None (embedded child of UsageSummary) Referenced By: UsageSummary (via costAdditionalDetailLastPeriod embedded collection)
Tasks:
-
Entity Updates (LineItemEntity.java):
- Review field order against espi.xsd LineItem element sequence
- Verify embedded relationship to UsageSummary
-
DTO Updates (LineItemDto.java):
- Match DTO field order to espi.xsd LineItem element sequence
-
MapStruct Mapper Updates (LineItemMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
-
Repository Updates (LineItemRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (LineItemService.java, LineItemServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match espi.xsd element sequence
-
Testing:
- Update unit tests for LineItem entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate generated XML against espi.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-11-usage-summary
Dependencies: LineItem (embedded child via costAdditionalDetailLastPeriod) Referenced By: UsagePoint (via bidirectional Atom rel='related' links)
Tasks:
-
Entity Updates (UsageSummaryEntity.java):
- Review field order against espi.xsd UsageSummary element sequence
- Verify embedded DateTimeInterval fields (billingPeriod, etc.)
- Verify embedded SummaryMeasurement fields
- Verify LineItem collection (costAdditionalDetailLastPeriod)
-
DTO Updates (UsageSummaryDto.java):
- Match DTO field order to espi.xsd UsageSummary element sequence
- Verify LineItem collection DTO
-
MapStruct Mapper Updates (UsageSummaryMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
- Handle LineItem collection mapping
-
Repository Updates (UsageSummaryRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (UsageSummaryService.java, UsageSummaryServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match espi.xsd element sequence
-
Testing:
- Update unit tests for UsageSummary entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate generated XML against espi.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-12-electric-power-quality-summary
Dependencies: None (standalone summary entity) Referenced By: UsagePoint (via bidirectional Atom rel='related' links)
Tasks:
-
Entity Updates (ElectricPowerQualitySummaryEntity.java):
- Review field order against espi.xsd ElectricPowerQualitySummary element sequence
- Verify embedded DateTimeInterval (summaryInterval)
- Verify embedded SummaryMeasurement fields
-
DTO Updates (ElectricPowerQualitySummaryDto.java):
- Match DTO field order to espi.xsd ElectricPowerQualitySummary element sequence
-
MapStruct Mapper Updates (ElectricPowerQualitySummaryMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
-
Repository Updates (ElectricPowerQualitySummaryRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (ElectricPowerQualitySummaryService.java, ElectricPowerQualitySummaryServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match espi.xsd element sequence
-
Testing:
- Update unit tests for ElectricPowerQualitySummary entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate generated XML against espi.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-13-retail-customer
Dependencies: None (standalone entity) Referenced By: UsagePoint (via @ManyToOne), Subscription (via @ManyToOne)
Tasks:
-
Entity Updates (RetailCustomerEntity.java):
- Review field order against espi.xsd RetailCustomer element sequence
- Verify relationships to UsagePoint collection
- Verify relationships to Subscription collection
-
DTO Updates (RetailCustomerDto.java):
- Match DTO field order to espi.xsd RetailCustomer element sequence
-
MapStruct Mapper Updates (RetailCustomerMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
-
Repository Updates (RetailCustomerRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (RetailCustomerService.java, RetailCustomerServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match espi.xsd element sequence
-
Testing:
- Update unit tests for RetailCustomer entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate generated XML against espi.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-14-subscription
Dependencies: RetailCustomer (via @ManyToOne) Referenced By: UsagePoint (via @ManyToMany and @OneToOne)
Tasks:
-
Entity Updates (SubscriptionEntity.java):
- Review field order against espi.xsd Subscription element sequence
- Verify relationship to RetailCustomer
- Verify @ManyToMany relationship to UsagePoint collection
- Verify @OneToOne relationship to single UsagePoint
-
DTO Updates (SubscriptionDto.java):
- Match DTO field order to espi.xsd Subscription element sequence
-
MapStruct Mapper Updates (SubscriptionMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
-
Repository Updates (SubscriptionRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (SubscriptionService.java, SubscriptionServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match espi.xsd element sequence
-
Testing:
- Update unit tests for Subscription entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate generated XML against espi.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-15-batch-list
Dependencies: None (standalone entity) Referenced By: None
Tasks:
-
Entity Updates (BatchListEntity.java):
- Review field order against espi.xsd BatchList element sequence
-
DTO Updates (BatchListDto.java):
- Match DTO field order to espi.xsd BatchList element sequence
-
MapStruct Mapper Updates (BatchListMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
-
Repository Updates (BatchListRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (BatchListService.java, BatchListServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match espi.xsd element sequence
-
Testing:
- Update unit tests for BatchList entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate generated XML against espi.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-16-usage-point
Dependencies: 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):
- Review field order against espi.xsd UsagePoint element sequence
- Verify embedded SummaryMeasurement fields (estimatedLoad, nominalServiceVoltage, ratedCurrent, ratedPower)
- Verify @OneToOne relationship to ServiceDeliveryPoint
- Verify @ManyToOne relationship to RetailCustomer
- Verify @ManyToOne relationship to TimeConfiguration (via Atom links)
- Verify @OneToMany relationships: MeterReading, UsageSummary, ElectricPowerQualitySummary, PnodeRef, AggregatedNodeRef collections
- Verify @ManyToMany relationship to Subscription collection
- Verify @OneToOne relationship to single Subscription
-
DTO Updates (UsagePointDto.java):
- Match DTO field order to espi.xsd UsagePoint element sequence
-
MapStruct Mapper Updates (UsagePointMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
- Handle all embedded and related entity mappings
-
Repository Updates (UsagePointRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (UsagePointService.java, UsagePointServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match espi.xsd element sequence
-
Testing:
- Update unit tests for UsagePoint entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate generated XML against espi.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-17-program-date-id-mappings
Dependencies: None (standalone entity) Referenced By: CustomerAgreement (via bidirectional Atom rel='related' links)
Tasks:
-
Entity Updates (ProgramDateIdMappingsEntity.java):
- Review field order against customer.xsd ProgramDateIdMappings element sequence
- Verify JPA annotations match schema constraints
-
DTO Updates (ProgramDateIdMappingsDto.java):
- Match DTO field order to customer.xsd ProgramDateIdMappings element sequence
- Verify Jakarta XML Bind annotations for XML marshalling (jakarta.xml.bind.annotation.*)
@XmlRootElement,@XmlElement,@XmlAttribute,@XmlType(propOrder)- Jackson will process these annotations via jackson-module-jakarta-xmlbind-annotations
-
MapStruct Mapper Updates (ProgramDateIdMappingsMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
-
Repository Updates (ProgramDateIdMappingsRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (ProgramDateIdMappingsService.java, ProgramDateIdMappingsServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match customer.xsd element sequence
-
Testing:
- Update unit tests for ProgramDateIdMappings entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate generated XML against customer.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-18-customer-account
Dependencies: 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):
- Review field order against customer.xsd CustomerAccount element sequence
- Verify embedded AccountNotification field order
-
DTO Updates (CustomerAccountDto.java):
- Match DTO field order to customer.xsd CustomerAccount element sequence
-
MapStruct Mapper Updates (CustomerAccountMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
-
Repository Updates (CustomerAccountRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (CustomerAccountService.java, CustomerAccountServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match customer.xsd element sequence
-
Testing:
- Update unit tests for CustomerAccount entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate generated XML against customer.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-19-statement
Dependencies: None (standalone entity) Referenced By: Customer (via bidirectional Atom rel='related' links), CustomerAccount (via bidirectional Atom rel='related' links)
Tasks:
-
Entity Updates (StatementEntity.java):
- Review field order against customer.xsd Statement element sequence
- Verify embedded DateTimeInterval (billingPeriod) field order
- Verify embedded SummaryMeasurement fields
-
DTO Updates (StatementDto.java):
- Match DTO field order to customer.xsd Statement element sequence
-
MapStruct Mapper Updates (StatementMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
-
Repository Updates (StatementRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (StatementService.java, StatementServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match customer.xsd element sequence
-
Testing:
- Update unit tests for Statement entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate generated XML against customer.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-20-customer
Dependencies: 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):
- Review field order against customer.xsd Customer element sequence
- Verify embedded Organisation fields (organisation, residence)
- Verify embedded Status, Priority fields
- Verify relationships to TimeConfiguration, Statement, CustomerAccount
-
DTO Updates (CustomerDto.java):
- Match DTO field order to customer.xsd Customer element sequence
-
MapStruct Mapper Updates (CustomerMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
-
Repository Updates (CustomerRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (CustomerService.java, CustomerServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match customer.xsd element sequence
-
Testing:
- Update unit tests for Customer entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate generated XML against customer.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-21-service-supplier
Dependencies: None (standalone entity) Referenced By: CustomerAgreement (via bidirectional Atom rel='related' links)
Tasks:
-
Entity Updates (ServiceSupplierEntity.java):
- Review field order against customer.xsd ServiceSupplier element sequence
- Verify embedded Organisation fields
-
DTO Updates (ServiceSupplierDto.java):
- Match DTO field order to customer.xsd ServiceSupplier element sequence
-
MapStruct Mapper Updates (ServiceSupplierMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
-
Repository Updates (ServiceSupplierRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (ServiceSupplierService.java, ServiceSupplierServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match customer.xsd element sequence
-
Testing:
- Update unit tests for ServiceSupplier entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate generated XML against customer.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-22-asset
Dependencies: None (base class for EndDevice) Referenced By: EndDevice (subclass)
Tasks:
-
Entity Updates (AssetEntity.java):
- Review field order against customer.xsd Asset element sequence
- Verify embedded Status field order
- Verify JPA @Inheritance and @DiscriminatorColumn annotations
-
DTO Updates (AssetDto.java):
- Match DTO field order to customer.xsd Asset element sequence
-
MapStruct Mapper Updates (AssetMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
-
Repository Updates (AssetRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (AssetService.java, AssetServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match customer.xsd element sequence
-
Testing:
- Update unit tests for Asset entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate generated XML against customer.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-23-service-location
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
- Verify embedded StreetAddress fields (mainAddress, secondaryAddress)
- Verify embedded ElectronicAddress field
- Verify embedded Status field
- Verify relationship to TimeConfiguration (via Atom links)
- Verify UsagePoint href URL storage (String field, NOT Atom link)
- Verify relationship to EndDevice (via Atom links)
-
DTO Updates (ServiceLocationDto.java):
- Match DTO field order to customer.xsd ServiceLocation element sequence
- Verify UsagePoint href URL field
-
MapStruct Mapper Updates (ServiceLocationMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
-
Repository Updates (ServiceLocationRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (ServiceLocationService.java, ServiceLocationServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match customer.xsd element sequence
-
Testing:
- Update unit tests for ServiceLocation entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate that UsagePoint reference is href URL string, NOT Atom link
- Validate generated XML against customer.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-24-customer-agreement
Dependencies: 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):
- Review field order against customer.xsd CustomerAgreement element sequence
- Verify embedded DateTimeInterval (validityInterval) field order
- Verify relationships to CustomerAccount, ServiceLocation, ServiceSupplier, ProgramDateIdMappings
-
DTO Updates (CustomerAgreementDto.java):
- Match DTO field order to customer.xsd CustomerAgreement element sequence
-
MapStruct Mapper Updates (CustomerAgreementMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
-
Repository Updates (CustomerAgreementRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (CustomerAgreementService.java, CustomerAgreementServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match customer.xsd element sequence
-
Testing:
- Update unit tests for CustomerAgreement entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate generated XML against customer.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-25-end-device
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
- Verify inheritance from AssetEntity
- Verify embedded Status, Organisation.ElectronicAddress fields
- Verify relationship to ServiceLocation (via Atom links)
-
DTO Updates (EndDeviceDto.java):
- Match DTO field order to customer.xsd EndDevice element sequence
-
MapStruct Mapper Updates (EndDeviceMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
-
Repository Updates (EndDeviceRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (EndDeviceService.java, EndDeviceServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match customer.xsd element sequence
-
Testing:
- Update unit tests for EndDevice entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate bidirectional Atom link with ServiceLocation
- Validate generated XML against customer.xsd
-
Commit, Push, PR
Branch: feature/schema-compliance-phase-26-meter
Dependencies: EndDevice (base class), ServiceLocation (inherited from EndDevice via Atom links) Referenced By: None
Tasks:
-
Entity Updates (MeterEntity.java):
- Review field order against customer.xsd Meter element sequence
- Verify inheritance from EndDeviceEntity
- Verify Meter-specific fields (formNumber, intervalLength)
-
DTO Updates (MeterDto.java):
- Match DTO field order to customer.xsd Meter element sequence
-
MapStruct Mapper Updates (MeterMapper.java):
- Update Entity-to-DTO conversion mapping
- Update DTO-to-Entity conversion mapping
-
Repository Updates (MeterRepository.java):
- Keep ONLY index field queries
- Remove all non-index queries not required for tests
-
Service Updates (MeterService.java, MeterServiceImpl.java):
- Review service methods for schema compliance
-
Flyway Migration Updates:
- Update original Flyway scripts to match customer.xsd element sequence
-
Testing:
- Update unit tests for Meter entity, service, repository
- Add/update integration tests using TestContainers
- Add XML marshalling/unmarshalling tests to verify schema compliance
- Validate generated XML against customer.xsd
-
Commit, Push, PR
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 with Jakarta XML Bind (JAXB 3.0) annotations
- Bidirectional MapStruct mapper updates (Entity-to-DTO and DTO-to-Entity)
- Repository query simplification (index fields only)
- Service method schema compliance review
- Flyway migration script updates (original scripts, no new scripts)
- Comprehensive testing including Jackson 3 XML marshalling/unmarshalling and XSD validation
- Git workflow (branch, commit, push, PR merge)
Processing Order:
- Usage domain first (Phases 1-16)
- Customer domain second (Phases 17-26)
- Dependency order (parents before children)
- Simple to complex entities within each dependency level
Key Notes:
- MeterReading has NO child elements, ONLY Atom links
- ServiceLocation (customer.xsd) references UsagePoint (espi.xsd) via href URL string, NOT Atom link (cross-stream reference)
- UsageSummary contains LineItem collection (costAdditionalDetailLastPeriod)
- EndDevice and ServiceLocation have bidirectional Atom rel='related' links
- CustomerAgreement has bidirectional Atom links with ServiceSupplier, ServiceLocation, and ProgramDateIdMappings
- Statement has bidirectional Atom links with both Customer and CustomerAccount
- Customer has bidirectional Atom links with TimeConfiguration, Statement, and CustomerAccount
Git Branch Naming Pattern:
feature/schema-compliance-phase-{number}-{entity-name}
Test Requirements (Spring Boot 4.0 + Java 25):
- Unit Tests: Entity, service, repository tests using:
@MockitoBean(NOT@MockBean- deprecated in Spring Boot 4.0)@MockitoSpyBean(NOT@SpyBean- deprecated in Spring Boot 4.0)@AutoConfigureMockMvcannotation required when using@SpringBootTestwith web layer
- Integration Tests: TestContainers for MySQL, PostgreSQL, H2
- Dependency:
org.testcontainers:testcontainers-junit-jupiter(artifact ID changed fromjunit-jupiter)
- Dependency:
- XML Marshalling Tests: Jackson 3 XML marshalling/unmarshalling tests for ALL 26 phases
- Pure JUnit 5 tests (no Spring Boot test dependencies needed)
- Use Jackson XmlMapper (from jackson-dataformat-xml)
- DTOs use Jakarta XML Bind annotations (jakarta.xml.bind.annotation.*)
- Requires jackson-module-jakarta-xmlbind-annotations module
- Verify XSD element sequence compliance
- Test round-trip serialization
- XSD Schema Validation:
- Usage domain (Phases 1-16): Validate against
espi.xsd - Customer domain (Phases 17-26): Validate against
customer.xsd
- Usage domain (Phases 1-16): Validate against
Spring Boot 4.0 Migration Notes:
- Test annotation package relocations:
@WebMvcTest:org.springframework.boot.webmvc.test.autoconfigure(moved fromorg.springframework.boot.test.autoconfigure.web.servlet)@DataJpaTest:org.springframework.boot.data.jpa.test.autoconfigure(moved fromorg.springframework.boot.test.autoconfigure.orm.jpa)
- Granular test dependencies replace single
spring-boot-starter-test - See
.junie/guidelines.mdfor comprehensive Spring Boot 4.0 test migration guidance