Skip to content

Commit 2280256

Browse files
authored
feat: ESPI 4.0 Schema Compliance - Phase 20: Customer with JAXB Infrastructure (#90)
Completes Phase 20 Customer schema compliance and establishes JAXB infrastructure. JAXB Infrastructure: - Domain-specific export services with namespace isolation - OffsetDateTimeAdapter for unmarshalling support - CustomerAtomEntryDto and UsageAtomEntryDto for domain isolation - EspiNamespacePrefixMapper for namespace prefix control - Converted all DTOs from records to classes Phase 20 Customer Verification: - CustomerEntity field order matches customer.xsd - CustomerDto field order matches customer.xsd - All embedded objects verified (Organisation, Status, Priority) - Fixed critical Flyway migration bug (status_value index) Testing: - 38 tests passing (unit + integration) - MySQL 8.0 and PostgreSQL 18 integration tests - All embedded object persistence verified Related to #28 Foundation for #89
1 parent 0ece445 commit 2280256

73 files changed

Lines changed: 5516 additions & 3188 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

openespi-common/pom.xml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -300,17 +300,7 @@
300300
<groupId>commons-codec</groupId>
301301
<artifactId>commons-codec</artifactId>
302302
</dependency>
303-
<!-- Jakarta / Jackson XML Binding Dependencies -->
304-
<dependency>
305-
<groupId>tools.jackson.dataformat</groupId>
306-
<artifactId>jackson-dataformat-xml</artifactId>
307-
<version>${jackson-bom.version}</version>
308-
</dependency>
309-
<dependency>
310-
<groupId>tools.jackson.module</groupId>
311-
<artifactId>jackson-module-jakarta-xmlbind-annotations</artifactId>
312-
<version>${jackson-bom.version}</version>
313-
</dependency>
303+
<!-- Jakarta JAXB XML Binding Dependencies (removed Jackson XML) -->
314304
<dependency>
315305
<groupId>jakarta.xml.bind</groupId>
316306
<artifactId>jakarta.xml.bind-api</artifactId>

openespi-common/src/main/java/org/greenbuttonalliance/espi/common/dto/BillingChargeSourceDto.java

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,48 +20,35 @@
2020
package org.greenbuttonalliance.espi.common.dto;
2121

2222
import jakarta.xml.bind.annotation.*;
23+
import lombok.AllArgsConstructor;
24+
import lombok.Getter;
25+
import lombok.NoArgsConstructor;
26+
import lombok.Setter;
2327

2428
/**
25-
* BillingChargeSource DTO record for JAXB XML marshalling/unmarshalling.
29+
* BillingChargeSource DTO class for JAXB XML marshalling/unmarshalling.
2630
* <p>
2731
* Information about the source of billing charge.
2832
* Per ESPI 4.0 XSD (espi.xsd:1628-1643), BillingChargeSource extends Object
2933
* and contains a single agencyName field.
3034
* <p>
3135
* Embedded within UsageSummary DTO.
3236
*/
33-
@XmlAccessorType(XmlAccessType.PROPERTY)
37+
@Getter
38+
@Setter
39+
@NoArgsConstructor
40+
@AllArgsConstructor
41+
@XmlAccessorType(XmlAccessType.FIELD)
3442
@XmlType(name = "BillingChargeSource", namespace = "http://naesb.org/espi", propOrder = {
3543
"agencyName"
3644
})
37-
public record BillingChargeSourceDto(
38-
String agencyName
39-
) {
40-
45+
public class BillingChargeSourceDto {
4146
/**
4247
* Name of the billing source agency.
4348
* Maximum length 256 characters per String256 type.
4449
*/
4550
@XmlElement(name = "agencyName")
46-
public String getAgencyName() {
47-
return agencyName;
48-
}
49-
50-
/**
51-
* Default constructor for JAXB.
52-
*/
53-
public BillingChargeSourceDto() {
54-
this(null);
55-
}
56-
57-
/**
58-
* Constructor with agency name.
59-
*
60-
* @param agencyName the name of the billing source agency
61-
*/
62-
public BillingChargeSourceDto(String agencyName) {
63-
this.agencyName = agencyName;
64-
}
51+
private String agencyName;
6552

6653
/**
6754
* Checks if this billing charge source has a value.

openespi-common/src/main/java/org/greenbuttonalliance/espi/common/dto/RationalNumberDto.java

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,33 @@
2222
import jakarta.xml.bind.annotation.XmlAccessType;
2323
import jakarta.xml.bind.annotation.XmlAccessorType;
2424
import jakarta.xml.bind.annotation.XmlType;
25+
import lombok.AllArgsConstructor;
26+
import lombok.Getter;
27+
import lombok.NoArgsConstructor;
28+
import lombok.Setter;
29+
2530
import java.math.BigInteger;
2631

2732
/**
28-
* RationalNumber DTO record for JAXB XML marshalling/unmarshalling.
29-
*
33+
* RationalNumber DTO class for JAXB XML marshalling/unmarshalling.
34+
*
3035
* Represents a rational number with numerator and denominator components
3136
* as defined in the NAESB ESPI standard.
32-
*
37+
*
3338
* @author Green Button Alliance
3439
* @version 1.4.0
3540
* @since Spring Boot 3.5
3641
*/
3742
@XmlAccessorType(XmlAccessType.FIELD)
3843
@XmlType(name = "RationalNumber", propOrder = { "numerator", "denominator" })
39-
public record RationalNumberDto(
40-
BigInteger numerator,
41-
BigInteger denominator
42-
) {
43-
/**
44-
* Default constructor for JAXB compatibility.
45-
*/
46-
public RationalNumberDto() {
47-
this(null, null);
48-
}
49-
44+
@Getter
45+
@Setter
46+
@NoArgsConstructor
47+
@AllArgsConstructor
48+
public class RationalNumberDto {
49+
private BigInteger numerator;
50+
private BigInteger denominator;
51+
5052
/**
5153
* Constructor with numerator only (denominator defaults to 1).
5254
*

openespi-common/src/main/java/org/greenbuttonalliance/espi/common/dto/ReadingInterharmonicDto.java

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,36 @@
2222
import jakarta.xml.bind.annotation.XmlAccessType;
2323
import jakarta.xml.bind.annotation.XmlAccessorType;
2424
import jakarta.xml.bind.annotation.XmlType;
25+
import lombok.AllArgsConstructor;
26+
import lombok.Getter;
27+
import lombok.NoArgsConstructor;
28+
import lombok.Setter;
29+
2530
import java.math.BigInteger;
2631

2732
/**
28-
* ReadingInterharmonic DTO record for JAXB XML marshalling/unmarshalling.
29-
*
33+
* ReadingInterharmonic DTO class for JAXB XML marshalling/unmarshalling.
34+
*
3035
* Represents an interharmonic measurement with numerator and denominator components
3136
* as defined in the NAESB ESPI standard for power quality measurements.
32-
*
37+
*
3338
* Interharmonics are sinusoidal components with frequencies that are not integer
3439
* multiples of the fundamental frequency. They can cause distortion in power systems.
35-
*
40+
*
3641
* @author Green Button Alliance
3742
* @version 1.4.0
3843
* @since Spring Boot 3.5
3944
*/
4045
@XmlAccessorType(XmlAccessType.FIELD)
4146
@XmlType(name = "ReadingInterharmonic", propOrder = { "numerator", "denominator" })
42-
public record ReadingInterharmonicDto(
43-
BigInteger numerator,
44-
BigInteger denominator
45-
) {
46-
/**
47-
* Default constructor for JAXB compatibility.
48-
*/
49-
public ReadingInterharmonicDto() {
50-
this(null, null);
51-
}
52-
47+
@Getter
48+
@Setter
49+
@NoArgsConstructor
50+
@AllArgsConstructor
51+
public class ReadingInterharmonicDto {
52+
private BigInteger numerator;
53+
private BigInteger denominator;
54+
5355
/**
5456
* Constructor with numerator only (denominator defaults to 1).
5557
*

openespi-common/src/main/java/org/greenbuttonalliance/espi/common/dto/SummaryMeasurementDto.java

Lines changed: 30 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -20,87 +20,71 @@
2020
package org.greenbuttonalliance.espi.common.dto;
2121

2222
import jakarta.xml.bind.annotation.*;
23+
import lombok.AllArgsConstructor;
24+
import lombok.Getter;
25+
import lombok.NoArgsConstructor;
26+
import lombok.Setter;
2327

2428
/**
25-
* SummaryMeasurement DTO record for JAXB XML marshalling/unmarshalling.
26-
*
29+
* SummaryMeasurement DTO class for JAXB XML marshalling/unmarshalling.
30+
*
2731
* Represents an aggregated summary measurement reading used in various
2832
* ESPI resources like UsagePoint, UsageSummary, etc.
29-
*
33+
*
3034
* Contains value, unit of measure, power of ten multiplier, timestamp, and readingTypeRef.
31-
*
35+
*
3236
* IMPORTANT: readingTypeRef business rules per NAESB ESPI standard:
3337
* - If UsagePoint atom 'related' readingType href URL is present: readingTypeRef is redundant and should be null/omitted
3438
* - If no 'related' readingType href URL exists: readingTypeRef should default to the atom 'self' link's href URL
3539
*/
36-
@XmlAccessorType(XmlAccessType.PROPERTY)
40+
@Getter
41+
@Setter
42+
@NoArgsConstructor
43+
@AllArgsConstructor
44+
@XmlAccessorType(XmlAccessType.FIELD)
3745
@XmlType(name = "SummaryMeasurement", namespace = "http://naesb.org/espi", propOrder = {
3846
"powerOfTenMultiplier", "timeStamp", "uom", "value", "readingTypeRef"
3947
})
40-
public record SummaryMeasurementDto(
41-
42-
String powerOfTenMultiplier,
43-
Long timeStamp,
44-
String uom,
45-
Long value,
46-
String readingTypeRef
47-
) {
48-
48+
public class SummaryMeasurementDto {
49+
4950
/**
50-
* Gets the power of ten multiplier for the measurement.
51+
* Power of ten multiplier for the measurement.
5152
* Used to scale the value (e.g., "3" for kilo, "6" for mega).
5253
*/
5354
@XmlElement(name = "powerOfTenMultiplier")
54-
public String getPowerOfTenMultiplier() {
55-
return powerOfTenMultiplier;
56-
}
57-
55+
private String powerOfTenMultiplier;
56+
5857
/**
59-
* Gets the timestamp when this measurement was taken.
58+
* Timestamp when this measurement was taken.
6059
* Stored as epoch seconds (TimeType in ESPI).
6160
*/
6261
@XmlElement(name = "timeStamp")
63-
public Long getTimeStamp() {
64-
return timeStamp;
65-
}
66-
62+
private Long timeStamp;
63+
6764
/**
68-
* Gets the unit of measure for this measurement.
65+
* Unit of measure for this measurement.
6966
* Examples: "W" (watts), "V" (volts), "A" (amperes).
7067
*/
7168
@XmlElement(name = "uom")
72-
public String getUom() {
73-
return uom;
74-
}
75-
69+
private String uom;
70+
7671
/**
77-
* Gets the measurement value.
72+
* Measurement value.
7873
* Combined with powerOfTenMultiplier to get the actual value.
7974
*/
8075
@XmlElement(name = "value")
81-
public Long getValue() {
82-
return value;
83-
}
84-
76+
private Long value;
77+
8578
/**
86-
* Gets the reading type reference (URI).
79+
* Reading type reference (URI).
8780
* Extension reference to a full ReadingType resource.
88-
*
81+
*
8982
* BUSINESS RULE: Per NAESB ESPI standard:
9083
* - Returns null if UsagePoint atom 'related' readingType href URL is present (redundant)
9184
* - Returns atom 'self' link href URL if no 'related' readingType href exists
9285
*/
9386
@XmlElement(name = "readingTypeRef")
94-
public String getReadingTypeRef() {
95-
return readingTypeRef;
96-
}
97-
98-
/**
99-
* Default constructor for JAXB.
100-
*/
101-
public SummaryMeasurementDto() {
102-
this(null, null, null, null, null);
103-
}
87+
private String readingTypeRef;
10488

10589
/**
10690
* Constructor with value and unit of measure.

0 commit comments

Comments
 (0)