GetUsageRecordsCmd - NewInputFormat for START_DATE and END_DATE (with time; backward capabile)

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Ilia Shakitko 2015-04-21 15:43:25 +02:00 committed by Rohit Yadav
parent 00b6a54dcf
commit fe29998938
2 changed files with 4 additions and 4 deletions

View File

@ -55,13 +55,13 @@ public class GetUsageRecordsCmd extends BaseListCmd {
@Parameter(name = ApiConstants.END_DATE,
type = CommandType.DATE,
required = true,
description = "End date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-03.")
description = "End date range for usage record query (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-dd HH:mm:ss\", e.g. startDate=2015-01-01 or startdate=2015-01-01 10:30:00).")
private Date endDate;
@Parameter(name = ApiConstants.START_DATE,
type = CommandType.DATE,
required = true,
description = "Start date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-01.")
description = "Start date range for usage record query (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-dd HH:mm:ss\", e.g. startDate=2015-01-01 or startdate=2015-01-01 11:00:00).")
private Date startDate;
@Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "List usage records for the specified account")

View File

@ -50,6 +50,7 @@ import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.command.admin.resource.ArchiveAlertsCmd;
import org.apache.cloudstack.api.command.admin.resource.DeleteAlertsCmd;
import org.apache.cloudstack.api.command.admin.usage.GetUsageRecordsCmd;
import org.apache.cloudstack.api.command.user.event.ArchiveEventsCmd;
import org.apache.cloudstack.api.command.user.event.DeleteEventsCmd;
import org.apache.cloudstack.api.command.user.event.ListEventsCmd;
@ -254,9 +255,8 @@ public class ParamProcessWorker implements DispatchWorker {
case DATE:
// This piece of code is for maintaining backward compatibility
// and support both the date formats(Bug 9724)
// Do the date messaging for ListEventsCmd only
if (cmdObj instanceof ListEventsCmd || cmdObj instanceof DeleteEventsCmd || cmdObj instanceof ArchiveEventsCmd ||
cmdObj instanceof ArchiveAlertsCmd || cmdObj instanceof DeleteAlertsCmd) {
cmdObj instanceof ArchiveAlertsCmd || cmdObj instanceof DeleteAlertsCmd || cmdObj instanceof GetUsageRecordsCmd) {
final boolean isObjInNewDateFormat = isObjInNewDateFormat(paramObj.toString());
if (isObjInNewDateFormat) {
final DateFormat newFormat = BaseCmd.NEW_INPUT_FORMAT;