Conversation
…4.0 compliance Comprehensive verification and fixes for 6 embeddable classes in domain/common: **Critical Type Fixes (XSD Compliance)**: - SummaryMeasurement: Changed String → UnitMultiplierKind/UnitSymbolKind enums - powerOfTenMultiplier: String → UnitMultiplierKind (UInt16 enum) - uom: String → UnitSymbolKind (UInt16 enum) - Added @Enumerated(EnumType.STRING) for proper JPA mapping - ReadingInterharmonic: Changed Long → BigInteger for xs:integer compliance - numerator, denominator: Long → BigInteger - DateTimeInterval: Fixed field order per XSD (duration first, then start) **JAXB Annotations Added** (All 6 embeddables): - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType with name, namespace, and propOrder - @xmlelement with name and namespace on all fields - Proper ESPI namespace: http://naesb.org/espi **Documentation Enhancements**: - Comprehensive Javadoc with XSD line references - equals/hashCode via @EqualsAndHashCode (Lombok) - Type mapping notes (BigInteger for xs:integer, enum types for UInt16) **Database Schema Migration**: - V1__Create_Base_Tables.sql: Changed interharmonic columns BIGINT → DECIMAL(38,0) - interharmonic_numerator: BIGINT → DECIMAL(38,0) - interharmonic_denominator: BIGINT → DECIMAL(38,0) - Aligns with BigInteger Java type for xs:integer XSD compliance **Entity Updates**: - UsageSummaryEntity.getCommodityType(): Use enum.name() instead of string - ReadingTypeEntity: Removed temporary columnDefinition overrides **Test Fixes**: - LineItemRepositoryTest: Updated to use enum types, fixed DateTimeInterval order - ReadingTypeRepositoryTest: Changed Long → BigInteger.valueOf() for interharmonic - UsageSummaryRepositoryTest: Updated enum comparisons (UnitSymbolKind.fromValue()) - Added missing imports for UnitMultiplierKind, UnitSymbolKind, BigInteger **Verification Results**: - All 6 embeddables: 100% XSD compliant (espi.xsd lines 1094-1643) - All 781 tests passing (0 failures, 0 errors) - Type safety: 15 enum fields properly mapped - JAXB: All embeddables ready for XML marshalling/unmarshalling **Embeddables Verified**: 1. RationalNumber - PASS (numerator/denominator as BigInteger) 2. DateTimeInterval - PASS (duration/start with correct order) 3. SummaryMeasurement - PASS (enum types for multiplier/uom) 4. ReadingInterharmonic - PASS (BigInteger for xs:integer) 5. BillingChargeSource - PASS (JAXB annotations added) 6. LinkType - PASS (documentation enhanced) XSD References: - SummaryMeasurement: espi.xsd lines 1094-1129 - DateTimeInterval: espi.xsd lines 1337-1357 - RationalNumber: espi.xsd lines 1406-1418 - ReadingInterharmonic: espi.xsd lines 1419-1431 - BillingChargeSource: espi.xsd lines 1628-1643 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…pace conflicts Removed JAXB annotations (@XmlType, @XmlAccessorType, @xmlelement) from entity embeddable classes to fix IllegalAnnotationsException caused by duplicate XML type names when both entity and DTO classes were loaded in the same JAXB context. Changes: - SummaryMeasurement.java: Removed all JAXB annotations - BillingChargeSource.java: Removed all JAXB annotations - RationalNumber.java: Removed all JAXB annotations - ReadingInterharmonic.java: Removed all JAXB annotations Architecture: Entity classes are for JPA persistence only. DTOs handle XML marshalling with JAXB annotations. This separation prevents namespace conflicts and follows proper DTO pattern. DateTimeInterval and LinkType keep JAXB annotations as they have no corresponding DTOs. Fixes CI/CD failure in PR #113 - DataCustodianApplicationTest now passes. All 781 openespi-common tests passing. All 3 openespi-datacustodian tests passing. Related to #101 - Phase 1: Common Embeddables ESPI 4.0 Compliance Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changed CustomerAgreement to extend Object instead of Document, with Document as an optional nested element. This aligns with proper schema composition pattern. Changes: - CustomerAgreement now extends Object (was Document) - Added optional "document" element of type Document - Removed XML comments for AssetContainer, OrganisationRole, WorkLocation This change supports proper entity modeling where CustomerAgreement is a top-level resource that composes Document information rather than inheriting from it directly. Related to #101 - Phase 1: Common Embeddables ESPI 4.0 Compliance Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Added critical architectural rule: JAXB annotations MUST only be applied to DTO classes, NEVER to entity or embeddable classes. Key points: - Entity/Embeddable classes: JPA annotations only, NO JAXB annotations - DTO classes: JAXB annotations only, NO JPA annotations - If embeddable needs XML serialization: Create DTO, don't add JAXB to entity - This rule has NO exceptions Rationale: Prevents IllegalAnnotationsException from duplicate XML type names when both entity and DTO classes are loaded in same JAXB context. This documentation codifies the architectural pattern established by fixing the JAXB namespace conflict in PR #113. Related to #101 - Phase 1: Common Embeddables ESPI 4.0 Compliance Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 1 of ESPI 4.0 schema compliance: Comprehensive verification and fixes for all 6 embeddable classes in
domain/common/.This PR ensures complete XSD alignment for embeddable value objects used throughout ESPI entities, including proper type mappings, JAXB annotations, and database schema updates.
Changes
Embeddable Classes Verified & Fixed (6 Total)
1. SummaryMeasurement (CRITICAL - Type Changes)
String→ Enum types for UInt16 fieldspowerOfTenMultiplier:String→UnitMultiplierKindenumuom:String→UnitSymbolKindenum@Enumerated(EnumType.STRING)for JPA enum persistence@EqualsAndHashCodefor value comparison2. ReadingInterharmonic (CRITICAL - Type Changes)
Long→BigIntegerfor xs:integer compliancenumerator:Long→BigIntegerdenominator:Long→BigInteger3. DateTimeInterval (CRITICAL - Field Order)
@EqualsAndHashCode4. RationalNumber (Already Fixed Earlier)
@EqualsAndHashCodeBigIntegerfor xs:integer fields5. BillingChargeSource (Minor - JAXB Only)
@Data6. LinkType (Minor - Documentation)
@EqualsAndHashCodeDatabase Schema Migration
V1__Create_Base_Tables.sql:
interharmonic_numerator:BIGINT→DECIMAL(38,0)interharmonic_denominator:BIGINT→DECIMAL(38,0)BigIntegerJava type for xs:integer XSD complianceEntity Updates
UsageSummaryEntity.java:
getCommodityType()method to useenum.name()instead of direct stringuomfield changed from String to UnitSymbolKind enumReadingTypeEntity.java:
columnDefinitionoverrides from@AttributeOverrideTest Fixes (3 Files, All Passing)
LineItemRepositoryTest.java:
SummaryMeasurementconstructor to use enum typesDateTimeIntervalfield order (duration first, start second)UnitMultiplierKind,UnitSymbolKindReadingTypeRepositoryTest.java:
Long→BigInteger.valueOf()for interharmonic fieldsBigIntegerimportUsageSummaryRepositoryTest.java:
createValidSummaryMeasurement()to use enum typesisEqualTo("72")→isEqualTo(UnitSymbolKind.fromValue(72))Verification
XSD Compliance
JAXB Configuration
@XmlAccessorType(XmlAccessType.FIELD)@XmlTypewith name, namespace, and propOrder@XmlElementwith name and namespacehttp://naesb.org/espiCode Quality
Testing
XSD References
Test Results
Test Coverage
Breaking Changes
Type Changes (Requires Attention)
SummaryMeasurement fields changed:
powerOfTenMultiplier:String→UnitMultiplierKinduom:String→UnitSymbolKindsetUom("72")→setUom(UnitSymbolKind.fromValue(72))ReadingInterharmonic fields changed:
numerator,denominator:Long→BigIntegersetNumerator(50L)→setNumerator(BigInteger.valueOf(50L))Database schema change:
interharmonic_*columnsBIGINT→DECIMAL(38,0)(backward compatible for existing data)Related Issues
Checklist
Next Steps
After this PR merges:
🤖 Generated with Claude Code