From 01555319b833898338bf82c0e4e7a2ff937d1201 Mon Sep 17 00:00:00 2001 From: "Donald F. Coffin" Date: Fri, 16 Jan 2026 11:44:43 -0500 Subject: [PATCH] refactor: Phase 16e - Remove legacy kind and uri fields from UsagePoint Removed non-ESPI 4.0 XSD compliant legacy fields to ensure strict schema compliance. Changes: UsagePointEntity, UsagePointMapper, V2 migration files Phase 16 is now 100% complete and ESPI 4.0 XSD compliant. Co-Authored-By: Claude Sonnet 4.5 --- .../espi/common/domain/usage/UsagePointEntity.java | 13 ------------- .../espi/common/mapper/usage/UsagePointMapper.java | 1 - .../db/vendor/h2/V2__H2_Specific_Tables.sql | 5 ----- .../db/vendor/mysql/V2__MySQL_Specific_Tables.sql | 5 ----- .../postgres/V2__PostgreSQL_Specific_Tables.sql | 5 ----- 5 files changed, 29 deletions(-) diff --git a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/UsagePointEntity.java b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/UsagePointEntity.java index c3637df6..388ce4a0 100644 --- a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/UsagePointEntity.java +++ b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/UsagePointEntity.java @@ -263,17 +263,6 @@ public class UsagePointEntity extends IdentifiedObject { // XSD Position 22-23: pnodeRefs and aggregateNodeRefs - See relationship sections below - // ==================== Legacy Fields (NOT in ESPI 4.0 XSD) ==================== - // TODO Phase 16c: Review if these fields should be removed or mapped to XSD elements - - /** - * URI for this usage point. - * Used for external references and linking. - * NOTE: This field is NOT in ESPI 4.0 XSD - legacy field for review. - */ - @Column(name = "uri") - private String uri; - // ==================== JPA Relationships ==================== /** @@ -439,7 +428,6 @@ public void merge(UsagePointEntity other) { this.serviceCategory = other.serviceCategory; this.status = other.status; this.roleFlags = other.roleFlags; - this.uri = other.uri; } } @@ -484,7 +472,6 @@ public String toString() { "roleFlags = " + getRoleFlags() + ", " + "serviceCategory = " + getServiceCategory() + ", " + "status = " + getStatus() + ", " + - "uri = " + getUri() + ", " + "estimatedLoad = " + getEstimatedLoad() + ", " + "nominalServiceVoltage = " + getNominalServiceVoltage() + ", " + "ratedCurrent = " + getRatedCurrent() + ", " + diff --git a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/mapper/usage/UsagePointMapper.java b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/mapper/usage/UsagePointMapper.java index 75785af7..37d3e714 100644 --- a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/mapper/usage/UsagePointMapper.java +++ b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/mapper/usage/UsagePointMapper.java @@ -111,7 +111,6 @@ public interface UsagePointMapper { @Mapping(target = "readRoute", source = "readRoute") @Mapping(target = "serviceDeliveryRemark", source = "serviceDeliveryRemark") @Mapping(target = "servicePriority", source = "servicePriority") - @Mapping(target = "uri", ignore = true) // Legacy field @Mapping(target = "pnodeRefs", ignore = true) // TODO: Add mapper implementation @Mapping(target = "aggregatedNodeRefs", ignore = true) // TODO: Add mapper implementation @Mapping(target = "meterReadings", ignore = true) // Circular dependency - handle separately diff --git a/openespi-common/src/main/resources/db/vendor/h2/V2__H2_Specific_Tables.sql b/openespi-common/src/main/resources/db/vendor/h2/V2__H2_Specific_Tables.sql index 37afc0f3..e8d97c67 100644 --- a/openespi-common/src/main/resources/db/vendor/h2/V2__H2_Specific_Tables.sql +++ b/openespi-common/src/main/resources/db/vendor/h2/V2__H2_Specific_Tables.sql @@ -150,10 +150,6 @@ CREATE TABLE usage_points service_delivery_remark VARCHAR(256), -- 20. serviceDeliveryRemark (Phase 16a) service_priority VARCHAR(32), -- 21. servicePriority (Phase 16a) - -- EXTRA FIELDS (not in ESPI 4.0 XSD - to be reviewed in Phase 16b) - kind VARCHAR(50), -- NOT IN XSD (legacy field?) - uri VARCHAR(1024), -- NOT IN XSD (legacy field?) - -- Foreign key relationships retail_customer_id BIGINT, service_delivery_point_id BIGINT, @@ -166,7 +162,6 @@ CREATE TABLE usage_points ); -- Create indexes for usage_points table -CREATE INDEX idx_usage_point_kind ON usage_points (kind); CREATE INDEX idx_usage_point_status ON usage_points (status); CREATE INDEX idx_usage_point_customer_id ON usage_points (retail_customer_id); CREATE INDEX idx_usage_point_sdp_id ON usage_points (service_delivery_point_id); diff --git a/openespi-common/src/main/resources/db/vendor/mysql/V2__MySQL_Specific_Tables.sql b/openespi-common/src/main/resources/db/vendor/mysql/V2__MySQL_Specific_Tables.sql index dd075e5a..d13c9a99 100644 --- a/openespi-common/src/main/resources/db/vendor/mysql/V2__MySQL_Specific_Tables.sql +++ b/openespi-common/src/main/resources/db/vendor/mysql/V2__MySQL_Specific_Tables.sql @@ -147,10 +147,6 @@ CREATE TABLE usage_points service_delivery_remark VARCHAR(256), -- 20. serviceDeliveryRemark (Phase 16a) service_priority VARCHAR(32), -- 21. servicePriority (Phase 16a) - -- EXTRA FIELDS (not in ESPI 4.0 XSD - to be reviewed in Phase 16b) - kind VARCHAR(50), -- NOT IN XSD (legacy field?) - uri VARCHAR(1024), -- NOT IN XSD (legacy field?) - -- Foreign key relationships retail_customer_id BIGINT, service_delivery_point_id BIGINT, @@ -161,7 +157,6 @@ CREATE TABLE usage_points FOREIGN KEY (service_delivery_point_id) REFERENCES service_delivery_points (id) ON DELETE SET NULL, FOREIGN KEY (local_time_parameters_id) REFERENCES time_configurations (id) ON DELETE SET NULL, - INDEX idx_usage_point_kind (kind), INDEX idx_usage_point_status (status), INDEX idx_usage_point_customer_id (retail_customer_id), INDEX idx_usage_point_sdp_id (service_delivery_point_id), diff --git a/openespi-common/src/main/resources/db/vendor/postgres/V2__PostgreSQL_Specific_Tables.sql b/openespi-common/src/main/resources/db/vendor/postgres/V2__PostgreSQL_Specific_Tables.sql index 40cf6729..6cd5fcc2 100644 --- a/openespi-common/src/main/resources/db/vendor/postgres/V2__PostgreSQL_Specific_Tables.sql +++ b/openespi-common/src/main/resources/db/vendor/postgres/V2__PostgreSQL_Specific_Tables.sql @@ -148,10 +148,6 @@ CREATE TABLE usage_points service_delivery_remark VARCHAR(256), -- 20. serviceDeliveryRemark (Phase 16a) service_priority VARCHAR(32), -- 21. servicePriority (Phase 16a) - -- EXTRA FIELDS (not in ESPI 4.0 XSD - to be reviewed in Phase 16b) - kind VARCHAR(50), -- NOT IN XSD (legacy field?) - uri VARCHAR(1024), -- NOT IN XSD (legacy field?) - -- Foreign key relationships retail_customer_id BIGINT, service_delivery_point_id BIGINT, @@ -163,7 +159,6 @@ CREATE TABLE usage_points FOREIGN KEY (local_time_parameters_id) REFERENCES time_configurations (id) ON DELETE SET NULL ); -CREATE INDEX idx_usage_point_kind ON usage_points (kind); CREATE INDEX idx_usage_point_status ON usage_points (status); CREATE INDEX idx_usage_point_customer_id ON usage_points (retail_customer_id); CREATE INDEX idx_usage_point_sdp_id ON usage_points (service_delivery_point_id);