Skip to content
This repository was archived by the owner on Jul 1, 2025. It is now read-only.

Commit d953455

Browse files
dfcoffinclaude
andcommitted
Complete entity relationship cleanup with ElectricPowerQualitySummaryEntity
- Remove bidirectional relationship management methods from ElectricPowerQualitySummaryEntity: * Complex setUsagePoint with bidirectional logic - Remove corresponding methods from UsagePointEntity: * addElectricPowerQualitySummary/removeElectricPowerQualitySummary methods - Simplify setUpResource() and unlink() methods to use direct field assignment This completes the systematic cleanup of all major entity bidirectional relationship management, moving complex relationship logic to the DataCustodian/ThirdParty application layers. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 997fa76 commit d953455

File tree

2 files changed

+9
-46
lines changed

2 files changed

+9
-46
lines changed

src/main/java/org/greenbuttonalliance/espi/common/domain/usage/ElectricPowerQualitySummaryEntity.java

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -172,25 +172,8 @@ public ElectricPowerQualitySummaryEntity(DateTimeInterval summaryInterval) {
172172
this.summaryInterval = summaryInterval;
173173
}
174174

175-
/**
176-
* Sets the usage point for this power quality summary.
177-
* This method ensures the bidirectional relationship is maintained.
178-
*
179-
* @param usagePoint the usage point to set
180-
*/
181-
public void setUsagePoint(UsagePointEntity usagePoint) {
182-
// Remove from old usage point if exists
183-
if (this.usagePoint != null && this.usagePoint != usagePoint) {
184-
this.usagePoint.removeElectricPowerQualitySummary(this);
185-
}
186-
187-
this.usagePoint = usagePoint;
188-
189-
// Add to new usage point if not null
190-
if (usagePoint != null && !usagePoint.getElectricPowerQualitySummaries().contains(this)) {
191-
usagePoint.addElectricPowerQualitySummary(this);
192-
}
193-
}
175+
// Note: Simple setUsagePoint setter is generated by Lombok @Data
176+
// Complex bidirectional relationship management removed - handled by DataCustodian/ThirdParty applications
194177

195178
/**
196179
* Generates the self href for this electric power quality summary.
@@ -277,19 +260,20 @@ public void merge(ElectricPowerQualitySummaryEntity other) {
277260
public void unlink() {
278261
clearRelatedLinks();
279262

280-
// Clear relationships
281-
setUsagePoint(null);
263+
// Clear relationships with simple field assignment
264+
this.usagePoint = null;
282265
}
283266

284267
/**
285268
* Sets up the parent relationship with a usage point.
286269
* Used by the resource management system.
270+
* Note: Bidirectional relationship setup handled by applications.
287271
*
288272
* @param resource the parent usage point resource
289273
*/
290274
public void setUpResource(IdentifiedObjectEntity resource) {
291-
if (resource instanceof UsagePointEntity usagePointEntity) {
292-
usagePointEntity.addElectricPowerQualitySummary(this);
275+
if (resource instanceof UsagePointEntity parentUsagePoint) {
276+
this.usagePoint = parentUsagePoint;
293277
}
294278
}
295279

src/main/java/org/greenbuttonalliance/espi/common/domain/usage/UsagePointEntity.java

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -176,29 +176,8 @@ public String getUpHref() {
176176
// Note: Usage summary collection accessors are generated by Lombok @Data
177177
// Bidirectional relationship management methods removed - handled by DataCustodian/ThirdParty applications
178178

179-
/**
180-
* Adds an electric power quality summary to this usage point.
181-
*
182-
* @param summary the electric power quality summary to add
183-
*/
184-
public void addElectricPowerQualitySummary(ElectricPowerQualitySummaryEntity summary) {
185-
if (summary != null) {
186-
summary.setUsagePoint(this);
187-
electricPowerQualitySummaries.add(summary);
188-
}
189-
}
190-
191-
/**
192-
* Removes an electric power quality summary from this usage point.
193-
*
194-
* @param summary the electric power quality summary to remove
195-
*/
196-
public void removeElectricPowerQualitySummary(ElectricPowerQualitySummaryEntity summary) {
197-
if (summary != null) {
198-
summary.setUsagePoint(null);
199-
electricPowerQualitySummaries.remove(summary);
200-
}
201-
}
179+
// Note: Electric power quality summary collection accessors are generated by Lombok @Data
180+
// Bidirectional relationship management methods removed - handled by DataCustodian/ThirdParty applications
202181

203182
// Note: Subscription collection accessors are generated by Lombok @Data
204183
// Bidirectional relationship management methods removed - handled by DataCustodian/ThirdParty applications

0 commit comments

Comments
 (0)