Skip to content
Open
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
18 changes: 9 additions & 9 deletions cwms-data-api/src/main/java/cwms/cda/api/LevelsController.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
import java.io.IOException;
import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils;
Expand Down Expand Up @@ -186,8 +186,8 @@ public void delete(@NotNull Context ctx, @NotNull String levelId) {
.getOrDefault("UTC");
Boolean cascadeDelete = ctx.queryParamAsClass(CASCADE_DELETE, Boolean.class)
.getOrDefault(false);
ZonedDateTime unmarshalledDateTime = dateString != null
? DateUtils.parseUserDate(dateString, timezone) : null;
Instant unmarshalledDateTime = dateString != null
? DateUtils.parseUserDate(dateString, timezone).toInstant() : null;
LocationLevelsDao levelsDao = getLevelsDao(dsl);
levelsDao.deleteLocationLevel(levelId, unmarshalledDateTime, office, cascadeDelete);
StatusResponse re = new StatusResponse(office,"CWMS Location Level Deleted", levelId);
Expand Down Expand Up @@ -302,12 +302,12 @@ public void getAll(@NotNull Context ctx) {
int pageSize = ctx.queryParamAsClass(PAGE_SIZE, Integer.class)
.getOrDefault(DEFAULT_PAGE_SIZE);

ZonedDateTime endZdt = queryParamAsZdt(ctx, END);
ZonedDateTime beginZdt = queryParamAsZdt(ctx, BEGIN);
Instant beginInstant = queryParamAsInstant(ctx, BEGIN);
Instant endInstant = queryParamAsInstant(ctx, END);

LocationLevels levels;
levels = levelsDao.getLocationLevels(cursor, pageSize, levelIdMask,
office, unit, datum, beginZdt, endZdt, includeAliases);
office, unit, datum, beginInstant, endInstant, includeAliases);
String result = Formats.format(contentType, levels);

ctx.result(result);
Expand Down Expand Up @@ -394,7 +394,7 @@ String.class, null, metrics, name(LevelsController.class.getName(),

try (final Timer.Context ignored = markAndTime(GET_ONE)) {
DSLContext dsl = getDslContext(ctx);
ZonedDateTime unmarshalledDateTime = DateUtils.parseUserDate(dateString, timezone);
Instant unmarshalledDateTime = DateUtils.parseUserDate(dateString, timezone).toInstant();

LocationLevelsDao levelsDao = getLevelsDao(dsl);
//retrieveLocationLevel will throw an error if level does not exist
Expand Down Expand Up @@ -455,8 +455,8 @@ public void update(@NotNull Context ctx, @NotNull String oldLevelId) {
throw new IllegalArgumentException("Cannot update location level "
+ "effective date if no date is specified");
}
ZonedDateTime unmarshalledDateTime = DateUtils.parseUserDate(dateString,
ZoneId.systemDefault().getId());
Instant unmarshalledDateTime = DateUtils.parseUserDate(dateString,
ZoneId.systemDefault().getId()).toInstant();
//retrieveLocationLevel will throw an error if level does not exist
LocationLevel existingLevelLevel = levelsDao.retrieveLocationLevel(oldLevelId,
UnitSystem.EN.getValue(), unmarshalledDateTime, officeId, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,25 @@
import hec.data.level.ILocationLevelRef;
import mil.army.usace.hec.metadata.Interval;
import java.time.Instant;
import java.time.ZonedDateTime;

public interface LocationLevelsDao {
void deleteLocationLevel(String locationLevelName, ZonedDateTime date, String officeId,
void deleteLocationLevel(String locationLevelName, Instant date, String officeId,
Boolean cascadeDelete);

void storeLocationLevel(LocationLevel level);

void renameLocationLevel(String oldLocationLevelName, String newLocationLevelName, String officeId);

LocationLevel retrieveLocationLevel(String locationLevelName, String unitSystem,
ZonedDateTime effectiveDate, String officeId, boolean exactDateMatch);
Instant effectiveDate, String officeId, boolean exactDateMatch);

String getLocationLevels(String format, String names, String office, String unit,
String datum, String begin,
String end, String timezone);

LocationLevels getLocationLevels(String cursor, int pageSize,
String names, String office, String unit, String datum,
ZonedDateTime beginZdt, ZonedDateTime endZdt, boolean includeAliases);
Instant beginZdt, Instant endZdt, boolean includeAliases);

TimeSeries retrieveLocationLevelAsTimeSeries(ILocationLevelRef levelRef, Instant start, Instant end,
Interval interval, String units);
Expand Down
Loading
Loading