Commit 8e519f7
refactor: Phase 10 - LineItem ESPI 4.0 schema compliance (#76)
Convert LineItem from UUID to Long ID with IDENTITY generation per ESPI 4.0
XSD (espi.xsd:1449). LineItem extends Object, not IdentifiedObject, requiring
Long ID with vendor-specific auto-increment syntax.
Changes:
- LineItemEntity: Change ID from UUID to Long with GenerationType.IDENTITY
- Add missing XSD fields: measurement (SummaryMeasurement), itemKind (required),
unitCost, itemPeriod (DateTimeInterval)
- LineItemRepository: Change from JpaRepository<LineItemEntity, UUID> to Long
- Remove 10 non-indexed queries, keep 2 indexed queries
- Create LineItemDto record matching XSD structure (no id/uuid fields)
- Create LineItemMapper interface with toDto/toEntity mappings
- Create SummaryMeasurementMapper for measurement field mapping
- LineItemRepositoryTest: Complete rewrite with comprehensive coverage
(CRUD, custom queries, relationships, business logic, persistence)
- Move usage_summaries + usage_summary_related_links tables from V3 to V2
vendor-specific migrations to maintain dependency order (line_items FK
requires usage_summaries to exist first)
- Fix UsageSummaryRepositoryTest to include required itemKind field
Database migrations:
- Add line_items table to V2 vendor-specific files with auto-increment
(BIGINT AUTO_INCREMENT for MySQL/H2, BIGSERIAL for PostgreSQL)
- Move usage_summaries from V3 to V2 (before line_items) to resolve
Flyway migration order issue
All 533 tests pass.
Co-authored-by: Claude Sonnet 4.5 <[email protected]>1 parent cd53b6d commit 8e519f7
File tree
16 files changed
+1278
-420
lines changed- openespi-common
- .claude/commands
- src
- main
- java/org/greenbuttonalliance/espi/common
- domain/usage
- dto/usage
- mapper
- usage
- repositories/usage
- resources/db
- migration
- vendor
- h2
- mysql
- postgres
- test/java/org/greenbuttonalliance/espi/common/repositories/usage
16 files changed
+1278
-420
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/LineItemEntity.java
Lines changed: 112 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
29 | 30 | | |
30 | | - | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
| |||
61 | 60 | | |
62 | 61 | | |
63 | 62 | | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
70 | 69 | | |
71 | 70 | | |
72 | 71 | | |
| |||
100 | 99 | | |
101 | 100 | | |
102 | 101 | | |
| 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 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
103 | 143 | | |
104 | 144 | | |
105 | 145 | | |
| |||
111 | 151 | | |
112 | 152 | | |
113 | 153 | | |
114 | | - | |
115 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
116 | 157 | | |
117 | 158 | | |
118 | 159 | | |
119 | 160 | | |
| 161 | + | |
120 | 162 | | |
121 | 163 | | |
122 | 164 | | |
123 | 165 | | |
124 | 166 | | |
125 | 167 | | |
126 | 168 | | |
127 | | - | |
128 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
129 | 187 | | |
130 | 188 | | |
131 | 189 | | |
132 | 190 | | |
133 | 191 | | |
| 192 | + | |
134 | 193 | | |
135 | 194 | | |
136 | 195 | | |
137 | 196 | | |
138 | 197 | | |
139 | 198 | | |
140 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
141 | 242 | | |
142 | 243 | | |
143 | 244 | | |
| |||
0 commit comments