2018-05-17 16:04:22 +02:00
|
|
|
package org.gcube.dataharvest.utils;
|
|
|
|
|
|
|
|
import java.text.DateFormat;
|
|
|
|
import java.util.Calendar;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Luca Frosini (ISTI - CNR)
|
|
|
|
*/
|
2018-06-14 18:17:22 +02:00
|
|
|
public enum AggregationType {
|
2018-05-17 16:04:22 +02:00
|
|
|
|
|
|
|
DAILY(Calendar.DAY_OF_MONTH, "yyyy-MM-dd", 7),
|
|
|
|
MONTHLY(Calendar.MONTH, "yyyy-MM", 3),
|
|
|
|
YEARLY(Calendar.YEAR, "yyyy", 3);
|
|
|
|
|
|
|
|
public static final String DATE_SEPARATOR = "-";
|
|
|
|
|
|
|
|
private final int calendarField;
|
|
|
|
|
|
|
|
private final String dateFormatPattern;
|
|
|
|
private final DateFormat dateFormat;
|
|
|
|
|
|
|
|
private final int notAggregableBefore;
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-06-14 18:17:22 +02:00
|
|
|
private AggregationType(int calendarField, String dateFormatPattern, int notAggregableBefore) {
|
2018-05-17 16:04:22 +02:00
|
|
|
this.calendarField = calendarField;
|
|
|
|
this.dateFormatPattern=dateFormatPattern;
|
|
|
|
this.dateFormat = DateUtils.getUTCDateFormat(dateFormatPattern);
|
|
|
|
this.notAggregableBefore = notAggregableBefore;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getCalendarField() {
|
|
|
|
return calendarField;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getDateFormatPattern() {
|
|
|
|
return dateFormatPattern;
|
|
|
|
}
|
|
|
|
|
|
|
|
public DateFormat getDateFormat() {
|
|
|
|
return dateFormat;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getNotAggregableBefore(){
|
|
|
|
return notAggregableBefore;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|