Skip to content

Conversation

@dfcoffin
Copy link
Contributor

Summary

Implements full ESPI 4.0 compliance for the Meter resource per customer.xsd specification.

Key Changes

New Shared Embeddables (domain/customer/common/):

  • ElectronicAddress (customer.xsd lines 886-936)
  • StreetAddress (customer.xsd lines 1285-1320)
  • TelephoneNumber (customer.xsd lines 1428-1478)
  • MeterMultiplier (customer.xsd MeterMultiplier type)

Meter Implementation:

  • MeterEntity: Added meterMultipliers @ElementCollection
  • MeterDto: Added 19 XSD-compliant fields including meterMultipliers collection
  • MeterMultiplierDto: New DTO for meter multiplier embeddable
  • MeterMapper: MapStruct mapper with UUID v5 generation pattern
  • MeterService: Simplified to 6 CRUD methods (ESPI 4.0 pattern)
  • MeterRepository: Removed 11 non-ID query methods
  • Flyway V3: Added meter_multipliers collection table
  • TestDataBuilders: Added createValidMeter() helper method

Refactoring:

  • Extracted Organisation nested classes to standalone embeddables
  • Updated all affected entities to use extracted embeddables
  • Updated all affected mappers to import new embeddables
  • Applied JDK 25 pattern: individual @AttributeOverride annotations

Testing:

  • MeterDtoTest: 6+ XML marshalling tests
  • MeterRepositoryTest: 16 comprehensive unit tests
  • MeterMySQLIntegrationTest: 9 integration tests
  • MeterPostgreSQLIntegrationTest: 9 integration tests
  • BigDecimal assertions: Use isEqualByComparingTo() for cross-platform precision tolerance
  • All 736 tests passing

Documentation:

  • CLAUDE.md: Added file modification best practices (NEVER use sed/awk, ALWAYS use Edit tool with diffs)

Test Plan

  • All 736 unit tests passing
  • MeterRepositoryTest: 16 tests covering CRUD operations, Meter-specific fields, EndDevice inherited fields
  • Integration tests: 18 tests across MySQL and PostgreSQL (9 each)
  • MeterDtoTest: 6+ XML marshalling tests
  • Cross-platform BigDecimal precision tolerance verified
  • Flyway migration applied successfully (meter_multipliers table created)
  • TestDataBuilders.createValidMeter() working in all tests

Files Changed

  • 49 files changed, 3708 insertions(+), 1534 deletions(-)
  • 4 new embeddable classes (domain/customer/common/)
  • 1 new enum (MeterMultiplierKind)
  • 3 new test files (MeterDtoTest, MeterMySQLIntegrationTest, MeterPostgreSQLIntegrationTest)
  • Updated 39 existing files (entities, DTOs, mappers, services, repositories, tests)

🤖 Generated with Claude Code

…ation

Implements full ESPI 4.0 compliance for Meter resource per customer.xsd.

Changes:
- Extracted shared embeddables to domain/customer/common/:
  * ElectronicAddress (customer.xsd lines 886-936)
  * StreetAddress (customer.xsd lines 1285-1320)
  * TelephoneNumber (customer.xsd lines 1428-1478)
  * MeterMultiplier (customer.xsd MeterMultiplier type)
- MeterEntity: Added meterMultipliers @ElementCollection
- MeterDto: Added 19 XSD-compliant fields including meterMultipliers
- MeterMultiplierDto: New DTO for meter multiplier collection
- MeterMapper: MapStruct mapper with UUID v5 generation
- MeterService: Simplified to 6 CRUD methods (ESPI 4.0 pattern)
- MeterRepository: Removed 11 non-ID query methods
- Flyway V3: Added meter_multipliers collection table
- TestDataBuilders: Added createValidMeter() helper
- Tests: 16 unit tests + 18 integration tests (MySQL/PostgreSQL)
- BigDecimal assertions: Use isEqualByComparingTo() for cross-platform precision
- CLAUDE.md: Added file modification best practices (NEVER use sed/awk)

Updated entities to use extracted embeddables:
- Organisation, Asset, Location, CustomerEntity, CustomerAccountEntity,
  CustomerAgreementEntity, EndDeviceEntity, OrganisationRole,
  ServiceLocationEntity and all related mappers and tests

All 736 tests passing.

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@dfcoffin dfcoffin merged commit 4e48626 into main Jan 30, 2026
5 checks passed
@dfcoffin dfcoffin deleted the feature/schema-compliance-phase-26-meter branch January 30, 2026 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants