Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@111745 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
04937b9997
commit
5541f36f7f
|
@ -50,6 +50,7 @@ import org.gcube.data.analysis.tabulardata.commons.webservice.types.resources.Re
|
|||
import org.gcube.data.analysis.tabulardata.commons.webservice.types.tasks.ValidationDescriptor;
|
||||
import org.gcube.data.analysis.tabulardata.expression.Expression;
|
||||
import org.gcube.data.analysis.tabulardata.metadata.NoSuchMetadataException;
|
||||
import org.gcube.data.analysis.tabulardata.model.DataTypeFormats;
|
||||
import org.gcube.data.analysis.tabulardata.model.ValueFormat;
|
||||
import org.gcube.data.analysis.tabulardata.model.column.Column;
|
||||
import org.gcube.data.analysis.tabulardata.model.column.ColumnLocalId;
|
||||
|
@ -62,6 +63,7 @@ import org.gcube.data.analysis.tabulardata.model.column.type.DimensionColumnType
|
|||
import org.gcube.data.analysis.tabulardata.model.column.type.IdColumnType;
|
||||
import org.gcube.data.analysis.tabulardata.model.column.type.TimeDimensionColumnType;
|
||||
import org.gcube.data.analysis.tabulardata.model.column.type.ValidationColumnType;
|
||||
import org.gcube.data.analysis.tabulardata.model.datatype.DataType;
|
||||
import org.gcube.data.analysis.tabulardata.model.datatype.value.TDTypeValue;
|
||||
import org.gcube.data.analysis.tabulardata.model.metadata.Locales;
|
||||
import org.gcube.data.analysis.tabulardata.model.metadata.column.DataLocaleMetadata;
|
||||
|
@ -143,6 +145,7 @@ import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecutionDirec
|
|||
import org.gcube.portlets.user.td.gwtservice.server.resource.ResourceTDCreator;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.resource.ResourceTDTypeMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.storage.FilesStorage;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.ColumnDataTypeMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.ExtractReferences;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.LicenceMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationDefinitionMap;
|
||||
|
@ -265,6 +268,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.user.UserInfo;
|
|||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.operations.OperationsId;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.operations.UIOperationsId;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.RelationshipData;
|
||||
import org.gcube.portlets.user.uriresolvermanager.UriResolverManager;
|
||||
|
@ -405,6 +409,44 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param columnDataType
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
public ArrayList<ValueDataFormat> getValueDataFormats(ColumnDataType columnDataType)
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
SessionUtil.getAslSession(session);
|
||||
|
||||
ArrayList<ValueDataFormat> valueDataFormats = new ArrayList<ValueDataFormat>();
|
||||
|
||||
Class<? extends DataType> dataType=ColumnDataTypeMap.mapToDataTypeClass(columnDataType);
|
||||
|
||||
for (ValueFormat valueF: DataTypeFormats.getFormatsPerDataType(dataType)) {
|
||||
ValueDataFormat valueDataFormat = new ValueDataFormat(
|
||||
valueF.getId(), valueF.getExample(), valueF.getRegExpr());
|
||||
valueDataFormats.add(valueDataFormat);
|
||||
}
|
||||
|
||||
|
||||
logger.debug("ValueDataFormats: "+valueDataFormats);
|
||||
return valueDataFormats;
|
||||
|
||||
} catch (TDGWTServiceException e) {
|
||||
throw e;
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS);
|
||||
} catch (Throwable e) {
|
||||
logger.error("getValueDataFormats(): " + e.getLocalizedMessage(), e);
|
||||
throw new TDGWTServiceException("Error retrieving value data formats: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -46,4 +46,33 @@ public class ColumnDataTypeMap {
|
|||
}
|
||||
|
||||
|
||||
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){
|
||||
return BooleanType.class;
|
||||
} else {
|
||||
if(columnDataType==ColumnDataType.Geometry){
|
||||
return GeometryType.class;
|
||||
} else {
|
||||
if(columnDataType==ColumnDataType.Text){
|
||||
return TextType.class;
|
||||
} else {
|
||||
if(columnDataType==ColumnDataType.Date){
|
||||
return DateType.class;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue