Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@96352 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e8da8c451d
commit
6f1ccdb067
|
@ -16,7 +16,6 @@ import org.gcube.data.analysis.tabulardata.service.tabular.TabularResource;
|
|||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.file.FileUploadSession;
|
||||
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.csv.CSVExportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
|
@ -83,15 +82,15 @@ 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!");
|
||||
/*
|
||||
username = Constants.DEFAULT_USER;
|
||||
String scope = Constants.DEFAULT_SCOPE;
|
||||
|
||||
httpSession.setAttribute(ScopeHelper.USERNAME_ATTRIBUTE, username);
|
||||
session = SessionManager.getInstance().getASLSession(
|
||||
httpSession.getId(), username);
|
||||
session.setScope(scope);
|
||||
session.setScope(scope);*/
|
||||
|
||||
} else {
|
||||
session = SessionManager.getInstance().getASLSession(
|
||||
|
|
|
@ -101,11 +101,13 @@ import org.gcube.portlets.user.td.gwtservice.server.file.FileUploadSession;
|
|||
import org.gcube.portlets.user.td.gwtservice.server.file.FileUtil;
|
||||
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.ColumnTypeCodeMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.ExpressionGenerator;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.ExtractCodelistOperationMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.ExtractReferences;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationDefinitionMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.QueryService;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.TDTypeValueMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.TaskStateMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.ValueMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
||||
|
@ -137,9 +139,9 @@ import org.gcube.portlets.user.td.gwtservice.shared.share.ShareInfo;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.InvocationS;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.JobS;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.State;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskResubmitMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskResubmitSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.State;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskResumeMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskResumeSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskS;
|
||||
|
@ -207,6 +209,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Agencies;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Codelist;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Dataset;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
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.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
|
@ -4112,17 +4115,130 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
logger.debug(addColumnSession.toString());
|
||||
|
||||
OperationDefinition operationDefinition;
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.AddColumn.toString(), service);
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
DefNewColumn col = addColumnSession.getColumn();
|
||||
|
||||
OperationExecution invocation = null;
|
||||
|
||||
OperationDefinition operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.AddColumn.toString(), service);
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
DefNewColumn defNewColumn = addColumnSession.getColumn();
|
||||
|
||||
ColumnTypeCode type = defNewColumn.getColumnType();
|
||||
|
||||
switch (type) {
|
||||
case ANNOTATION:
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
|
||||
ColumnTypeCodeMap.getColumnType(defNewColumn
|
||||
.getColumnType()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE,
|
||||
ColumnDataType.Text);
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, TDTypeValueMap.map(
|
||||
ColumnDataType.Text,
|
||||
defNewColumn.getDefaultValue()));
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
break;
|
||||
case ATTRIBUTE:
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
|
||||
ColumnTypeCodeMap.getColumnType(defNewColumn
|
||||
.getColumnType()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE,
|
||||
ColumnDataTypeMap.map(defNewColumn.getColumnDataType()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, TDTypeValueMap.map(
|
||||
defNewColumn.getColumnDataType(),
|
||||
defNewColumn.getDefaultValue()));
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
break;
|
||||
case CODE:
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
|
||||
ColumnTypeCodeMap.getColumnType(defNewColumn
|
||||
.getColumnType()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE,
|
||||
ColumnDataType.Text);
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, TDTypeValueMap.map(
|
||||
ColumnDataType.Text,
|
||||
defNewColumn.getDefaultValue()));
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
break;
|
||||
case CODEDESCRIPTION:
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
|
||||
ColumnTypeCodeMap.getColumnType(defNewColumn
|
||||
.getColumnType()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE,
|
||||
ColumnDataType.Text);
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, TDTypeValueMap.map(
|
||||
ColumnDataType.Text,
|
||||
defNewColumn.getDefaultValue()));
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
break;
|
||||
case CODENAME:
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
|
||||
ColumnTypeCodeMap.getColumnType(defNewColumn
|
||||
.getColumnType()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE,
|
||||
ColumnDataType.Text);
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, TDTypeValueMap.map(
|
||||
ColumnDataType.Text,
|
||||
defNewColumn.getDefaultValue()));
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
break;
|
||||
case DIMENSION:
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
|
||||
ColumnTypeCodeMap.getColumnType(defNewColumn
|
||||
.getColumnType()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, TDTypeValueMap.map(
|
||||
ColumnDataType.Text,
|
||||
defNewColumn.getDefaultValue()));
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
break;
|
||||
case MEASURE:
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
|
||||
ColumnTypeCodeMap.getColumnType(defNewColumn
|
||||
.getColumnType()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE,
|
||||
ColumnDataTypeMap.map(defNewColumn.getColumnDataType()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, TDTypeValueMap.map(
|
||||
defNewColumn.getColumnDataType(),
|
||||
defNewColumn.getDefaultValue()));
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
break;
|
||||
case TIMEDIMENSION:
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
|
||||
ColumnTypeCodeMap.getColumnType(defNewColumn
|
||||
.getColumnType()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, TDTypeValueMap.map(
|
||||
ColumnDataType.Text,
|
||||
defNewColumn.getDefaultValue()));
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return invocation;
|
||||
}
|
||||
|
@ -4278,7 +4394,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
return invocation;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param service
|
||||
|
@ -4287,29 +4402,26 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
* @throws TDGWTServiceException
|
||||
*/
|
||||
protected OperationExecution retrieveOperationExecution(
|
||||
TabularDataService service,
|
||||
SplitColumnSession splitColumnSession)
|
||||
TabularDataService service, SplitColumnSession splitColumnSession)
|
||||
throws TDGWTServiceException {
|
||||
|
||||
OperationExecution invocation = null;
|
||||
|
||||
logger.debug(splitColumnSession.toString());
|
||||
/*
|
||||
OperationDefinition operationDefinition;
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.Col.toString(), service);
|
||||
map.put(Constants., splitColumnSession
|
||||
.getTableType().toString());
|
||||
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
* OperationDefinition operationDefinition; Map<String, Object> map =
|
||||
* new HashMap<String, Object>();
|
||||
*
|
||||
* operationDefinition = OperationDefinitionMap.map(
|
||||
* OperationsId.Col.toString(), service); map.put(Constants.,
|
||||
* splitColumnSession .getTableType().toString());
|
||||
*
|
||||
* invocation = new OperationExecution(
|
||||
* operationDefinition.getOperationId(), map);
|
||||
*/
|
||||
return invocation;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param service
|
||||
|
@ -4318,24 +4430,22 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
* @throws TDGWTServiceException
|
||||
*/
|
||||
protected OperationExecution retrieveOperationExecution(
|
||||
TabularDataService service,
|
||||
MergeColumnSession mergeColumnSession)
|
||||
TabularDataService service, MergeColumnSession mergeColumnSession)
|
||||
throws TDGWTServiceException {
|
||||
|
||||
OperationExecution invocation = null;
|
||||
|
||||
logger.debug(mergeColumnSession.toString());
|
||||
/*
|
||||
OperationDefinition operationDefinition;
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.Col.toString(), service);
|
||||
map.put(Constants., splitColumnSession
|
||||
.getTableType().toString());
|
||||
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
* OperationDefinition operationDefinition; Map<String, Object> map =
|
||||
* new HashMap<String, Object>();
|
||||
*
|
||||
* operationDefinition = OperationDefinitionMap.map(
|
||||
* OperationsId.Col.toString(), service); map.put(Constants.,
|
||||
* splitColumnSession .getTableType().toString());
|
||||
*
|
||||
* invocation = new OperationExecution(
|
||||
* operationDefinition.getOperationId(), map);
|
||||
*/
|
||||
return invocation;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.gcube.data.analysis.tabulardata.model.datatype.value.TDNumeric;
|
|||
import org.gcube.data.analysis.tabulardata.model.datatype.value.TDText;
|
||||
import org.gcube.data.analysis.tabulardata.model.datatype.value.TDTypeValue;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -62,4 +63,47 @@ public class TDTypeValueMap {
|
|||
}
|
||||
return tdTypeValue;
|
||||
}
|
||||
|
||||
|
||||
public static TDTypeValue map(ColumnDataType dataType, String value)
|
||||
throws TDGWTServiceException {
|
||||
TDTypeValue tdTypeValue = null;
|
||||
try {
|
||||
switch (dataType) {
|
||||
case Boolean:
|
||||
Boolean b = new Boolean(value);
|
||||
tdTypeValue = new TDBoolean(b);
|
||||
break;
|
||||
case Date:
|
||||
Long d = new Long(value);
|
||||
Date date = new Date(d);
|
||||
tdTypeValue = new TDDate(date);
|
||||
break;
|
||||
case Geometry:
|
||||
tdTypeValue = new TDText(value);
|
||||
break;
|
||||
case Integer:
|
||||
Integer in = new Integer(value);
|
||||
tdTypeValue = new TDInteger(in);
|
||||
break;
|
||||
case Numeric:
|
||||
Float fl = new Float(value);
|
||||
tdTypeValue = new TDNumeric(fl);
|
||||
break;
|
||||
case Text:
|
||||
tdTypeValue = new TDText(value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.debug("Error in TDTypeValueMap: "+e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException("Error in TDTypeValueMap: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
return tdTypeValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -67,4 +67,10 @@ public class Constants {
|
|||
public static final String REQUEST_PROPERTIES_COLUMNID = "ColumnId";
|
||||
public static final String REQUEST_PROPERTIES_TASKID = "TaskId";
|
||||
|
||||
public static final String PARAMETER_ADD_COLUMN_COLUMN_TYPE = "columnType";
|
||||
public static final String PARAMETER_ADD_COLUMN_LABEL = "label";
|
||||
public static final String PARAMETER_ADD_COLUMN_DATA_TYPE = "dataType";
|
||||
public static final String PARAMETER_ADD_COLUMN_VALUE = "value";
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue