Skip to content

Latest commit

 

History

History
249 lines (205 loc) · 7.99 KB

File metadata and controls

249 lines (205 loc) · 7.99 KB

Phase 23 Progress Checkpoint

Completed Work (T1-T9)

Entity Layer - ✅ COMPLETE

  1. ServiceLocationEntity.java

    • Added status.remark @AttributeOverride (4th field)
    • Added usagePointHrefs List with @ElementCollection
    • Replaced phoneNumbers collection with embedded phone1 and phone2
    • Used repeatable @AttributeOverride (JDK 25 feature)
    • All 16 phone fields mapped (8 per phone × 2 phones)
  2. Organisation.TelephoneNumber @Embeddable Created

    • 8 fields per customer.xsd lines 1428-1478
    • countryCode, areaCode, cityCode, localNumber, ext, dialOut, internationalPrefix, ituPhone
    • Lombok @Getter/@Setter with manual equals/hashCode/toString
  3. CustomerDto.TelephoneNumberDto Created

    • 8 fields with full JAXB annotations
    • @XmlType with propOrder
    • Implements Serializable
    • Renamed from PhoneNumberDto → TelephoneNumberDto

DTO Layer - ⚠️ IN PROGRESS

  1. ServiceLocationDto.java - Partial
    • ✅ Removed 5 Atom fields (published, updated, selfLink, upLink, relatedLinks)
    • ✅ Removed description field (Atom title)
    • ✅ Removed customerAgreement relationship field
    • ✅ Removed helper methods (getSelfHref, generateSelfHref, etc.)
    • ✅ Updated imports (removed LinkDto, OffsetDateTime)
    • ❌ Missing Location fields (type, mainAddress, secondaryAddress, phone1, phone2, electronicAddress, status)
    • ❌ Missing usagePointHrefs collection field
    • ❌ Missing outageBlock field
    • ❌ PropOrder not updated

Remaining Work (T10-T23)

T10: Add Location Fields to ServiceLocationDto

Fields to Add:

// Location fields (from IdentifiedObject + Location)
@XmlElement(name = "type", namespace = "http://naesb.org/espi/customer")
private String type;

@XmlElement(name = "mainAddress", namespace = "http://naesb.org/espi/customer")
private CustomerDto.StreetAddressDto mainAddress;

@XmlElement(name = "secondaryAddress", namespace = "http://naesb.org/espi/customer")
private CustomerDto.StreetAddressDto secondaryAddress;

@XmlElement(name = "phone1", namespace = "http://naesb.org/espi/customer")
private CustomerDto.TelephoneNumberDto phone1;

@XmlElement(name = "phone2", namespace = "http://naesb.org/espi/customer")
private CustomerDto.TelephoneNumberDto phone2;

@XmlElement(name = "electronicAddress", namespace = "http://naesb.org/espi/customer")
private CustomerDto.ElectronicAddressDto electronicAddress;

@XmlElement(name = "status", namespace = "http://naesb.org/espi/customer")
private StatusDto status;

// StatusDto nested class (4 fields)
public static class StatusDto implements Serializable {
    // value, dateTime, remark, reason
}

T11: Add ServiceLocation Fields to DTO

Fields to Add:

@XmlElement(name = "UsagePoints", namespace = "http://naesb.org/espi/customer")
@XmlElementWrapper(name = "UsagePoints", namespace = "http://naesb.org/espi/customer")
private List<String> usagePointHrefs;

@XmlElement(name = "outageBlock", namespace = "http://naesb.org/espi/customer")
private String outageBlock;

T12: Update ServiceLocationDto propOrder

XSD Field Sequence:

@XmlType(name = "ServiceLocation", namespace = "http://naesb.org/espi/customer", propOrder = {
    // Location fields
    "type", "mainAddress", "secondaryAddress", "phone1", "phone2",
    "electronicAddress", "geoInfoReference", "direction", "status",
    // ServiceLocation fields
    "accessMethod", "siteAccessProblem", "needsInspection", "usagePointHrefs", "outageBlock"
})

T13: Create ServiceLocationMapper

Mapper Interface:

  • Bidirectional Entity ↔ DTO mappings
  • phone1/phone2 embedded mapping
  • usagePointHrefs collection mapping
  • All Location field mappings

T14: Clean Up ServiceLocationRepository

Remove non-index queries:

  • findLocationsThatNeedInspection
  • findLocationsWithAccessProblems
  • findByMainAddressStreetContaining
  • findByDirectionContaining
  • findByPhone1AreaCode

Keep only:

  • JpaRepository inherited methods
  • Index-based queries if needed for tests

T15: Update Flyway Migration

Add to service_locations table:

-- Status remark
status_remark VARCHAR(256),

-- Phone1 fields (8)
phone1_country_code VARCHAR(256),
phone1_area_code VARCHAR(256),
phone1_city_code VARCHAR(256),
phone1_local_number VARCHAR(256),
phone1_ext VARCHAR(256),
phone1_dial_out VARCHAR(256),
phone1_international_prefix VARCHAR(256),
phone1_itu_phone VARCHAR(256),

-- Phone2 fields (8)
phone2_country_code VARCHAR(256),
phone2_area_code VARCHAR(256),
phone2_city_code VARCHAR(256),
phone2_local_number VARCHAR(256),
phone2_ext VARCHAR(256),
phone2_dial_out VARCHAR(256),
phone2_international_prefix VARCHAR(256),
phone2_itu_phone VARCHAR(256)

Create new table:

CREATE TABLE service_location_usage_point_hrefs (
    service_location_id CHAR(36) NOT NULL,
    usage_point_href VARCHAR(512),
    FOREIGN KEY (service_location_id) REFERENCES service_locations(id)
);

Drop old table:

-- Remove phone_numbers table (replaced by embedded fields)
DROP TABLE IF EXISTS phone_numbers;

T16: Update Other Entities

Entities needing phone1/phone2 embedded:

  • CustomerEntity
  • CustomerAccountEntity
  • ServiceSupplierEntity
  • MeterEntity (extends EndDeviceEntity)

For each entity:

  1. Replace phoneNumbers collection with phone1/phone2 embedded
  2. Add 16 @AttributeOverride annotations (8 per phone)
  3. Update toString() method

T17-T20: Testing

  • Create ServiceLocationDtoTest (5+ tests)
  • Update ServiceLocationRepositoryTest
  • Run all tests (fix failures)
  • Run integration tests

T21-T23: Finalization

  • Commit and push
  • Create PR
  • Update Issue #28

Key Decisions Made

1. @Embeddable vs Separate Table for TelephoneNumber

Decision: Use @Embeddable Rationale:

  • Performance: 1 query instead of 2, no JOIN required
  • XSD alignment: phone1/phone2 are elements, not collection
  • Fixed number: Always 0-2 phones, not unbounded

2. UsagePointHrefs Collection vs Single String

Decision: Use List with @ElementCollection Rationale:

  • customer.xsd defines UsagePoints with maxOccurs="unbounded"
  • Multiple usage points can serve one service location
  • Each string stores atom:link[@rel='self']/@href URL

3. Repeatable @AttributeOverride vs @AttributeOverrides Wrapper

Decision: Use repeatable @AttributeOverride directly Rationale:

  • JDK 25 supports repeatable annotations
  • Cleaner, more readable code
  • No wrapper needed

4. StreetAddress Compliance

Decision: Defer full StreetAddress/StreetDetail/TownDetail compliance Rationale:

  • Affects 5+ entities (large scope)
  • Phase 23 already expanded significantly
  • Can be separate future phase
  • Current simplified structure functional

Session Management

Current Token Usage: ~130K / 200K Remaining Work: ~70K tokens needed Recommendation: Complete T10-T12 (DTO refactoring), then checkpoint for continuation

Next Immediate Steps

  1. Add Location fields to ServiceLocationDto (T10)
  2. Add ServiceLocation fields (usagePointHrefs, outageBlock) to DTO (T11)
  3. Update propOrder (T12)
  4. Create ServiceLocationMapper (T13)

Estimated Tokens:

  • T10-T12: ~15K tokens
  • T13: ~10K tokens
  • T14-T15: ~10K tokens
  • Tests: ~20K tokens
  • Total: ~55K tokens remaining (fits in current session)

Files Modified So Far

  1. ServiceLocationEntity.java ✅
  2. Organisation.java (added TelephoneNumber) ✅
  3. CustomerDto.java (added TelephoneNumberDto) ✅
  4. ServiceLocationDto.java (partial) ⚠️

Files to Modify

  1. ServiceLocationDto.java (complete Location fields)
  2. ServiceLocationMapper.java (create new)
  3. ServiceLocationRepository.java (clean up)
  4. V3__Create_additiional_Base_Tables.sql (add columns, tables)
  5. CustomerEntity.java (phone1/phone2)
  6. CustomerAccountEntity.java (phone1/phone2)
  7. ServiceSupplierEntity.java (phone1/phone2)
  8. MeterEntity.java (phone1/phone2)
  9. ServiceLocationDtoTest.java (create new)
  10. ServiceLocationRepositoryTest.java (update)

Total Files: 14 files to modify/create Files Complete: 3/14 (21%) Files Remaining: 11/14 (79%)