From c8e986f1ba0ef43b054487a067656bc8280fac20 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Tue, 8 Sep 2015 09:49:47 +0000 Subject: [PATCH] Changed Date to Calendar git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-analytics@118926 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../org/gcube/accounting/analytics/Info.java | 18 +++++++++--------- .../analytics/ResourceRecordQuery.java | 4 +--- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/gcube/accounting/analytics/Info.java b/src/main/java/org/gcube/accounting/analytics/Info.java index d6aeef3..5f28f85 100644 --- a/src/main/java/org/gcube/accounting/analytics/Info.java +++ b/src/main/java/org/gcube/accounting/analytics/Info.java @@ -4,7 +4,7 @@ package org.gcube.accounting.analytics; import java.text.SimpleDateFormat; -import java.util.Date; +import java.util.Calendar; import org.json.JSONObject; @@ -15,31 +15,31 @@ import org.json.JSONObject; */ public class Info { - protected Date date; + protected Calendar calendar; protected JSONObject value; /** * @param date the date * @param value the JSON value */ - public Info(Date date, JSONObject value) { + public Info(Calendar calendar, JSONObject value) { super(); - this.date = date; + this.calendar = calendar; this.value = value; } /** * @return the date */ - public Date getDate() { - return date; + public Calendar getCalendar() { + return calendar; } /** * @param date the date to set */ - public void setDate(Date date) { - this.date = date; + public void setCalendar(Calendar calendar) { + this.calendar = calendar; } /** @@ -60,6 +60,6 @@ public class Info { public String toString(){ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SS z"); simpleDateFormat.setTimeZone(TemporalConstraint.DEFAULT_TIME_ZONE); - return String.format("Date : %s, Value : %s", simpleDateFormat.format(date), value.toString()); + return String.format("Date : %s, Value : %s", simpleDateFormat.format(calendar.getTime()), value.toString()); } } diff --git a/src/main/java/org/gcube/accounting/analytics/ResourceRecordQuery.java b/src/main/java/org/gcube/accounting/analytics/ResourceRecordQuery.java index 8752143..7260062 100644 --- a/src/main/java/org/gcube/accounting/analytics/ResourceRecordQuery.java +++ b/src/main/java/org/gcube/accounting/analytics/ResourceRecordQuery.java @@ -5,7 +5,6 @@ package org.gcube.accounting.analytics; import java.util.ArrayList; import java.util.Calendar; -import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -120,8 +119,7 @@ public class ResourceRecordQuery { if(unpaddedData.get(progressTime)!=null){ paddedResults.add(unpaddedData.get(progressTime)); }else{ - Date date = new Date(progressTime.getTimeInMillis()); - Info info = new Info(date, jsonObject); + Info info = new Info(progressTime, jsonObject); paddedResults.add(info); } }