You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2015/04/24 11:35:47 UTC
[1/2] git commit: updated refs/heads/master to 5c5873e
Repository: cloudstack
Updated Branches:
refs/heads/master 00b6a54dc -> 5c5873edf
GetUsageRecordsCmd - NewInputFormat for START_DATE and END_DATE (with time; backward capabile)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/fe299989
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/fe299989
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/fe299989
Branch: refs/heads/master
Commit: fe29998938478c60e3bd8388cc6ae15e3d628224
Parents: 00b6a54
Author: Ilia Shakitko <sh...@gmail.com>
Authored: Tue Apr 21 15:43:25 2015 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Fri Apr 24 11:34:51 2015 +0200
----------------------------------------------------------------------
.../cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java | 4 ++--
server/src/com/cloud/api/dispatch/ParamProcessWorker.java | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fe299989/api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java
index 8c1ce87..fd8173d 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java
@@ -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")
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fe299989/server/src/com/cloud/api/dispatch/ParamProcessWorker.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/dispatch/ParamProcessWorker.java b/server/src/com/cloud/api/dispatch/ParamProcessWorker.java
index 6eb53e0..b990d4a 100644
--- a/server/src/com/cloud/api/dispatch/ParamProcessWorker.java
+++ b/server/src/com/cloud/api/dispatch/ParamProcessWorker.java
@@ -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;
[2/2] git commit: updated refs/heads/master to 5c5873e
Posted by bh...@apache.org.
GetUsageRecordsCmd - Removed unnecessary adjust...
ToDayStart/End because ParamProcessWorker.java is taking care of building proper
date format with day start/end
This closes #185
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5c5873ed
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5c5873ed
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5c5873ed
Branch: refs/heads/master
Commit: 5c5873edf1d6dcf5fc1442dada38078d73381a40
Parents: fe29998
Author: Ilia Shakitko <sh...@gmail.com>
Authored: Thu Apr 23 15:47:40 2015 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Fri Apr 24 11:35:00 2015 +0200
----------------------------------------------------------------------
server/src/com/cloud/usage/UsageServiceImpl.java | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5c5873ed/server/src/com/cloud/usage/UsageServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/usage/UsageServiceImpl.java b/server/src/com/cloud/usage/UsageServiceImpl.java
index 8cc40ca..df43a00 100644
--- a/server/src/com/cloud/usage/UsageServiceImpl.java
+++ b/server/src/com/cloud/usage/UsageServiceImpl.java
@@ -222,11 +222,11 @@ public class UsageServiceImpl extends ManagerBase implements UsageService, Manag
throw new InvalidParameterValueException("Incorrect Date Range. Start date: " + startDate + " is after end date:" + endDate);
}
TimeZone usageTZ = getUsageTimezone();
- Date adjustedStartDate = computeAdjustedTime(startDate, usageTZ, true);
- Date adjustedEndDate = computeAdjustedTime(endDate, usageTZ, false);
+ Date adjustedStartDate = computeAdjustedTime(startDate, usageTZ);
+ Date adjustedEndDate = computeAdjustedTime(endDate, usageTZ);
if (s_logger.isDebugEnabled()) {
- s_logger.debug("getting usage records for account: " + accountId + ", domainId: " + domainId + ", between " + startDate + " and " + endDate +
+ s_logger.debug("getting usage records for account: " + accountId + ", domainId: " + domainId + ", between " + adjustedStartDate + " and " + adjustedEndDate +
", using pageSize: " + cmd.getPageSizeVal() + " and startIndex: " + cmd.getStartIndex());
}
@@ -408,7 +408,7 @@ public class UsageServiceImpl extends ManagerBase implements UsageService, Manag
return true;
}
- private Date computeAdjustedTime(Date initialDate, TimeZone targetTZ, boolean adjustToDayStart) {
+ private Date computeAdjustedTime(Date initialDate, TimeZone targetTZ) {
Calendar cal = Calendar.getInstance();
cal.setTime(initialDate);
TimeZone localTZ = cal.getTimeZone();
@@ -428,17 +428,6 @@ public class UsageServiceImpl extends ManagerBase implements UsageService, Manag
}
calTS.add(Calendar.MILLISECOND, -1 * timezoneOffset);
- if (adjustToDayStart) {
- calTS.set(Calendar.HOUR_OF_DAY, 0);
- calTS.set(Calendar.MINUTE, 0);
- calTS.set(Calendar.SECOND, 0);
- calTS.set(Calendar.MILLISECOND, 0);
- } else {
- calTS.set(Calendar.HOUR_OF_DAY, 23);
- calTS.set(Calendar.MINUTE, 59);
- calTS.set(Calendar.SECOND, 59);
- calTS.set(Calendar.MILLISECOND, 999);
- }
return calTS.getTime();
}