Changed Date to Calendar

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-analytics@118926 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2015-09-08 09:49:47 +00:00
parent bba1228989
commit c8e986f1ba
2 changed files with 10 additions and 12 deletions

View File

@ -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());
}
}

View File

@ -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);
}
}