Fix List Alarm/Alarms History Offset in Vertica

Offset in list alarms state history and list alarm state history
should be timestamp string instead of id.

Change-Id: I5a8665c9d202d0a2058f10ffbc1e85dc8069914b
This commit is contained in:
Kaiyan Sheng 2016-03-18 15:09:31 -06:00
parent 0d8f007b24
commit 1eb60c8618
2 changed files with 8 additions and 8 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
* Copyright (c) 2014,2016 Hewlett Packard Enterprise Development Company, L.P.
*
* 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
@ -129,8 +129,8 @@ public class AlarmStateHistoryVerticaRepoImpl implements AlarmStateHistoryRepo {
if (offset != null && !offset.isEmpty()) {
// Timestamp will not work in this query for some unknown reason.
verticaQuery.bind("offset", formatDateFromMillis(Long.valueOf(offset)));
DateTime offset_dt = new DateTime(offset);
verticaQuery.bind("offset", formatDateFromMillis(offset_dt.getMillis()));
}
@ -242,11 +242,9 @@ public class AlarmStateHistoryVerticaRepoImpl implements AlarmStateHistoryRepo {
logger.debug("binding offset: {}", offset);
// Timestamp will not work in this query for some unknown reason.
String timeStamp = formatDateFromMillis(Long.valueOf(offset));
verticaQuery.bind("offset", timeStamp);
DateTime offset_dt = new DateTime(offset);
verticaQuery.bind("offset", formatDateFromMillis(offset_dt.getMillis()));
}
DimensionQueries.bindDimensionsToQuery(verticaQuery, dimensions);

View File

@ -149,6 +149,8 @@ public class AlarmResource {
DateTime endTime = Validation.parseAndValidateDate(endTimeStr, "end_time", false);
Validation.parseAndValidateDate(offset, "offset", false);
if (startTime != null) {
Validation.validateTimes(startTime, endTime);
}