refs #166: Create accouting-analytics library

https://support.d4science.org/issues/166
Implementing Library

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-analytics@117244 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2015-07-15 08:32:27 +00:00
parent 158914c5b4
commit e9993a2300
1 changed files with 11 additions and 9 deletions

View File

@ -5,6 +5,7 @@ package org.gcube.accounting.analytics;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.TimeZone;
import org.json.JSONObject;
@ -15,31 +16,31 @@ import org.json.JSONObject;
*/
public class Info {
protected Calendar date;
protected Calendar calendar;
protected JSONObject value;
/**
* @param calendar
* @param value
*/
public Info(Calendar date, JSONObject value) {
public Info(Calendar calendar, JSONObject value) {
super();
this.date = date;
this.calendar = calendar;
this.value = value;
}
/**
* @return the calendar
*/
public Calendar getDate() {
return date;
public Calendar getCalendar() {
return calendar;
}
/**
* @param calendar the calendar to set
*/
public void setDate(Calendar calendar) {
this.date = calendar;
public void setCalendar(Calendar calendar) {
this.calendar = calendar;
}
/**
@ -58,7 +59,8 @@ public class Info {
@Override
public String toString(){
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SS z");
return String.format("Date : %s, Value : %s", dateFormatter.format(date.getTime()), value.toString());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SS z");
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
return String.format("Date : %s, Value : %s", simpleDateFormat.format(calendar.getTime()), value.toString());
}
}