Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widget-common-event@113636 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-03-18 09:30:59 +00:00
parent ef48de7e4d
commit 9a783981a0
2 changed files with 33 additions and 70 deletions

View File

@ -1,21 +1,15 @@
package org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public enum ColumnDataType {
Boolean("Boolean"),
Geometry("Geometry"),
Integer("Integer"),
Numeric("Numeric"),
Date("Date"),
Text("Text");
Boolean("Boolean"), Geometry("Geometry"), Integer("Integer"), Numeric(
"Numeric"), Date("Date"), Text("Text");
/**
* @param text
*/
@ -24,39 +18,28 @@ public enum ColumnDataType {
}
private final String id;
@Override
public String toString() {
return id;
}
public static ColumnDataType getColumnDataTypeFromId(String id){
if(id.compareTo(Boolean.id)==0){
return Boolean;
} else {
if(id.compareTo(Geometry.id)==0){
return Geometry;
} else {
if(id.compareTo(Integer.id)==0){
return Integer;
} else {
if(id.compareTo(Numeric.id)==0){
return Numeric;
} else {
if(id.compareTo(Date.id)==0){
return Date;
} else {
if(id.compareTo(Text.id)==0){
return Text;
} else {
return null;
}
}
}
}
}
}
public String getColumnDataTypeLabel() {
return id;
}
/**
*
* @param id
* @return
*/
public static ColumnDataType getColumnDataTypeFromId(String id) {
for (ColumnDataType columnDataType : values()) {
if (columnDataType.id.compareToIgnoreCase(id) == 0) {
return columnDataType;
}
}
return null;
}
}

View File

@ -49,40 +49,20 @@ public enum ColumnTypeCode {
}
/**
*
* @param id
* @return
*/
public static ColumnTypeCode getColumnTypeCodeFromId(String id) {
if (id.compareTo(ANNOTATION.id) == 0) {
return ANNOTATION;
} else {
if (id.compareTo(ATTRIBUTE.id) == 0) {
return ATTRIBUTE;
} else {
if (id.compareTo(CODE.id) == 0) {
return CODE;
} else {
if (id.compareTo(CODEDESCRIPTION.id) == 0) {
return CODEDESCRIPTION;
} else {
if (id.compareTo(CODENAME.id) == 0) {
return CODENAME;
} else {
if (id.compareTo(DIMENSION.id) == 0) {
return DIMENSION;
} else {
if (id.compareTo(MEASURE.id) == 0) {
return MEASURE;
} else {
if (id.compareTo(TIMEDIMENSION.id) == 0) {
return TIMEDIMENSION;
} else {
return null;
}
}
}
}
}
}
for (ColumnTypeCode columnTypeCode : values()) {
if (columnTypeCode.id.compareToIgnoreCase(id) == 0) {
return columnTypeCode;
}
}
return null;
}
}