diff --git a/cwms-data-api/src/main/java/cwms/cda/api/LevelsController.java b/cwms-data-api/src/main/java/cwms/cda/api/LevelsController.java index 34cf9943c..e6d190965 100644 --- a/cwms-data-api/src/main/java/cwms/cda/api/LevelsController.java +++ b/cwms-data-api/src/main/java/cwms/cda/api/LevelsController.java @@ -44,6 +44,7 @@ import static cwms.cda.api.Controllers.PAGE_SIZE; import static cwms.cda.api.Controllers.RESULTS; import static cwms.cda.api.Controllers.SIZE; +import static cwms.cda.api.Controllers.START; import static cwms.cda.api.Controllers.STATUS_200; import static cwms.cda.api.Controllers.TIMEZONE; import static cwms.cda.api.Controllers.UNIT; @@ -89,11 +90,12 @@ import io.javalin.plugin.openapi.annotations.OpenApiParam; import io.javalin.plugin.openapi.annotations.OpenApiRequestBody; import io.javalin.plugin.openapi.annotations.OpenApiResponse; +import javax.servlet.http.HttpServletResponse; import java.math.BigDecimal; +import java.time.Instant; import java.time.ZoneId; import java.time.ZonedDateTime; import java.util.List; -import javax.servlet.http.HttpServletResponse; import org.jetbrains.annotations.NotNull; import org.jooq.DSLContext; @@ -330,17 +332,14 @@ public void getAll(@NotNull Context ctx) { + "specified), as well as the time zone of any times in the response." + " If this field is not specified, the default time zone of UTC " + "shall be used."), - @OpenApiParam(name = UNIT, description = "Specifies the unit or unit system" - + " of the response. Valid values for the unit field are:" - + "\n* `EN` " - + "Specifies English unit system. Location level values will be in" - + " the default English units for their parameters." - + "\n* `SI` " - + "Specifies the SI unit system. Location level values will be in " - + "the default SI units for their parameters." - + "\n* `Other` " - + "Any unit returned in the response to the units URI request that is " - + "appropriate for the requested parameters. "), + @OpenApiParam(name = START, type = Instant.class, description = "Specifies the start of the time " + + "window for data to be included in the response. Both this field and the end field must be " + + " specified, or no time window will be used."), + @OpenApiParam(name = END, type = Instant.class, description = "Specifies the end of the time " + + "window for data to be included in the response. Both this field and the start field must be" + + " specified, or no time window will be used."), + @OpenApiParam(name = UNIT, description = "Desired unit for " + + "the values retrieved.") }, responses = { @OpenApiResponse(status = STATUS_200,content = { @@ -357,16 +356,22 @@ public void getOne(@NotNull Context ctx, @NotNull String levelId) { String dateString = queryParamAsClass(ctx, new String[]{EFFECTIVE_DATE, DATE}, String.class, null, metrics, name(LevelsController.class.getName(), GET_ONE)); + Instant start = ctx.queryParamAsClass(START, Long.class).getOrDefault(null) == null ? null + : Instant.ofEpochMilli(ctx.queryParamAsClass(START, Long.class).get()); + Instant end = ctx.queryParamAsClass(END, Long.class).getOrDefault(null) == null ? null + : Instant.ofEpochMilli(ctx.queryParamAsClass(END, Long.class).getOrDefault(null)); String timezone = ctx.queryParamAsClass(TIMEZONE, String.class) .getOrDefault("UTC"); try (final Timer.Context ignored = markAndTime(GET_ONE)) { DSLContext dsl = getDslContext(ctx); ZonedDateTime unmarshalledDateTime = DateUtils.parseUserDate(dateString, timezone); + ZonedDateTime startZdt = start == null ? null : ZonedDateTime.ofInstant(start, ZoneId.of(timezone)); + ZonedDateTime endZdt = end == null ? null : ZonedDateTime.ofInstant(end, ZoneId.of(timezone)); LocationLevelsDao levelsDao = getLevelsDao(dsl); LocationLevel locationLevel = levelsDao.retrieveLocationLevel(levelId, - units, unmarshalledDateTime, office); + units, unmarshalledDateTime, office, startZdt, endZdt); ctx.json(locationLevel); ctx.status(HttpServletResponse.SC_OK); } @@ -424,7 +429,7 @@ public void update(@NotNull Context ctx, @NotNull String oldLevelId) { ZoneId.systemDefault().getId()); //retrieveLocationLevel will throw an error if level does not exist LocationLevel existingLevelLevel = levelsDao.retrieveLocationLevel(oldLevelId, - UnitSystem.EN.getValue(), unmarshalledDateTime, officeId); + UnitSystem.EN.getValue(), unmarshalledDateTime, officeId, null, null); existingLevelLevel = updatedClearedFields(ctx.body(), contentType.getType(), existingLevelLevel); //only store (update) if level does exist diff --git a/cwms-data-api/src/main/java/cwms/cda/data/dao/LocationLevelsDao.java b/cwms-data-api/src/main/java/cwms/cda/data/dao/LocationLevelsDao.java index 58ff3a8e4..1fedc8d06 100644 --- a/cwms-data-api/src/main/java/cwms/cda/data/dao/LocationLevelsDao.java +++ b/cwms-data-api/src/main/java/cwms/cda/data/dao/LocationLevelsDao.java @@ -31,7 +31,6 @@ import mil.army.usace.hec.metadata.Interval; import java.time.Instant; -import java.time.ZoneId; import java.time.ZonedDateTime; public interface LocationLevelsDao { @@ -43,7 +42,7 @@ void deleteLocationLevel(String locationLevelName, ZonedDateTime date, String of void renameLocationLevel(String oldLocationLevelName, String newLocationLevelName, String officeId); LocationLevel retrieveLocationLevel(String locationLevelName, String unitSystem, - ZonedDateTime effectiveDate, String officeId); + ZonedDateTime effectiveDate, String officeId, ZonedDateTime start, ZonedDateTime end); String getLocationLevels(String format, String names, String office, String unit, String datum, String begin, diff --git a/cwms-data-api/src/main/java/cwms/cda/data/dao/LocationLevelsDaoImpl.java b/cwms-data-api/src/main/java/cwms/cda/data/dao/LocationLevelsDaoImpl.java index 9195cc741..33d484c1b 100644 --- a/cwms-data-api/src/main/java/cwms/cda/data/dao/LocationLevelsDaoImpl.java +++ b/cwms-data-api/src/main/java/cwms/cda/data/dao/LocationLevelsDaoImpl.java @@ -52,6 +52,7 @@ import java.time.Instant; import java.time.ZoneId; import java.time.ZonedDateTime; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Date; @@ -74,6 +75,7 @@ import org.jooq.DSLContext; import org.jooq.Record; import org.jooq.Record1; +import org.jooq.Result; import org.jooq.SelectLimitPercentAfterOffsetStep; import org.jooq.TableField; import org.jooq.conf.ParamType; @@ -249,7 +251,7 @@ private static SEASONAL_VALUE_TAB_T getSeasonalValues(LocationLevel locationLeve SEASONAL_VALUE_TAB_T pSeasonalValues = null; if (seasonalValues != null && !seasonalValues.isEmpty()) { pSeasonalValues = new SEASONAL_VALUE_TAB_T(); - for(SeasonalValueBean seasonalValue : seasonalValues) { + for (SeasonalValueBean seasonalValue : seasonalValues) { SEASONAL_VALUE_T seasonalValueT = new SEASONAL_VALUE_T(); seasonalValueT.setOFFSET_MINUTES(toBigDecimal(seasonalValue.getOffsetMinutes())); if (seasonalValue.getOffsetMonths() != null) { @@ -329,50 +331,101 @@ public void renameLocationLevel(String oldLocationLevelName, String newLocationL @Override public LocationLevel retrieveLocationLevel(String locationLevelName, String pUnits, - ZonedDateTime effectiveDate, String officeId) { + ZonedDateTime effectiveDate, String officeId, ZonedDateTime start, ZonedDateTime end) { Timestamp date = Timestamp.from(effectiveDate.toInstant()); - String[] levelIdParts = locationLevelIdParsingPattern.split(locationLevelName); - if (levelIdParts.length <= 2) { - throw new IllegalArgumentException("Location level name is in an invalid format, must be separated by '.'"); - } - String parameter = levelIdParts[1]; + Timestamp startDate = start == null ? null : Timestamp.from(start.toInstant()); + Timestamp endDate = end == null ? null : Timestamp.from(end.toInstant()); return connectionResult(dsl, c -> { String units = pUnits; Configuration configuration = getDslContext(c, officeId).configuration(); - if (units != null && (units.equalsIgnoreCase("SI") - || units.equalsIgnoreCase("EN"))) { - units = CWMS_UTIL_PACKAGE.call_GET_DEFAULT_UNITS(configuration, - parameter, units); - } - RETRIEVE_LOCATION_LEVEL3 level = CWMS_LEVEL_PACKAGE.call_RETRIEVE_LOCATION_LEVEL3( - configuration, locationLevelName, units, date, - "UTC", null, null, units, - "F", officeId); - List seasonalValues = buildSeasonalValues(level); - if (units == null) { - logger.info("Getting default units for " + parameter); - String defaultUnits = CWMS_UTIL_PACKAGE.call_GET_DEFAULT_UNITS( - configuration, parameter, UnitSystem.SI.getValue()); - logger.info("Default units are " + defaultUnits); - units = defaultUnits; + + if (start != null && end != null) { + + ZoneId tz = start.getZone(); + if (units == null) { + String parameter = locationLevelName.split("\\.")[1]; + logger.info("Getting default units for " + parameter); + String defaultUnits = CWMS_UTIL_PACKAGE.call_GET_DEFAULT_UNITS( + configuration, parameter, UnitSystem.SI.getValue()); + logger.info("Default units are " + defaultUnits); + units = defaultUnits; + } + + Result result = dsl.select(AV_LOCATION_LEVEL.LOCATION_LEVEL_ID, + AV_LOCATION_LEVEL.OFFICE_ID, AV_LOCATION_LEVEL.LEVEL_DATE, + AV_LOCATION_LEVEL.CONSTANT_LEVEL, AV_LOCATION_LEVEL.LEVEL_UNIT) + .from(AV_LOCATION_LEVEL) + .where(AV_LOCATION_LEVEL.LOCATION_LEVEL_ID.eq(locationLevelName)) + .and(AV_LOCATION_LEVEL.OFFICE_ID.eq(officeId)) + .and(AV_LOCATION_LEVEL.LEVEL_DATE.ge(startDate)) + .and(AV_LOCATION_LEVEL.LEVEL_DATE.le(endDate)) + .and(AV_LOCATION_LEVEL.LEVEL_UNIT.eq(units)) + .fetch(); + + if (result.isEmpty()) { + throw new NotFoundException("No location level found for " + locationLevelName + " at " + date); + } + + boolean parentData = false; + String locLevelId = null; + Timestamp recentDate = null; + Double constantValue = null; + List constantList = new ArrayList<>(); + for (Record r : result) { + if (!parentData) + { + locLevelId = r.get(AV_LOCATION_LEVEL.LOCATION_LEVEL_ID); + } + + if (recentDate == null || recentDate.before(r.get(AV_LOCATION_LEVEL.LEVEL_DATE))) { + recentDate = r.get(AV_LOCATION_LEVEL.LEVEL_DATE); + constantValue = r.get(AV_LOCATION_LEVEL.CONSTANT_LEVEL); + } + constantList.add(new LocationLevel.ConstantValue.Builder() + .withConstantValue(r.get(AV_LOCATION_LEVEL.CONSTANT_LEVEL)) + .withLevelDate(ZonedDateTime.of(r.get(AV_LOCATION_LEVEL.LEVEL_DATE).toLocalDateTime(), + tz)) + .build()); + } + + return new LocationLevel.Builder(locLevelId, + ZonedDateTime.of(recentDate.toLocalDateTime(), tz)) + .withConstantValueList(constantList).withConstantValue(constantValue) + .withOfficeId(officeId).withAttributeUnitsId(units) + .build(); + + } else { + RETRIEVE_LOCATION_LEVEL3 level = CWMS_LEVEL_PACKAGE.call_RETRIEVE_LOCATION_LEVEL3( + configuration, locationLevelName, units, date, + "UTC", null, null, units, + "F", officeId); + List seasonalValues = buildSeasonalValues(level); + if (units == null) { + String parameter = locationLevelName.split("\\.")[1]; + logger.info("Getting default units for " + parameter); + String defaultUnits = CWMS_UTIL_PACKAGE.call_GET_DEFAULT_UNITS( + configuration, parameter, UnitSystem.SI.getValue()); + logger.info("Default units are " + defaultUnits); + units = defaultUnits; + } + return new LocationLevel.Builder(locationLevelName, effectiveDate) + .withLevelUnitsId(units) + .withAttributeUnitsId(units) + .withInterpolateString(level.getP_INTERPOLATE()) + .withIntervalMinutes(Optional.ofNullable(level.getP_INTERVAL_MINUTES()) + .map(BigInteger::intValue).orElse(null)) + .withIntervalMonths(Optional.ofNullable(level.getP_INTERVAL_MONTHS()) + .map(BigInteger::intValue).orElse(null)) + .withIntervalOrigin(level.getP_INTERVAL_ORIGIN(), effectiveDate) + .withLevelComment(level.getP_LEVEL_COMMENT()) + .withOfficeId(officeId) + .withAttributeParameterId(level.get(RETRIEVE_LOCATION_LEVEL3.P_ATTRIBUTE_ID)) + .withSeasonalTimeSeriesId(level.get(RETRIEVE_LOCATION_LEVEL3.P_TSID)) + .withSeasonalValues(seasonalValues) + .withConstantValue(Optional.ofNullable(level.getP_LEVEL_VALUE()) + .map(BigDecimal::doubleValue).orElse(null)) + .build(); } - return new LocationLevel.Builder(locationLevelName, effectiveDate) - .withLevelUnitsId(units) - .withAttributeUnitsId(units) - .withInterpolateString(level.getP_INTERPOLATE()) - .withIntervalMinutes(Optional.ofNullable(level.getP_INTERVAL_MINUTES()) - .map(BigInteger::intValue).orElse(null)) - .withIntervalMonths(Optional.ofNullable(level.getP_INTERVAL_MONTHS()) - .map(BigInteger::intValue).orElse(null)) - .withIntervalOrigin(level.getP_INTERVAL_ORIGIN(), effectiveDate) - .withLevelComment(level.getP_LEVEL_COMMENT()) - .withOfficeId(officeId) - .withAttributeParameterId(level.get(RETRIEVE_LOCATION_LEVEL3.P_ATTRIBUTE_ID)) - .withSeasonalTimeSeriesId(level.get(RETRIEVE_LOCATION_LEVEL3.P_TSID)) - .withSeasonalValues(seasonalValues) - .withConstantValue(Optional.ofNullable(level.getP_LEVEL_VALUE()) - .map(BigDecimal::doubleValue).orElse(null)) - .build(); }); } diff --git a/cwms-data-api/src/main/java/cwms/cda/data/dto/LocationLevel.java b/cwms-data-api/src/main/java/cwms/cda/data/dto/LocationLevel.java index 953eaf40d..73086f9e9 100644 --- a/cwms-data-api/src/main/java/cwms/cda/data/dto/LocationLevel.java +++ b/cwms-data-api/src/main/java/cwms/cda/data/dto/LocationLevel.java @@ -67,6 +67,10 @@ public final class LocationLevel extends CwmsDTO { + "seasonableTimeSeriesId and seasonValues.") private final Double constantValue; + @Schema(description = "List of constant values for this location level.") + @JsonFormat(shape = JsonFormat.Shape.ARRAY) + + private final List constantValueList; @Schema(description = "Units the provided levels are in") private final String levelUnitsId; @@ -121,6 +125,7 @@ private LocationLevel(Builder builder) { parameterTypeId = builder.parameterTypeId; parameterId = builder.parameterId; constantValue = builder.constantValue; + constantValueList = builder.constantValueList; levelUnitsId = builder.levelUnitsId; levelDate = builder.levelDate; levelComment = builder.levelComment; @@ -162,6 +167,10 @@ public Double getConstantValue() { return constantValue; } + public List getConstantValueList() { + return constantValueList; + } + public String getLevelUnitsId() { return levelUnitsId; } @@ -231,6 +240,7 @@ public static class Builder { private String parameterTypeId; private String parameterId; private Double constantValue; + private List constantValueList; private String levelUnitsId; private ZonedDateTime levelDate; private String levelComment; @@ -470,6 +480,11 @@ public Builder withConstantValue(Double value) { return this; } + public Builder withConstantValueList(List constantValueList) { + this.constantValueList = constantValueList; + return this; + } + public Builder withLevelUnitsId(String levelUnitsId) { this.levelUnitsId = levelUnitsId; return this; @@ -576,14 +591,54 @@ protected void validateInternal(CwmsDTOValidator validator) { super.validateInternal(validator); validator.required(getOfficeId(), "office-id"); validator.required(getLocationLevelId(), "location-level-id"); - if(getConstantValue() == null && getSeasonalTimeSeriesId() == null) { + if (getConstantValue() == null && getSeasonalTimeSeriesId() == null) { validator.required(getSeasonalValues(), "seasonal-values"); - } else if(getSeasonalValues() == null && getSeasonalTimeSeriesId() == null) { + } else if (getSeasonalValues() == null && getSeasonalTimeSeriesId() == null) { validator.required(getConstantValue(), "constant-value"); - } else if(getConstantValue() == null && getSeasonalValues() == null) { + } else if (getConstantValue() == null && getSeasonalValues() == null) { validator.required(getSeasonalTimeSeriesId(), "seasonable-time-series-id"); } - validator.mutuallyExclusive("Only one of the following can be defined for location levels: constant-value, seasonal-values, seasonable-time-series-id", + validator.mutuallyExclusive("Only one of the following can be defined for location levels: " + + "constant-value, seasonal-values, seasonable-time-series-id", getConstantValue(), getSeasonalValues(), getSeasonalTimeSeriesId()); } + + @JsonFormat(shape = JsonFormat.Shape.ARRAY) + public static class ConstantValue { + @JsonFormat(shape = JsonFormat.Shape.STRING) + private final ZonedDateTime levelDate; + private final double value; + + private ConstantValue(Builder builder) { + levelDate = builder.levelDate; + value = builder.constantValue; + } + + public ZonedDateTime getLevelDate() { + return levelDate; + } + + public double getValue() { + return value; + } + + public static class Builder { + private ZonedDateTime levelDate; + private double constantValue; + + public Builder withConstantValue(double constantValue) { + this.constantValue = constantValue; + return this; + } + + public Builder withLevelDate(ZonedDateTime levelDate) { + this.levelDate = levelDate; + return this; + } + + public ConstantValue build() { + return new ConstantValue(this); + } + } + } } diff --git a/cwms-data-api/src/test/java/cwms/cda/api/LevelsControllerTestIT.java b/cwms-data-api/src/test/java/cwms/cda/api/LevelsControllerTestIT.java index 7ad386057..3fea06281 100644 --- a/cwms-data-api/src/test/java/cwms/cda/api/LevelsControllerTestIT.java +++ b/cwms-data-api/src/test/java/cwms/cda/api/LevelsControllerTestIT.java @@ -299,6 +299,81 @@ void test_level_as_timeseries() throws Exception { } } + @Test + void test_get_constants_over_time() throws Exception { + String locId = "level_get_constants_test"; + String levelId = locId + ".Stor.Ave.1Day.Regulating"; + createLocation(locId, true, OFFICE); + final ZonedDateTime time = ZonedDateTime.of(2023, 6, 1, 0, 0, 0, 0, ZoneId.of("America" + + "/Los_Angeles")); + CwmsDataApiSetupCallback.getDatabaseLink().connection(c -> { + LocationLevel level = new LocationLevel.Builder(levelId, time) + .withOfficeId(OFFICE) + .withConstantValue(1.0) + .withLevelUnitsId("ac-ft") + .build(); + LocationLevel level2 = new LocationLevel.Builder(levelId, time.plusDays(1)) + .withOfficeId(OFFICE) + .withConstantValue(2.0) + .withLevelUnitsId("ac-ft") + .build(); + DSLContext dsl = dslContext(c, OFFICE); + LocationLevelsDaoImpl dao = new LocationLevelsDaoImpl(dsl); + dao.storeLocationLevel(level); + dao.storeLocationLevel(level2); + }); + + Instant startTime = Instant.parse("2023-06-01T00:00:00Z"); + Instant endTime = Instant.parse("2023-06-02T12:00:00Z"); + + // get location level constants over time + given() + .log().ifValidationFails(LogDetail.ALL, true) + .accept(Formats.JSONV2) + .contentType(Formats.JSONV2) + .queryParam(Controllers.OFFICE, OFFICE) + .queryParam(START, startTime.toEpochMilli()) + .queryParam(END, endTime.toEpochMilli()) + .queryParam(EFFECTIVE_DATE, time.toInstant().toString()) + .queryParam(UNIT, "ac-ft") + .when() + .redirects().follow(true) + .redirects().max(3) + .get("/levels/" + levelId) + .then() + .assertThat() + .log().ifValidationFails(LogDetail.ALL, true) + .statusCode(is(HttpServletResponse.SC_OK)) + .body("constant-value-list.size()", is(2)) + .body("constant-value-list[0].toString()",equalTo("[2023-06-01T00:00:00Z, 1.0]")) + .body("constant-value-list[1].toString()",equalTo("[2023-06-02T00:00:00Z, 2.0]")) + ; + + // get location level constants over time with specified timezone + given() + .log().ifValidationFails(LogDetail.ALL, true) + .accept(Formats.JSONV2) + .contentType(Formats.JSONV2) + .queryParam(Controllers.OFFICE, OFFICE) + .queryParam(START, startTime.toEpochMilli()) + .queryParam(END, endTime.toEpochMilli()) + .queryParam(EFFECTIVE_DATE, time.toInstant().toString()) + .queryParam(UNIT, "ac-ft") + .queryParam(TIMEZONE, "America/Phoenix") + .when() + .redirects().follow(true) + .redirects().max(3) + .get("/levels/" + levelId) + .then() + .assertThat() + .log().ifValidationFails(LogDetail.ALL, true) + .statusCode(is(HttpServletResponse.SC_OK)) + .body("constant-value-list.size()", is(2)) + .body("constant-value-list[0].toString()",equalTo("[2023-06-01T00:00:00-07:00, 1.0]")) + .body("constant-value-list[1].toString()",equalTo("[2023-06-02T00:00:00-07:00, 2.0]")) + ; + } + @Test void test_get_all_location_level() throws Exception { diff --git a/cwms-data-api/src/test/java/cwms/cda/data/dao/LocationLevelsDaoTest.java b/cwms-data-api/src/test/java/cwms/cda/data/dao/LocationLevelsDaoTest.java index d06b1cadd..19c74dca3 100644 --- a/cwms-data-api/src/test/java/cwms/cda/data/dao/LocationLevelsDaoTest.java +++ b/cwms-data-api/src/test/java/cwms/cda/data/dao/LocationLevelsDaoTest.java @@ -70,7 +70,7 @@ void testStore() throws Exception locationsDao.storeLocation(location); LocationLevelsDao levelsDao = new LocationLevelsDaoImpl(getDslContext(getConnection(), OFFICE_ID)); levelsDao.storeLocationLevel(levelToStore); - LocationLevel retrievedLevel = levelsDao.retrieveLocationLevel(levelToStore.getLocationLevelId(), UnitSystem.EN.getValue(), levelToStore.getLevelDate(), "LRL"); + LocationLevel retrievedLevel = levelsDao.retrieveLocationLevel(levelToStore.getLocationLevelId(), UnitSystem.EN.getValue(), levelToStore.getLevelDate(), "LRL", null, null); assertNotNull(retrievedLevel); assertEquals(levelToStore.getLocationLevelId(), retrievedLevel.getLocationLevelId()); assertEquals(levelToStore.getLevelDate(), retrievedLevel.getLevelDate()); @@ -92,10 +92,10 @@ void testDeleteLocationLevel() throws Exception Location location = buildTestLocation("TEST_LOC5"); locationsDao.storeLocation(location); levelsDao.storeLocationLevel(levelToStore); - LocationLevel retrievedLevel = levelsDao.retrieveLocationLevel(levelToStore.getLocationLevelId(), UnitSystem.EN.getValue(), levelToStore.getLevelDate(), OFFICE_ID); + LocationLevel retrievedLevel = levelsDao.retrieveLocationLevel(levelToStore.getLocationLevelId(), UnitSystem.EN.getValue(), levelToStore.getLevelDate(), OFFICE_ID, null, null); assertNotNull(retrievedLevel); levelsDao.deleteLocationLevel(levelToStore.getLocationLevelId(), levelToStore.getLevelDate(), OFFICE_ID, true); - assertThrows(IOException.class, () -> levelsDao.retrieveLocationLevel(levelToStore.getLocationLevelId(), UnitSystem.EN.getValue(), levelToStore.getLevelDate(), OFFICE_ID)); + assertThrows(IOException.class, () -> levelsDao.retrieveLocationLevel(levelToStore.getLocationLevelId(), UnitSystem.EN.getValue(), levelToStore.getLevelDate(), OFFICE_ID, null, null)); } @Disabled @@ -114,7 +114,7 @@ void testUpdate() throws Exception String format = Formats.JSON; LocationLevel levelFromBody = deserializeLocationLevel(body, Formats.JSON, OFFICE_ID); - existingLocationLevel = levelsDao.retrieveLocationLevel(levelToStore.getLocationLevelId(), UnitSystem.EN.getValue(), levelFromBody.getLevelDate(), OFFICE_ID); + existingLocationLevel = levelsDao.retrieveLocationLevel(levelToStore.getLocationLevelId(), UnitSystem.EN.getValue(), levelFromBody.getLevelDate(), OFFICE_ID, null, null); existingLocationLevel = updatedClearedFields(body, format, existingLocationLevel); //only store (update) if level does exist updatedLocationLevel = getUpdatedLocationLevel(existingLocationLevel, levelFromBody); @@ -125,7 +125,7 @@ void testUpdate() throws Exception } else { levelsDao.storeLocationLevel(updatedLocationLevel); } - LocationLevel retrievedLevel = levelsDao.retrieveLocationLevel(updatedLocationLevel.getLocationLevelId(), UnitSystem.EN.getValue(), updatedLocationLevel.getLevelDate(), OFFICE_ID); + LocationLevel retrievedLevel = levelsDao.retrieveLocationLevel(updatedLocationLevel.getLocationLevelId(), UnitSystem.EN.getValue(), updatedLocationLevel.getLevelDate(), OFFICE_ID, null, null); assertNotNull(retrievedLevel); } finally {