diff --git a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/CRUDOperation.java b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/CRUDOperation.java new file mode 100644 index 00000000..b852e8d4 --- /dev/null +++ b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/CRUDOperation.java @@ -0,0 +1,79 @@ +/* + * Copyright 2025 Green Button Alliance, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.greenbuttonalliance.espi.common.domain.customer.enums; + +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlEnumValue; +import jakarta.xml.bind.annotation.XmlType; + +/** + * Enumeration for CRUDOperation values. + * + * Specifies the operation requested of this item. + * Per ESPI 4.0 customer.xsd lines 1557-1591. + */ +@XmlType(name = "CRUDOperation", namespace = "http://naesb.org/espi/customer") +@XmlEnum +public enum CRUDOperation { + + /** + * Create. + * XSD value: 0 (line 1564) + */ + @XmlEnumValue("0") + CREATE(0), + + /** + * Read. + * XSD value: 1 (line 1570) + */ + @XmlEnumValue("1") + READ(1), + + /** + * Update. + * XSD value: 2 (line 1576) + */ + @XmlEnumValue("2") + UPDATE(2), + + /** + * Delete. + * XSD value: 3 (line 1582) + */ + @XmlEnumValue("3") + DELETE(3); + + private final int value; + + CRUDOperation(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + + public static CRUDOperation fromValue(int value) { + for (CRUDOperation operation : CRUDOperation.values()) { + if (operation.value == value) { + return operation; + } + } + throw new IllegalArgumentException("Invalid CRUDOperation value: " + value); + } +} \ No newline at end of file diff --git a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/CustomerKind.java b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/CustomerKind.java index bedd4c02..44753d50 100644 --- a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/CustomerKind.java +++ b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/CustomerKind.java @@ -1,62 +1,156 @@ /* + * Copyright 2025 Green Button Alliance, Inc. * - * Copyright (c) 2025 Green Button Alliance, Inc. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * + * http://www.apache.org/licenses/LICENSE-2.0 * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.greenbuttonalliance.espi.common.domain.customer.enums; +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlEnumValue; +import jakarta.xml.bind.annotation.XmlType; + /** * Enumeration for CustomerKind values. - * - * Kind of customer based on the energy market business rules. + * + * Kind of customer. + * Per ESPI 4.0 customer.xsd lines 1687-1772. */ +@XmlType(name = "CustomerKind", namespace = "http://naesb.org/espi/customer") +@XmlEnum public enum CustomerKind { - /** - * Commercial customer classification. - */ - COMMERCIAL, - - /** - * Enterprise customer classification. - */ - ENTERPRISE, - - /** - * Individual customer classification. - */ - INDIVIDUAL, - - /** - * Industrial customer classification. - */ - INDUSTRIAL, - - /** - * Residential customer classification. - */ - RESIDENTIAL, - - /** - * Subsidiary customer classification. - */ - SUBSIDIARY, - - /** - * Other customer classification. - */ - OTHER + + /** + * Residential customer. + * XSD value: "residential" (line 1694) + */ + @XmlEnumValue("residential") + RESIDENTIAL("residential"), + + /** + * Residential and commercial customer. + * XSD value: "residentialAndCommercial" (line 1699) + */ + @XmlEnumValue("residentialAndCommercial") + RESIDENTIAL_AND_COMMERCIAL("residentialAndCommercial"), + + /** + * Residential and streetlight customer. + * XSD value: "residentialAndStreetlight" (line 1704) + */ + @XmlEnumValue("residentialAndStreetlight") + RESIDENTIAL_AND_STREETLIGHT("residentialAndStreetlight"), + + /** + * Residential streetlight or other related customer. + * XSD value: "residentialStreetlightOthers" (line 1709) + */ + @XmlEnumValue("residentialStreetlightOthers") + RESIDENTIAL_STREETLIGHT_OTHERS("residentialStreetlightOthers"), + + /** + * Residential farm service customer. + * XSD value: "residentialFarmService" (line 1714) + */ + @XmlEnumValue("residentialFarmService") + RESIDENTIAL_FARM_SERVICE("residentialFarmService"), + + /** + * Commercial industrial customer. + * XSD value: "commercialIndustrial" (line 1719) + */ + @XmlEnumValue("commercialIndustrial") + COMMERCIAL_INDUSTRIAL("commercialIndustrial"), + + /** + * Pumping load customer. + * XSD value: "pumpingLoad" (line 1724) + */ + @XmlEnumValue("pumpingLoad") + PUMPING_LOAD("pumpingLoad"), + + /** + * Wind machine customer. + * XSD value: "windMachine" (line 1729) + */ + @XmlEnumValue("windMachine") + WIND_MACHINE("windMachine"), + + /** + * Customer as energy service supplier. + * XSD value: "energyServiceSupplier" (line 1734) + */ + @XmlEnumValue("energyServiceSupplier") + ENERGY_SERVICE_SUPPLIER("energyServiceSupplier"), + + /** + * Customer as energy service scheduler. + * XSD value: "energyServiceScheduler" (line 1739) + */ + @XmlEnumValue("energyServiceScheduler") + ENERGY_SERVICE_SCHEDULER("energyServiceScheduler"), + + /** + * Represents the owning enterprise. + * XSD value: "enterprise" (line 1744) + */ + @XmlEnumValue("enterprise") + ENTERPRISE("enterprise"), + + /** + * Represents a local operator of a larger enterprise. + * XSD value: "regionalOperator" (line 1749) + */ + @XmlEnumValue("regionalOperator") + REGIONAL_OPERATOR("regionalOperator"), + + /** + * A subsidiary of a larger enterprise. + * XSD value: "subsidiary" (line 1754) + */ + @XmlEnumValue("subsidiary") + SUBSIDIARY("subsidiary"), + + /** + * Internal use customer. + * XSD value: "internalUse" (line 1759) + */ + @XmlEnumValue("internalUse") + INTERNAL_USE("internalUse"), + + /** + * Other kind of customer. + * XSD value: "other" (line 1764) + */ + @XmlEnumValue("other") + OTHER("other"); + + private final String value; + + CustomerKind(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static CustomerKind fromValue(String value) { + for (CustomerKind kind : CustomerKind.values()) { + if (kind.value.equals(value)) { + return kind; + } + } + throw new IllegalArgumentException("Invalid CustomerKind value: " + value); + } } \ No newline at end of file diff --git a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/EnrollmentStatus.java b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/EnrollmentStatus.java new file mode 100644 index 00000000..9e2658bc --- /dev/null +++ b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/EnrollmentStatus.java @@ -0,0 +1,72 @@ +/* + * Copyright 2025 Green Button Alliance, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.greenbuttonalliance.espi.common.domain.customer.enums; + +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlEnumValue; +import jakarta.xml.bind.annotation.XmlType; + +/** + * Enumeration for EnrollmentStatus values. + * + * [extension] Current Demand Response program enrollment status. + * Per ESPI 4.0 customer.xsd lines 1808-1833. + */ +@XmlType(name = "EnrollmentStatus", namespace = "http://naesb.org/espi/customer") +@XmlEnum +public enum EnrollmentStatus { + + /** + * Currently NOT enrolled in the Demand Response program. + * XSD value: "unenrolled" (line 1815) + */ + @XmlEnumValue("unenrolled") + UNENROLLED("unenrolled"), + + /** + * Currently enrolled in the Demand Response program. + * XSD value: "enrolled" (line 1820) + */ + @XmlEnumValue("enrolled") + ENROLLED("enrolled"), + + /** + * Currently pending enrollment in the Demand Response program. + * XSD value: "enrolledPending" (line 1825) + */ + @XmlEnumValue("enrolledPending") + ENROLLED_PENDING("enrolledPending"); + + private final String value; + + EnrollmentStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static EnrollmentStatus fromValue(String value) { + for (EnrollmentStatus status : EnrollmentStatus.values()) { + if (status.value.equals(value)) { + return status; + } + } + throw new IllegalArgumentException("Invalid EnrollmentStatus value: " + value); + } +} \ No newline at end of file diff --git a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/MediaType.java b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/MediaType.java new file mode 100644 index 00000000..fd80ddfe --- /dev/null +++ b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/MediaType.java @@ -0,0 +1,156 @@ +/* + * Copyright 2025 Green Button Alliance, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.greenbuttonalliance.espi.common.domain.customer.enums; + +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlEnumValue; +import jakarta.xml.bind.annotation.XmlType; + +/** + * Enumeration for MediaType values. + * + * [extension] Media type for document as registered by IANA, allowed subset in enumeration. + * Per ESPI 4.0 customer.xsd lines 1834-1919. + */ +@XmlType(name = "MediaType", namespace = "http://naesb.org/espi/customer") +@XmlEnum +public enum MediaType { + + /** + * JSON. + * XSD value: "application/json" (line 1841) + */ + @XmlEnumValue("application/json") + APPLICATION_JSON("application/json"), + + /** + * PDF. + * XSD value: "application/pdf" (line 1846) + */ + @XmlEnumValue("application/pdf") + APPLICATION_PDF("application/pdf"), + + /** + * vnd.ms-excel. + * XSD value: "application/vnd.ms-excel" (line 1851) + */ + @XmlEnumValue("application/vnd.ms-excel") + APPLICATION_VND_MS_EXCEL("application/vnd.ms-excel"), + + /** + * vnd.oasis.opendocument.spreadsheet. + * XSD value: "application/vnd.oasis.opendocument.spreadsheet" (line 1856) + */ + @XmlEnumValue("application/vnd.oasis.opendocument.spreadsheet") + APPLICATION_VND_OASIS_OPENDOCUMENT_SPREADSHEET("application/vnd.oasis.opendocument.spreadsheet"), + + /** + * vnd.oasis.opendocument.text. + * XSD value: "application/vnd.oasis.opendocument.text" (line 1861) + */ + @XmlEnumValue("application/vnd.oasis.opendocument.text") + APPLICATION_VND_OASIS_OPENDOCUMENT_TEXT("application/vnd.oasis.opendocument.text"), + + /** + * vnd.openxmlformats-officedocument.spreadsheetml.sheet. + * XSD value: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" (line 1866) + */ + @XmlEnumValue("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") + APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_SHEET("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"), + + /** + * ZIP. + * XSD value: "application/zip" (line 1871) + */ + @XmlEnumValue("application/zip") + APPLICATION_ZIP("application/zip"), + + /** + * GIF. + * XSD value: "image/gif" (line 1876) + */ + @XmlEnumValue("image/gif") + IMAGE_GIF("image/gif"), + + /** + * JPEG. + * XSD value: "image/jpeg" (line 1881) + */ + @XmlEnumValue("image/jpeg") + IMAGE_JPEG("image/jpeg"), + + /** + * PNG. + * XSD value: "image/png" (line 1886) + */ + @XmlEnumValue("image/png") + IMAGE_PNG("image/png"), + + /** + * CSV. + * XSD value: "text/csv" (line 1891) + */ + @XmlEnumValue("text/csv") + TEXT_CSV("text/csv"), + + /** + * HTML. + * XSD value: "text/html" (line 1896) + */ + @XmlEnumValue("text/html") + TEXT_HTML("text/html"), + + /** + * plain. + * XSD value: "text/plain" (line 1901) + */ + @XmlEnumValue("text/plain") + TEXT_PLAIN("text/plain"), + + /** + * RTF. + * XSD value: "text/rtf" (line 1906) + */ + @XmlEnumValue("text/rtf") + TEXT_RTF("text/rtf"), + + /** + * XML. + * XSD value: "text/xml" (line 1911) + */ + @XmlEnumValue("text/xml") + TEXT_XML("text/xml"); + + private final String value; + + MediaType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static MediaType fromValue(String value) { + for (MediaType type : MediaType.values()) { + if (type.value.equals(value)) { + return type; + } + } + throw new IllegalArgumentException("Invalid MediaType value: " + value); + } +} \ No newline at end of file diff --git a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/NotificationMethodKind.java b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/NotificationMethodKind.java index 133ed2f6..f8d3d351 100644 --- a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/NotificationMethodKind.java +++ b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/NotificationMethodKind.java @@ -1,53 +1,86 @@ /* + * Copyright 2025 Green Button Alliance, Inc. * - * Copyright (c) 2025 Green Button Alliance, Inc. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * + * http://www.apache.org/licenses/LICENSE-2.0 * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.greenbuttonalliance.espi.common.domain.customer.enums; +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlEnumValue; +import jakarta.xml.bind.annotation.XmlType; + /** * Enumeration for NotificationMethodKind values. - * Per ESPI 4.0 customer.xsd lines 1961-1996. * * Method by which the customer was notified. + * Per ESPI 4.0 customer.xsd lines 1961-1996. */ +@XmlType(name = "NotificationMethodKind", namespace = "http://naesb.org/espi/customer") +@XmlEnum public enum NotificationMethodKind { - /** - * Contacted by phone by customer service representative. - */ - CALL, - - /** - * Trouble reported by email. - */ - EMAIL, - - /** - * Trouble reported by letter. - */ - LETTER, - - /** - * Trouble reported by other means. - */ - OTHER, - - /** - * Trouble reported through interactive voice response system. - */ - IVR + + /** + * Contacted by phone by customer service representative. + * XSD value: "call" (line 1968) + */ + @XmlEnumValue("call") + CALL("call"), + + /** + * Trouble reported by email. + * XSD value: "email" (line 1973) + */ + @XmlEnumValue("email") + EMAIL("email"), + + /** + * Trouble reported by letter. + * XSD value: "letter" (line 1978) + */ + @XmlEnumValue("letter") + LETTER("letter"), + + /** + * Trouble reported by other means. + * XSD value: "other" (line 1983) + */ + @XmlEnumValue("other") + OTHER("other"), + + /** + * Trouble reported through interactive voice response system. + * XSD value: "ivr" (line 1988) + */ + @XmlEnumValue("ivr") + IVR("ivr"); + + private final String value; + + NotificationMethodKind(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static NotificationMethodKind fromValue(String value) { + for (NotificationMethodKind kind : NotificationMethodKind.values()) { + if (kind.value.equals(value)) { + return kind; + } + } + throw new IllegalArgumentException("Invalid NotificationMethodKind value: " + value); + } } \ No newline at end of file diff --git a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/ProgramDateKind.java b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/ProgramDateKind.java index 5556108c..07ad8a91 100644 --- a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/ProgramDateKind.java +++ b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/ProgramDateKind.java @@ -1,58 +1,79 @@ /* + * Copyright 2025 Green Button Alliance, Inc. * - * Copyright (c) 2025 Green Button Alliance, Inc. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * + * http://www.apache.org/licenses/LICENSE-2.0 * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.greenbuttonalliance.espi.common.domain.customer.enums; +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlEnumValue; +import jakarta.xml.bind.annotation.XmlType; + /** - * Type of Demand Response program date based on ESPI 4.0 customer.xsd specification. + * Enumeration for ProgramDateKind values. * - * Per customer.xsd lines 1997-2030. - * Note: XSD uses union type, allowing both enumerated values and custom String64 values. - * - * Ordinal mapping: - * 0 = CUST_DR_PROGRAM_ENROLLMENT_DATE - * 1 = CUST_DR_PROGRAM_DE_ENROLLMENT_DATE - * 2 = CUST_DR_PROGRAM_TERM_DATE_REGARDLESS_FINANCIAL - * 3 = CUST_DR_PROGRAM_TERM_DATE_WITHOUT_FINANCIAL + * [extension] Type of Demand Response program date. + * Per ESPI 4.0 customer.xsd lines 1997-2027. */ +@XmlType(name = "ProgramDateKind", namespace = "http://naesb.org/espi/customer") +@XmlEnum public enum ProgramDateKind { - /** - * Date customer enrolled in Demand Response program. - * Ordinal: 0 - */ - CUST_DR_PROGRAM_ENROLLMENT_DATE, - - /** - * Date customer terminated enrollment in Demand Response program. - * Ordinal: 1 - */ - CUST_DR_PROGRAM_DE_ENROLLMENT_DATE, - - /** - * Earliest date customer can terminate Demand Response enrollment, regardless of financial impact. - * Ordinal: 2 - */ - CUST_DR_PROGRAM_TERM_DATE_REGARDLESS_FINANCIAL, - - /** - * Earliest date customer can terminate Demand Response enrollment, without financial impact. - * Ordinal: 3 - */ - CUST_DR_PROGRAM_TERM_DATE_WITHOUT_FINANCIAL + + /** + * Date customer enrolled in Demand Response program. + * XSD value: "CUST_DR_PROGRAM_ENROLLMENT_DATE" (line 2004) + */ + @XmlEnumValue("CUST_DR_PROGRAM_ENROLLMENT_DATE") + CUST_DR_PROGRAM_ENROLLMENT_DATE("CUST_DR_PROGRAM_ENROLLMENT_DATE"), + + /** + * Date customer terminated enrollment in Demand Response program. + * XSD value: "CUST_DR_PROGRAM_DE_ENROLLMENT_DATE" (line 2009) + */ + @XmlEnumValue("CUST_DR_PROGRAM_DE_ENROLLMENT_DATE") + CUST_DR_PROGRAM_DE_ENROLLMENT_DATE("CUST_DR_PROGRAM_DE_ENROLLMENT_DATE"), + + /** + * Earliest date customer can terminate Demand Response enrollment, regardless of financial impact. + * XSD value: "CUST_DR_PROGRAM_TERM_DATE_REGARDLESS_FINANCIAL" (line 2014) + */ + @XmlEnumValue("CUST_DR_PROGRAM_TERM_DATE_REGARDLESS_FINANCIAL") + CUST_DR_PROGRAM_TERM_DATE_REGARDLESS_FINANCIAL("CUST_DR_PROGRAM_TERM_DATE_REGARDLESS_FINANCIAL"), + + /** + * Earliest date customer can terminate Demand Response enrollment, without financial impact. + * XSD value: "CUST_DR_PROGRAM_TERM_DATE_WITHOUT_FINANCIAL" (line 2019) + */ + @XmlEnumValue("CUST_DR_PROGRAM_TERM_DATE_WITHOUT_FINANCIAL") + CUST_DR_PROGRAM_TERM_DATE_WITHOUT_FINANCIAL("CUST_DR_PROGRAM_TERM_DATE_WITHOUT_FINANCIAL"); + + private final String value; + + ProgramDateKind(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ProgramDateKind fromValue(String value) { + for (ProgramDateKind kind : ProgramDateKind.values()) { + if (kind.value.equals(value)) { + return kind; + } + } + throw new IllegalArgumentException("Invalid ProgramDateKind value: " + value); + } } diff --git a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/RevenueKind.java b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/RevenueKind.java new file mode 100644 index 00000000..651d7944 --- /dev/null +++ b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/RevenueKind.java @@ -0,0 +1,101 @@ +/* + * Copyright 2025 Green Button Alliance, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.greenbuttonalliance.espi.common.domain.customer.enums; + +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlEnumValue; +import jakarta.xml.bind.annotation.XmlType; + +/** + * Enumeration for RevenueKind values. + * + * Accounting classification of the type of revenue collected for the customer agreement, + * typically used to break down accounts for revenue accounting. + * Per ESPI 4.0 customer.xsd lines 2028-2073. + */ +@XmlType(name = "RevenueKind", namespace = "http://naesb.org/espi/customer") +@XmlEnum +public enum RevenueKind { + + /** + * Residential revenue. + * XSD value: "residential" (line 2035) + */ + @XmlEnumValue("residential") + RESIDENTIAL("residential"), + + /** + * Non-residential revenue. + * XSD value: "nonResidential" (line 2040) + */ + @XmlEnumValue("nonResidential") + NON_RESIDENTIAL("nonResidential"), + + /** + * Commercial revenue. + * XSD value: "commercial" (line 2045) + */ + @XmlEnumValue("commercial") + COMMERCIAL("commercial"), + + /** + * Industrial revenue. + * XSD value: "industrial" (line 2050) + */ + @XmlEnumValue("industrial") + INDUSTRIAL("industrial"), + + /** + * Irrigation revenue. + * XSD value: "irrigation" (line 2055) + */ + @XmlEnumValue("irrigation") + IRRIGATION("irrigation"), + + /** + * Streetlight revenue. + * XSD value: "streetLight" (line 2060) + */ + @XmlEnumValue("streetLight") + STREET_LIGHT("streetLight"), + + /** + * Other revenue kind. + * XSD value: "other" (line 2065) + */ + @XmlEnumValue("other") + OTHER("other"); + + private final String value; + + RevenueKind(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static RevenueKind fromValue(String value) { + for (RevenueKind kind : RevenueKind.values()) { + if (kind.value.equals(value)) { + return kind; + } + } + throw new IllegalArgumentException("Invalid RevenueKind value: " + value); + } +} \ No newline at end of file diff --git a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/ServiceKind.java b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/ServiceKind.java new file mode 100644 index 00000000..ba25f98f --- /dev/null +++ b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/ServiceKind.java @@ -0,0 +1,128 @@ +/* + * Copyright 2025 Green Button Alliance, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.greenbuttonalliance.espi.common.domain.customer.enums; + +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlEnumValue; +import jakarta.xml.bind.annotation.XmlType; + +/** + * Enumeration for ServiceKind values. + * + * Kind of service. + * Per ESPI 4.0 customer.xsd lines 2074-2135. + */ +@XmlType(name = "ServiceKind", namespace = "http://naesb.org/espi/customer") +@XmlEnum +public enum ServiceKind { + + /** + * Electricity service. + * XSD value: "electricity" (line 2079) + */ + @XmlEnumValue("electricity") + ELECTRICITY("electricity"), + + /** + * Gas service. + * XSD value: "gas" (line 2084) + */ + @XmlEnumValue("gas") + GAS("gas"), + + /** + * Water service. + * XSD value: "water" (line 2089) + */ + @XmlEnumValue("water") + WATER("water"), + + /** + * Time service. + * XSD value: "time" (line 2094) + */ + @XmlEnumValue("time") + TIME("time"), + + /** + * Heat service. + * XSD value: "heat" (line 2099) + */ + @XmlEnumValue("heat") + HEAT("heat"), + + /** + * Refuse (waster) service. + * XSD value: "refuse" (line 2104) + */ + @XmlEnumValue("refuse") + REFUSE("refuse"), + + /** + * Sewerage service. + * XSD value: "sewerage" (line 2109) + */ + @XmlEnumValue("sewerage") + SEWERAGE("sewerage"), + + /** + * Rates (e.g. tax, charge, toll, duty, tariff, etc.) service. + * XSD value: "rates" (line 2114) + */ + @XmlEnumValue("rates") + RATES("rates"), + + /** + * TV license service. + * XSD value: "tvLicence" (line 2119) + */ + @XmlEnumValue("tvLicence") + TV_LICENCE("tvLicence"), + + /** + * Internet service. + * XSD value: "internet" (line 2124) + */ + @XmlEnumValue("internet") + INTERNET("internet"), + + /** + * Other kind of service. + * XSD value: "other" (line 2129) + */ + @XmlEnumValue("other") + OTHER("other"); + + private final String value; + + ServiceKind(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ServiceKind fromValue(String value) { + for (ServiceKind kind : ServiceKind.values()) { + if (kind.value.equals(value)) { + return kind; + } + } + throw new IllegalArgumentException("Invalid ServiceKind value: " + value); + } +} \ No newline at end of file diff --git a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/SupplierKind.java b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/SupplierKind.java index 9881f8d5..2fba5a9f 100644 --- a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/SupplierKind.java +++ b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/customer/enums/SupplierKind.java @@ -1,59 +1,93 @@ /* + * Copyright 2025 Green Button Alliance, Inc. * - * Copyright (c) 2025 Green Button Alliance, Inc. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * + * http://www.apache.org/licenses/LICENSE-2.0 * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.greenbuttonalliance.espi.common.domain.customer.enums; +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlEnumValue; +import jakarta.xml.bind.annotation.XmlType; + /** - * Enumeration for SupplierKind values per ESPI 4.0 customer.xsd. + * Enumeration for SupplierKind values. * - * Kind of supplier based on the energy market business rules. - * - * IMPORTANT: Sequence must match XSD exactly - ESPI uses ordinal values (0-5) for serialization. + * Kind of supplier. + * Per ESPI 4.0 customer.xsd lines 2231-2271. */ +@XmlType(name = "SupplierKind", namespace = "http://naesb.org/espi/customer") +@XmlEnum public enum SupplierKind { - /** - * Utility supplier (ordinal 0) - */ - UTILITY, - - /** - * Retail energy supplier (ordinal 1) - */ - RETAILER, - - /** - * Other supplier type (ordinal 2) - */ - OTHER, - - /** - * Load Serving Entity (ordinal 3) - */ - LSE, - - /** - * Meter Data Management Agent (ordinal 4) - */ - MDMA, - - /** - * Metering Service Provider (ordinal 5) - */ - MSP + + /** + * Entity that delivers the service to the customer. + * XSD value: "utility" (line 2238) + */ + @XmlEnumValue("utility") + UTILITY("utility"), + + /** + * Entity that sells the service, but does not deliver to the customer; applies to the deregulated markets. + * XSD value: "retailer" (line 2243) + */ + @XmlEnumValue("retailer") + RETAILER("retailer"), + + /** + * Other kind of supplier. + * XSD value: "other" (line 2248) + */ + @XmlEnumValue("other") + OTHER("other"), + + /** + * Load Serving Entity. + * XSD value: "lse" (line 2253) + */ + @XmlEnumValue("lse") + LSE("lse"), + + /** + * Meter Data Management Agent. + * XSD value: "mdma" (line 2258) + */ + @XmlEnumValue("mdma") + MDMA("mdma"), + + /** + * Meter Service Provider. + * XSD value: "msp" (line 2263) + */ + @XmlEnumValue("msp") + MSP("msp"); + + private final String value; + + SupplierKind(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static SupplierKind fromValue(String value) { + for (SupplierKind kind : SupplierKind.values()) { + if (kind.value.equals(value)) { + return kind; + } + } + throw new IllegalArgumentException("Invalid SupplierKind value: " + value); + } } \ No newline at end of file diff --git a/openespi-common/src/test/java/org/greenbuttonalliance/espi/common/dto/customer/CustomerDtoMarshallingTest.java b/openespi-common/src/test/java/org/greenbuttonalliance/espi/common/dto/customer/CustomerDtoMarshallingTest.java index b7bf86f9..90d82c7c 100644 --- a/openespi-common/src/test/java/org/greenbuttonalliance/espi/common/dto/customer/CustomerDtoMarshallingTest.java +++ b/openespi-common/src/test/java/org/greenbuttonalliance/espi/common/dto/customer/CustomerDtoMarshallingTest.java @@ -227,7 +227,7 @@ void shouldMarshalCustomerWithAllFields() { // Assert - Field values assertThat(xml).contains("ACME Energy Services"); - assertThat(xml).contains("RESIDENTIAL"); + assertThat(xml).contains("residential"); assertThat(xml).contains("Wheelchair access required"); assertThat(xml).contains("true"); assertThat(xml).contains("PUC-12345"); @@ -282,7 +282,7 @@ void shouldUseCustPrefixForAllElements() { // Arrange CustomerDto customer = new CustomerDto( null, - CustomerKind.COMMERCIAL, + CustomerKind.COMMERCIAL_INDUSTRIAL, "Test special need", false, "PUC-999", diff --git a/openespi-common/src/test/java/org/greenbuttonalliance/espi/common/dto/customer/CustomerDtoTest.java b/openespi-common/src/test/java/org/greenbuttonalliance/espi/common/dto/customer/CustomerDtoTest.java index 4c77f5e7..05d1a26d 100644 --- a/openespi-common/src/test/java/org/greenbuttonalliance/espi/common/dto/customer/CustomerDtoTest.java +++ b/openespi-common/src/test/java/org/greenbuttonalliance/espi/common/dto/customer/CustomerDtoTest.java @@ -103,7 +103,7 @@ void shouldExportCustomerWithRealisticData() throws IOException { assertThat(xml).contains("ACME Energy Services"); // Assert - Customer fields present - assertThat(xml).contains("RESIDENTIAL"); + assertThat(xml).contains("residential"); assertThat(xml).contains("Life support required"); assertThat(xml).contains("PUC-12345"); assertThat(xml).contains("John Smith"); @@ -230,7 +230,7 @@ void shouldExportCustomerWithMinimalData() throws IOException { // Assert assertThat(xml).contains("> violations = validator.validate(customer); // Assert assertThat(violations).isEmpty(); - assertThat(customer.getKind()).isEqualTo(CustomerKind.COMMERCIAL); + assertThat(customer.getKind()).isEqualTo(CustomerKind.COMMERCIAL_INDUSTRIAL); } @Test diff --git a/openespi-common/src/test/java/org/greenbuttonalliance/espi/common/repositories/integration/CustomerMySQLIntegrationTest.java b/openespi-common/src/test/java/org/greenbuttonalliance/espi/common/repositories/integration/CustomerMySQLIntegrationTest.java index b8114b54..9e482110 100644 --- a/openespi-common/src/test/java/org/greenbuttonalliance/espi/common/repositories/integration/CustomerMySQLIntegrationTest.java +++ b/openespi-common/src/test/java/org/greenbuttonalliance/espi/common/repositories/integration/CustomerMySQLIntegrationTest.java @@ -85,7 +85,7 @@ void shouldSaveAndRetrieveCustomerWithAllFields() { // Arrange CustomerEntity customer = TestDataBuilders.createValidCustomer(); customer.setCustomerName("MySQL Integration Test Customer"); - customer.setKind(CustomerKind.COMMERCIAL); + customer.setKind(CustomerKind.COMMERCIAL_INDUSTRIAL); customer.setSpecialNeed("Wheelchair access"); customer.setVip(true); customer.setPucNumber("PUC-MYSQL-12345"); @@ -134,7 +134,7 @@ void shouldSaveAndRetrieveCustomerWithAllFields() { CustomerEntity result = retrieved.get(); assertThat(result.getCustomerName()).isEqualTo("MySQL Integration Test Customer"); - assertThat(result.getKind()).isEqualTo(CustomerKind.COMMERCIAL); + assertThat(result.getKind()).isEqualTo(CustomerKind.COMMERCIAL_INDUSTRIAL); assertThat(result.getSpecialNeed()).isEqualTo("Wheelchair access"); assertThat(result.getVip()).isTrue(); assertThat(result.getPucNumber()).isEqualTo("PUC-MYSQL-12345"); diff --git a/openespi-common/src/test/java/org/greenbuttonalliance/espi/common/repositories/integration/CustomerPostgreSQLIntegrationTest.java b/openespi-common/src/test/java/org/greenbuttonalliance/espi/common/repositories/integration/CustomerPostgreSQLIntegrationTest.java index 8eb33a7c..5fe98061 100644 --- a/openespi-common/src/test/java/org/greenbuttonalliance/espi/common/repositories/integration/CustomerPostgreSQLIntegrationTest.java +++ b/openespi-common/src/test/java/org/greenbuttonalliance/espi/common/repositories/integration/CustomerPostgreSQLIntegrationTest.java @@ -163,7 +163,7 @@ void shouldUpdateCustomerFields() { // Act savedCustomer.setCustomerName("Updated PostgreSQL Name"); - savedCustomer.setKind(CustomerKind.COMMERCIAL); + savedCustomer.setKind(CustomerKind.COMMERCIAL_INDUSTRIAL); CustomerEntity updatedCustomer = customerRepository.save(savedCustomer); flushAndClear(); @@ -172,7 +172,7 @@ void shouldUpdateCustomerFields() { // Assert assertThat(retrieved).isPresent(); assertThat(retrieved.get().getCustomerName()).isEqualTo("Updated PostgreSQL Name"); - assertThat(retrieved.get().getKind()).isEqualTo(CustomerKind.COMMERCIAL); + assertThat(retrieved.get().getKind()).isEqualTo(CustomerKind.COMMERCIAL_INDUSTRIAL); } @Test