Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.AssertTrue;

import com.fasterxml.jackson.annotation.JsonIgnore;

Expand Down Expand Up @@ -96,8 +97,6 @@ public void setHeatContentType(final HeatContentType heatContentType) {
this.heatContentType = heatContentType;
}

@Min(value = OPSLimits.SOURCE_HEAT_CONTENT_MINIMUM, message = "ops heat_content > " + OPSLimits.SOURCE_HEAT_CONTENT_MINIMUM)
@Max(value = OPSLimits.SOURCE_HEAT_CONTENT_MAXIMUM, message = "ops heat_content < " + OPSLimits.SOURCE_HEAT_CONTENT_MAXIMUM)
public Double getHeatContent() {
return heatContent;
}
Expand All @@ -106,6 +105,21 @@ public void setHeatContent(final Double heatContent) {
this.heatContent = heatContent;
}

@JsonIgnore
@AssertTrue(message = "for NOT_FORCED heat content types, ops heat_content must be present and between "
+ OPSLimits.SOURCE_HEAT_CONTENT_MINIMUM + " and " + OPSLimits.SOURCE_HEAT_CONTENT_MAXIMUM + " (both inclusive)")
public boolean isHeatContentValid() {
if (heatContentType == HeatContentType.FORCED) {
return true;
}
if (heatContent == null) {
return false;
}
final boolean withinMinimum = heatContent >= OPSLimits.SOURCE_HEAT_CONTENT_MINIMUM;
final boolean withinMaximum = heatContent <= OPSLimits.SOURCE_HEAT_CONTENT_MAXIMUM;
return withinMinimum && withinMaximum;
}

public Double getEmissionTemperature() {
return emissionTemperature;
}
Expand Down