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; package org.gcube.accounting.analytics;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Calendar;
import org.json.JSONObject; import org.json.JSONObject;
@ -15,31 +15,31 @@ import org.json.JSONObject;
*/ */
public class Info { public class Info {
protected Date date; protected Calendar calendar;
protected JSONObject value; protected JSONObject value;
/** /**
* @param date the date * @param date the date
* @param value the JSON value * @param value the JSON value
*/ */
public Info(Date date, JSONObject value) { public Info(Calendar calendar, JSONObject value) {
super(); super();
this.date = date; this.calendar = calendar;
this.value = value; this.value = value;
} }
/** /**
* @return the date * @return the date
*/ */
public Date getDate() { public Calendar getCalendar() {
return date; return calendar;
} }
/** /**
* @param date the date to set * @param date the date to set
*/ */
public void setDate(Date date) { public void setCalendar(Calendar calendar) {
this.date = date; this.calendar = calendar;
} }
/** /**
@ -60,6 +60,6 @@ public class Info {
public String toString(){ public String toString(){
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SS z"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SS z");
simpleDateFormat.setTimeZone(TemporalConstraint.DEFAULT_TIME_ZONE); 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.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -120,8 +119,7 @@ public class ResourceRecordQuery {
if(unpaddedData.get(progressTime)!=null){ if(unpaddedData.get(progressTime)!=null){
paddedResults.add(unpaddedData.get(progressTime)); paddedResults.add(unpaddedData.get(progressTime));
}else{ }else{
Date date = new Date(progressTime.getTimeInMillis()); Info info = new Info(progressTime, jsonObject);
Info info = new Info(date, jsonObject);
paddedResults.add(info); paddedResults.add(info);
} }
} }