Skip to content

Conversation

@dfcoffin
Copy link
Contributor

@dfcoffin dfcoffin commented Jan 9, 2026

Summary

Phase 7 of Issue #28: Aligns ServiceDeliveryPoint DTO, mapper, and repository with ESPI 4.0 XSD specification.

Key Finding: Per ESPI 4.0 specification (espi.xsd), ServiceDeliveryPoint extends Object (not IdentifiedObject), so it has NO id/uuid/mRID fields or Atom metadata.

Changes Made

DTO Updates (ServiceDeliveryPointDto)

  • ✅ Removed Long id and String uuid fields (Object type has no mRID attribute)
  • ✅ Updated @XmlType propOrder to match XSD element sequence: name → tariffProfile → customerAgreement → tariffRiderRefs
  • ✅ Removed redundant canonical constructor (Java records auto-generate it)
  • ✅ Updated helper methods to reflect no uuid field

Mapper Updates (ServiceDeliveryPointMapper)

  • ✅ Removed @Mapping for id and uuid (fields no longer exist in DTO)
  • ✅ Added explicit mappings for all XSD elements (name, tariffProfile, customerAgreement)
  • ✅ Kept tariffRiderRefs as ignore = true (XML-only field, not persisted in entity)
  • ✅ Removed updateEntity() method (read-only operations only)
  • ✅ Removed unused import MappingTarget

Repository Updates (ServiceDeliveryPointRepository)

  • ✅ Kept only indexed query: findAllIds()
  • ✅ Removed 5 non-indexed custom queries: findByName, findByTariffProfile, findByCustomerAgreement, findByNameContaining, countByTariffProfile
  • ✅ Removed custom deleteById override (JpaRepository provides it)
  • ✅ Removed unused imports

Test Updates (ServiceDeliveryPointRepositoryTest)

  • ✅ Removed 5 test methods for deleted repository queries
  • ✅ Kept findAllIds() test (indexed query retained)
  • ✅ All 23 remaining tests pass successfully

Verification

Entity Verification

✅ ServiceDeliveryPointEntity structure already matches XSD correctly:

  • Uses Long id (BIGINT primary key)
  • Has name, tariffProfile, customerAgreement fields (all String256)
  • Does NOT extend IdentifiedObject (correct per XSD)

Database Verification

✅ Flyway migrations verified in all vendor-specific V2 scripts:

  • db/vendor/mysql/V2__MySQL_Specific_Tables.sql
  • db/vendor/postgres/V2__PostgreSQL_Specific_Tables.sql
  • db/vendor/h2/V2__H2_Specific_Tables.sql

All scripts create service_delivery_points table with correct structure and indexes.

Test Results

Tests run: 536, Failures: 0, Errors: 0, Skipped: 0

✅ All tests pass (ServiceDeliveryPointRepositoryTest: 23 tests)
✅ MySQL TestContainer integration tests pass
✅ H2 integration tests pass

Technical Notes

XSD Compliance

Per espi.xsd line ~1161:

<xs:complexType name="ServiceDeliveryPoint">
  <xs:complexContent>
    <xs:extension base="Object">
      <xs:sequence>
        <xs:element name="name" type="String256" minOccurs="0"/>
        <xs:element name="tariffProfile" type="String256" minOccurs="0"/>
        <xs:element name="customerAgreement" type="String256" minOccurs="0"/>
        <xs:element name="tariffRiderRefs" type="TariffRiderRefs" minOccurs="0"/>
      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

Object base type has NO mRID attribute (unlike IdentifiedObject which has mRID). This is consistent with other Object-based types like IntervalReading and ReadingQuality.

Repository Query Removal Rationale

Removed non-indexed queries following read-only CRUD pattern from Phases 5-6:

  • Applications only support read operations via indexed lookups
  • Custom queries like findByName, findByTariffProfile etc. were not indexed and not used
  • Kept findAllIds() as it provides indexed bulk ID retrieval

Related Issues

Testing Checklist

  • Unit tests pass (23/23 ServiceDeliveryPoint tests)
  • Integration tests pass (MySQL TestContainer)
  • Integration tests pass (H2)
  • All 536 tests in openespi-common pass
  • DTO field order matches XSD element sequence
  • Entity structure verified against XSD
  • Flyway migrations verified (all vendors)
  • No compilation warnings for ServiceDeliveryPoint files

🤖 Generated with Claude Code

Per ESPI 4.0 specification, ServiceDeliveryPoint extends Object (not
IdentifiedObject), so it has NO Atom metadata fields. This phase aligns
the DTO, mapper, and repository with the XSD definition.

Changes:
- ServiceDeliveryPointDto: Remove id/uuid fields (Object type has no mRID)
- ServiceDeliveryPointDto: Update propOrder to match XSD sequence (name, tariffProfile, customerAgreement, tariffRiderRefs)
- ServiceDeliveryPointMapper: Remove id/uuid mappings, add explicit XSD element mappings
- ServiceDeliveryPointMapper: Remove updateEntity method (read-only operations)
- ServiceDeliveryPointRepository: Keep only indexed query (findAllIds)
- ServiceDeliveryPointRepositoryTest: Remove tests for deleted custom queries

All 536 tests pass. Entity already matches XSD structure correctly.

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@dfcoffin dfcoffin merged commit 406b3c0 into main Jan 9, 2026
5 checks passed
@dfcoffin dfcoffin deleted the feature/schema-compliance-phase-7-service-delivery-point branch January 9, 2026 20:38
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