Added Century and Decade
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widget-common-event@111625 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c0130f98e8
commit
47e4bcbdef
|
@ -16,18 +16,26 @@ public enum PeriodDataType {
|
||||||
DAY("Day"),
|
DAY("Day"),
|
||||||
MONTH("Month"),
|
MONTH("Month"),
|
||||||
QUARTER("Quarter_of_year"),
|
QUARTER("Quarter_of_year"),
|
||||||
YEAR("Year");
|
YEAR("Year"),
|
||||||
|
DECADE("Decade"),
|
||||||
|
CENTURY("Century");
|
||||||
|
|
||||||
private static Map<PeriodDataType, List<PeriodDataType>> hierarchicalRelation = new HashMap<PeriodDataType, List<PeriodDataType>>();
|
private static Map<PeriodDataType, List<PeriodDataType>> hierarchicalRelation = new HashMap<PeriodDataType, List<PeriodDataType>>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
hierarchicalRelation.put(DAY, Arrays.asList(MONTH, QUARTER, YEAR));
|
hierarchicalRelation.put(DAY, Arrays.asList(MONTH, QUARTER, YEAR, DECADE, CENTURY));
|
||||||
hierarchicalRelation.put(MONTH, Arrays.asList(QUARTER, YEAR));
|
hierarchicalRelation.put(MONTH, Arrays.asList(QUARTER, YEAR, DECADE, CENTURY));
|
||||||
hierarchicalRelation.put(QUARTER, Arrays.asList(YEAR));
|
hierarchicalRelation.put(QUARTER, Arrays.asList(YEAR, DECADE, CENTURY));
|
||||||
|
hierarchicalRelation.put(YEAR, Arrays.asList(DECADE, CENTURY));
|
||||||
|
hierarchicalRelation.put(DECADE, Arrays.asList(CENTURY));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static final int START_YEAR = 1700;
|
||||||
|
|
||||||
|
private static final int END_YEAR = 2300;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param text
|
* @param text
|
||||||
*/
|
*/
|
||||||
|
@ -60,10 +68,52 @@ public enum PeriodDataType {
|
||||||
return "Quarter of year";
|
return "Quarter of year";
|
||||||
case YEAR:
|
case YEAR:
|
||||||
return "Year";
|
return "Year";
|
||||||
|
case DECADE:
|
||||||
|
return "Decade";
|
||||||
|
case CENTURY:
|
||||||
|
return "Century";
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getStartYear(){
|
||||||
|
return START_YEAR;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getEndYear(){
|
||||||
|
return END_YEAR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static PeriodDataType getPeriodFromString(String period){
|
||||||
|
if(period.compareToIgnoreCase(PeriodDataType.DAY.toString())==0){
|
||||||
|
return PeriodDataType.DAY;
|
||||||
|
} else {
|
||||||
|
if(period.compareToIgnoreCase(PeriodDataType.MONTH.toString())==0){
|
||||||
|
return PeriodDataType.MONTH;
|
||||||
|
} else {
|
||||||
|
if(period.compareToIgnoreCase(PeriodDataType.QUARTER.toString())==0){
|
||||||
|
return PeriodDataType.QUARTER;
|
||||||
|
} else {
|
||||||
|
if(period.compareToIgnoreCase(PeriodDataType.YEAR.toString())==0){
|
||||||
|
return PeriodDataType.YEAR;
|
||||||
|
} else {
|
||||||
|
if(period.compareToIgnoreCase(PeriodDataType.DECADE.toString())==0){
|
||||||
|
return PeriodDataType.DECADE;
|
||||||
|
} else {
|
||||||
|
if(period.compareToIgnoreCase(PeriodDataType.CENTURY.toString())==0){
|
||||||
|
return PeriodDataType.CENTURY;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
package org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column;
|
|
||||||
|
|
||||||
public enum TimeDimensionType {
|
|
||||||
Day("Day"),
|
|
||||||
Month("Month"),
|
|
||||||
Quarter("Quarter of year"),
|
|
||||||
Year("Year");
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
*/
|
|
||||||
private TimeDimensionType(final String time) {
|
|
||||||
this.time = time;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final String time;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return time;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue