Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions openespi-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -300,17 +300,7 @@
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<!-- Jakarta / Jackson XML Binding Dependencies -->
<dependency>
<groupId>tools.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>${jackson-bom.version}</version>
</dependency>
<dependency>
<groupId>tools.jackson.module</groupId>
<artifactId>jackson-module-jakarta-xmlbind-annotations</artifactId>
<version>${jackson-bom.version}</version>
</dependency>
<!-- Jakarta JAXB XML Binding Dependencies (removed Jackson XML) -->
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,48 +20,35 @@
package org.greenbuttonalliance.espi.common.dto;

import jakarta.xml.bind.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
* BillingChargeSource DTO record for JAXB XML marshalling/unmarshalling.
* BillingChargeSource DTO class for JAXB XML marshalling/unmarshalling.
* <p>
* Information about the source of billing charge.
* Per ESPI 4.0 XSD (espi.xsd:1628-1643), BillingChargeSource extends Object
* and contains a single agencyName field.
* <p>
* Embedded within UsageSummary DTO.
*/
@XmlAccessorType(XmlAccessType.PROPERTY)
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "BillingChargeSource", namespace = "http://naesb.org/espi", propOrder = {
"agencyName"
})
public record BillingChargeSourceDto(
String agencyName
) {

public class BillingChargeSourceDto {
/**
* Name of the billing source agency.
* Maximum length 256 characters per String256 type.
*/
@XmlElement(name = "agencyName")
public String getAgencyName() {
return agencyName;
}

/**
* Default constructor for JAXB.
*/
public BillingChargeSourceDto() {
this(null);
}

/**
* Constructor with agency name.
*
* @param agencyName the name of the billing source agency
*/
public BillingChargeSourceDto(String agencyName) {
this.agencyName = agencyName;
}
private String agencyName;

/**
* Checks if this billing charge source has a value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,33 @@
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlType;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.math.BigInteger;

/**
* RationalNumber DTO record for JAXB XML marshalling/unmarshalling.
*
* RationalNumber DTO class for JAXB XML marshalling/unmarshalling.
*
* Represents a rational number with numerator and denominator components
* as defined in the NAESB ESPI standard.
*
*
* @author Green Button Alliance
* @version 1.4.0
* @since Spring Boot 3.5
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RationalNumber", propOrder = { "numerator", "denominator" })
public record RationalNumberDto(
BigInteger numerator,
BigInteger denominator
) {
/**
* Default constructor for JAXB compatibility.
*/
public RationalNumberDto() {
this(null, null);
}

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class RationalNumberDto {
private BigInteger numerator;
private BigInteger denominator;

/**
* Constructor with numerator only (denominator defaults to 1).
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,36 @@
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlType;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.math.BigInteger;

/**
* ReadingInterharmonic DTO record for JAXB XML marshalling/unmarshalling.
*
* ReadingInterharmonic DTO class for JAXB XML marshalling/unmarshalling.
*
* Represents an interharmonic measurement with numerator and denominator components
* as defined in the NAESB ESPI standard for power quality measurements.
*
*
* Interharmonics are sinusoidal components with frequencies that are not integer
* multiples of the fundamental frequency. They can cause distortion in power systems.
*
*
* @author Green Button Alliance
* @version 1.4.0
* @since Spring Boot 3.5
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ReadingInterharmonic", propOrder = { "numerator", "denominator" })
public record ReadingInterharmonicDto(
BigInteger numerator,
BigInteger denominator
) {
/**
* Default constructor for JAXB compatibility.
*/
public ReadingInterharmonicDto() {
this(null, null);
}

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class ReadingInterharmonicDto {
private BigInteger numerator;
private BigInteger denominator;

/**
* Constructor with numerator only (denominator defaults to 1).
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,87 +20,71 @@
package org.greenbuttonalliance.espi.common.dto;

import jakarta.xml.bind.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
* SummaryMeasurement DTO record for JAXB XML marshalling/unmarshalling.
*
* SummaryMeasurement DTO class for JAXB XML marshalling/unmarshalling.
*
* Represents an aggregated summary measurement reading used in various
* ESPI resources like UsagePoint, UsageSummary, etc.
*
*
* Contains value, unit of measure, power of ten multiplier, timestamp, and readingTypeRef.
*
*
* IMPORTANT: readingTypeRef business rules per NAESB ESPI standard:
* - If UsagePoint atom 'related' readingType href URL is present: readingTypeRef is redundant and should be null/omitted
* - If no 'related' readingType href URL exists: readingTypeRef should default to the atom 'self' link's href URL
*/
@XmlAccessorType(XmlAccessType.PROPERTY)
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SummaryMeasurement", namespace = "http://naesb.org/espi", propOrder = {
"powerOfTenMultiplier", "timeStamp", "uom", "value", "readingTypeRef"
})
public record SummaryMeasurementDto(

String powerOfTenMultiplier,
Long timeStamp,
String uom,
Long value,
String readingTypeRef
) {

public class SummaryMeasurementDto {

/**
* Gets the power of ten multiplier for the measurement.
* Power of ten multiplier for the measurement.
* Used to scale the value (e.g., "3" for kilo, "6" for mega).
*/
@XmlElement(name = "powerOfTenMultiplier")
public String getPowerOfTenMultiplier() {
return powerOfTenMultiplier;
}

private String powerOfTenMultiplier;

/**
* Gets the timestamp when this measurement was taken.
* Timestamp when this measurement was taken.
* Stored as epoch seconds (TimeType in ESPI).
*/
@XmlElement(name = "timeStamp")
public Long getTimeStamp() {
return timeStamp;
}

private Long timeStamp;

/**
* Gets the unit of measure for this measurement.
* Unit of measure for this measurement.
* Examples: "W" (watts), "V" (volts), "A" (amperes).
*/
@XmlElement(name = "uom")
public String getUom() {
return uom;
}

private String uom;

/**
* Gets the measurement value.
* Measurement value.
* Combined with powerOfTenMultiplier to get the actual value.
*/
@XmlElement(name = "value")
public Long getValue() {
return value;
}

private Long value;

/**
* Gets the reading type reference (URI).
* Reading type reference (URI).
* Extension reference to a full ReadingType resource.
*
*
* BUSINESS RULE: Per NAESB ESPI standard:
* - Returns null if UsagePoint atom 'related' readingType href URL is present (redundant)
* - Returns atom 'self' link href URL if no 'related' readingType href exists
*/
@XmlElement(name = "readingTypeRef")
public String getReadingTypeRef() {
return readingTypeRef;
}

/**
* Default constructor for JAXB.
*/
public SummaryMeasurementDto() {
this(null, null, null, null, null);
}
private String readingTypeRef;

/**
* Constructor with value and unit of measure.
Expand Down
Loading
Loading