Updated ColumnDataTypeMap

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@114062 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-04-15 11:32:26 +00:00
parent 6a9a42430f
commit 83034fc2a7
2 changed files with 60 additions and 28 deletions

View File

@ -17,6 +17,7 @@ import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
import org.gcube.portlets.user.td.gwtservice.server.file.CSVFileUploadSession;
import org.gcube.portlets.user.td.gwtservice.server.file.CodelistMappingFileUploadSession;
import org.gcube.portlets.user.td.gwtservice.server.trservice.TRTasksManager;
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
import org.gcube.portlets.user.td.gwtservice.shared.chart.ChartTopRatingSession;
import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
@ -87,10 +88,9 @@ public class SessionUtil {
ASLSession session;
if (username == null) {
logger.warn("no user found in session, using test one");
throw new TDGWTSessionExpiredException("Session Expired!");
/*throw new TDGWTSessionExpiredException("Session Expired!");*/
// Remove comment for Test
/*
username = Constants.DEFAULT_USER;
String scope = Constants.DEFAULT_SCOPE;
@ -98,7 +98,7 @@ public class SessionUtil {
session = SessionManager.getInstance().getASLSession(
httpSession.getId(), username);
session.setScope(scope);
*/
} else {
session = SessionManager.getInstance().getASLSession(
httpSession.getId(), username);

View File

@ -1,4 +1,5 @@
package org.gcube.portlets.user.td.gwtservice.server.trservice;
import org.gcube.data.analysis.tabulardata.model.datatype.BooleanType;
import org.gcube.data.analysis.tabulardata.model.datatype.DataType;
import org.gcube.data.analysis.tabulardata.model.datatype.DateType;
@ -8,32 +9,31 @@ import org.gcube.data.analysis.tabulardata.model.datatype.NumericType;
import org.gcube.data.analysis.tabulardata.model.datatype.TextType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
/**
*
* @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 class ColumnDataTypeMap {
public static DataType map(ColumnDataType columnDataType){
if(columnDataType==ColumnDataType.Integer){
return new IntegerType() ;
public static DataType map(ColumnDataType columnDataType) {
if (columnDataType == ColumnDataType.Integer) {
return new IntegerType();
} else {
if(columnDataType==ColumnDataType.Numeric){
if (columnDataType == ColumnDataType.Numeric) {
return new NumericType();
} else {
if(columnDataType==ColumnDataType.Boolean){
if (columnDataType == ColumnDataType.Boolean) {
return new BooleanType();
} else {
if(columnDataType==ColumnDataType.Geometry){
if (columnDataType == ColumnDataType.Geometry) {
return new GeometryType();
} else {
if(columnDataType==ColumnDataType.Text){
if (columnDataType == ColumnDataType.Text) {
return new TextType();
} else {
if(columnDataType==ColumnDataType.Date){
if (columnDataType == ColumnDataType.Date) {
return new DateType();
} else {
return null;
@ -44,25 +44,58 @@ public class ColumnDataTypeMap {
}
}
}
public static Class<? extends DataType> mapToDataTypeClass(ColumnDataType columnDataType){
if(columnDataType==ColumnDataType.Integer){
return IntegerType.class ;
public static ColumnDataType map(DataType dataType) {
if (dataType == null) {
return null;
}
if (dataType instanceof IntegerType) {
return ColumnDataType.Integer;
} else {
if(columnDataType==ColumnDataType.Numeric){
if (dataType instanceof NumericType) {
return ColumnDataType.Numeric;
} else {
if (dataType instanceof BooleanType) {
return ColumnDataType.Boolean;
} else {
if (dataType instanceof GeometryType) {
return ColumnDataType.Geometry;
} else {
if (dataType instanceof TextType) {
return ColumnDataType.Text;
} else {
if (dataType instanceof DateType) {
return ColumnDataType.Date;
} else {
return null;
}
}
}
}
}
}
}
public static Class<? extends DataType> mapToDataTypeClass(
ColumnDataType columnDataType) {
if (columnDataType == ColumnDataType.Integer) {
return IntegerType.class;
} else {
if (columnDataType == ColumnDataType.Numeric) {
return NumericType.class;
} else {
if(columnDataType==ColumnDataType.Boolean){
if (columnDataType == ColumnDataType.Boolean) {
return BooleanType.class;
} else {
if(columnDataType==ColumnDataType.Geometry){
if (columnDataType == ColumnDataType.Geometry) {
return GeometryType.class;
} else {
if(columnDataType==ColumnDataType.Text){
if (columnDataType == ColumnDataType.Text) {
return TextType.class;
} else {
if(columnDataType==ColumnDataType.Date){
if (columnDataType == ColumnDataType.Date) {
return DateType.class;
} else {
return null;
@ -73,6 +106,5 @@ public class ColumnDataTypeMap {
}
}
}
}