Commit fe77497
* docs: Update Phase 17 plan to include EndDevice and Meter in Phase A0
Extended Phase A0 (PREREQUISITE) to include bidirectional Atom links for
EndDevice and Meter entities in addition to the original 4 entities:
Previous (4 entities):
- CustomerAgreement
- ProgramDateIdMappings
- ServiceLocation
- ServiceSupplier
Added (2 additional entities):
- EndDevice
- Meter (inherits from EndDevice)
Investigation confirmed:
- All 6 related_links database tables exist in V3 migration
- All 6 entities lack @ElementCollection mappings for relatedLinks
- Bidirectional relationships required:
- ServiceLocation ↔ EndDevice
- ServiceLocation ↔ Meter
- CustomerAgreement ↔ ProgramDateIdMappings
- CustomerAgreement ↔ ServiceLocation
- CustomerAgreement ↔ ServiceSupplier
Per NAESB ESPI 4.0 standard, these relationships are implemented via
Atom <link rel="related"> elements, not via customer.xsd definitions.
Related to #28 (Phase 17: ProgramDateIdMappings)
* feat: Issue #97 - Standardize relatedLinks Infrastructure with Composition Pattern
Implements Issue #97 to standardize relatedLinks infrastructure across all ESPI entities
using @AssociationOverride and composition pattern with Lombok @DeleGate.
Key Changes:
- Converted Asset from @MappedSuperclass to @embeddable for composition
- Created EndDeviceFields @embeddable for 4 EndDevice-specific fields
- Refactored EndDeviceEntity and MeterEntity to use composition instead of inheritance
- Both entities now embed Asset + EndDeviceFields with @DeleGate for transparent access
- Added @AssociationOverride to 13 entities (4 usage domain + 9 customer domain)
Entity Changes:
- Usage Domain: ApplicationInformationEntity, AuthorizationEntity,
ElectricPowerQualitySummaryEntity, ReadingTypeEntity
- Customer Domain: CustomerEntity, CustomerAccountEntity, CustomerAgreementEntity,
EndDeviceEntity, MeterEntity, ProgramDateIdMappingsEntity, ServiceLocationEntity,
ServiceSupplierEntity, StatementEntity
Mapper Updates:
- EndDeviceMapper: Updated to map from nested embedded objects (asset.*, endDeviceFields.*)
- MeterMapper: Updated to map from nested embedded objects (asset.*, endDeviceFields.*)
- Required because MapStruct runs before Lombok @DeleGate generates delegation methods
Database Migrations:
- V1__Create_Base_Tables.sql: Added relatedLinks tables for usage domain entities
- V3__Create_additiional_Base_Tables.sql: Added relatedLinks tables for customer domain,
expanded meters table with all IdentifiedObject, Asset, and EndDeviceFields columns
Technical Details:
- Resolved Hibernate inheritance conflict where MeterEntity couldn't override relatedLinks
- Used composition (HAS-A) instead of inheritance (IS-A) per NAESB ESPI 4.0 customer.xsd
- Lombok @DeleGate provides transparent access to embedded fields for service layer
- Each entity now has separate relatedLinks join table via @AssociationOverride
Test Results:
- All 760 unit tests passing
- H2 in-memory database integration: 3 tests passing
- MySQL TestContainers integration: 2 tests passing
- PostgreSQL TestContainers integration: 59 tests passing
- Total: 824+ tests passing across all database platforms
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* docs: Add toString() method sequencing guideline to CLAUDE.md
Added JPA mapping guideline for entity toString() method sequencing to ensure
consistency with database schema definitions.
Guideline enforces that toString() methods must follow exact database field
sequence from Flyway migration scripts:
- Standard sequence: id, description, created, updated, published, upLink,
selfLink, [type-specific fields in database column order], relatedLinks
- Ensures toString() output matches CREATE TABLE statement column order
- Improves debugging and log readability by maintaining schema alignment
This guideline supports Issue #97 relatedLinks standardization work where
consistent field ordering across entities is critical.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 410f4b5 commit fe77497
File tree
21 files changed
+1668
-266
lines changed- openespi-common
- src/main
- java/org/greenbuttonalliance/espi/common
- domain
- customer/entity
- usage
- mapper/customer
- resources/db/migration
21 files changed
+1668
-266
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
291 | 292 | | |
292 | 293 | | |
293 | 294 | | |
| |||
Lines changed: 1194 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 12 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
25 | | - | |
26 | 24 | | |
27 | 25 | | |
28 | 26 | | |
29 | | - | |
30 | 27 | | |
31 | 28 | | |
32 | 29 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
37 | 34 | | |
38 | | - | |
39 | | - | |
40 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
41 | 38 | | |
42 | | - | |
| 39 | + | |
43 | 40 | | |
44 | | - | |
45 | 41 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
| 42 | + | |
50 | 43 | | |
51 | 44 | | |
52 | 45 | | |
| |||
87 | 80 | | |
88 | 81 | | |
89 | 82 | | |
| 83 | + | |
90 | 84 | | |
91 | 85 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | 86 | | |
101 | 87 | | |
102 | 88 | | |
| |||
126 | 112 | | |
127 | 113 | | |
128 | 114 | | |
| 115 | + | |
129 | 116 | | |
130 | 117 | | |
131 | | - | |
| 118 | + | |
132 | 119 | | |
133 | 120 | | |
134 | 121 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
53 | 60 | | |
54 | 61 | | |
55 | 62 | | |
| |||
Lines changed: 14 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
51 | 58 | | |
52 | 59 | | |
53 | 60 | | |
| |||
235 | 242 | | |
236 | 243 | | |
237 | 244 | | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
238 | 251 | | |
239 | 252 | | |
240 | 253 | | |
| |||
252 | 265 | | |
253 | 266 | | |
254 | 267 | | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
| 268 | + | |
261 | 269 | | |
262 | 270 | | |
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
51 | 58 | | |
52 | 59 | | |
53 | 60 | | |
| |||
Lines changed: 63 additions & 124 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | | - | |
| 28 | + | |
28 | 29 | | |
29 | | - | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
49 | 56 | | |
50 | 57 | | |
51 | 58 | | |
52 | 59 | | |
53 | 60 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
| 61 | + | |
118 | 62 | | |
119 | 63 | | |
120 | | - | |
121 | | - | |
122 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
123 | 79 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
| 80 | + | |
| 81 | + | |
138 | 82 | | |
139 | | - | |
140 | | - | |
141 | | - | |
| 83 | + | |
142 | 84 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
| 85 | + | |
| 86 | + | |
159 | 87 | | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | 88 | | |
178 | 89 | | |
179 | 90 | | |
180 | 91 | | |
181 | 92 | | |
182 | | - | |
183 | | - | |
| 93 | + | |
| 94 | + | |
184 | 95 | | |
185 | 96 | | |
186 | | - | |
| 97 | + | |
187 | 98 | | |
188 | 99 | | |
189 | 100 | | |
190 | 101 | | |
191 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
192 | 131 | | |
193 | 132 | | |
0 commit comments