Updated AddColumn
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@113838 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
adf762d5ad
commit
b40d1ace03
|
@ -17,7 +17,6 @@ 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.CSVFileUploadSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.file.CodelistMappingFileUploadSession;
|
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.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.chart.ChartTopRatingSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
|
||||||
|
@ -88,10 +87,10 @@ public class SessionUtil {
|
||||||
ASLSession session;
|
ASLSession session;
|
||||||
if (username == null) {
|
if (username == null) {
|
||||||
logger.warn("no user found in session, using test one");
|
logger.warn("no user found in session, using test one");
|
||||||
/*throw new TDGWTSessionExpiredException("Session Expired!"); */
|
throw new TDGWTSessionExpiredException("Session Expired!");
|
||||||
|
|
||||||
// Remove comment for Test
|
// Remove comment for Test
|
||||||
|
/*
|
||||||
username = Constants.DEFAULT_USER;
|
username = Constants.DEFAULT_USER;
|
||||||
String scope = Constants.DEFAULT_SCOPE;
|
String scope = Constants.DEFAULT_SCOPE;
|
||||||
|
|
||||||
|
@ -99,7 +98,7 @@ public class SessionUtil {
|
||||||
session = SessionManager.getInstance().getASLSession(
|
session = SessionManager.getInstance().getASLSession(
|
||||||
httpSession.getId(), username);
|
httpSession.getId(), username);
|
||||||
session.setScope(scope);
|
session.setScope(scope);
|
||||||
|
*/
|
||||||
} else {
|
} else {
|
||||||
session = SessionManager.getInstance().getASLSession(
|
session = SessionManager.getInstance().getASLSession(
|
||||||
httpSession.getId(), username);
|
httpSession.getId(), username);
|
||||||
|
|
|
@ -5256,14 +5256,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public String startAddColumn(AddColumnSession addColumnSession,
|
||||||
*
|
Expression expression, HttpSession session)
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String startAddColumn(AddColumnSession addColumnSession)
|
|
||||||
throws TDGWTServiceException {
|
throws TDGWTServiceException {
|
||||||
try {
|
try {
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
|
||||||
SessionUtil.setAddColumnSession(session, addColumnSession);
|
SessionUtil.setAddColumnSession(session, addColumnSession);
|
||||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||||
|
|
||||||
|
@ -5282,7 +5278,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
checkTabularResourceIsFinal(tabularResource);
|
checkTabularResourceIsFinal(tabularResource);
|
||||||
|
|
||||||
OpExecution4AddColumn opEx = new OpExecution4AddColumn(service,
|
OpExecution4AddColumn opEx = new OpExecution4AddColumn(service,
|
||||||
addColumnSession);
|
addColumnSession,expression);
|
||||||
OpExecutionDirector director = new OpExecutionDirector();
|
OpExecutionDirector director = new OpExecutionDirector();
|
||||||
director.setOperationExecutionBuilder(opEx);
|
director.setOperationExecutionBuilder(opEx);
|
||||||
director.constructOperationExecution();
|
director.constructOperationExecution();
|
||||||
|
@ -5300,9 +5296,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
TaskWrapper taskWrapper = new TaskWrapper(trTask,
|
TaskWrapper taskWrapper = new TaskWrapper(trTask,
|
||||||
UIOperationsId.AddColumn, addColumnSession.getTrId());
|
UIOperationsId.AddColumn, addColumnSession.getTrId());
|
||||||
SessionUtil.setStartedTask(session, taskWrapper);
|
SessionUtil.setStartedTask(session, taskWrapper);
|
||||||
|
|
||||||
return trTask.getId().getValue();
|
return trTask.getId().getValue();
|
||||||
|
|
||||||
} catch (TDGWTServiceException e) {
|
} catch (TDGWTServiceException e) {
|
||||||
throw e;
|
throw e;
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
|
@ -5316,6 +5310,17 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String startAddColumn(AddColumnSession addColumnSession)
|
||||||
|
throws TDGWTServiceException {
|
||||||
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
|
return startAddColumn(addColumnSession,null,session);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.OperationDefinition;
|
import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.OperationDefinition;
|
||||||
import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.OperationExecution;
|
import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.OperationExecution;
|
||||||
|
import org.gcube.data.analysis.tabulardata.expression.Expression;
|
||||||
import org.gcube.data.analysis.tabulardata.model.metadata.common.ImmutableLocalizedText;
|
import org.gcube.data.analysis.tabulardata.model.metadata.common.ImmutableLocalizedText;
|
||||||
import org.gcube.data.analysis.tabulardata.service.TabularDataService;
|
import org.gcube.data.analysis.tabulardata.service.TabularDataService;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.ColumnDataTypeMap;
|
import org.gcube.portlets.user.td.gwtservice.server.trservice.ColumnDataTypeMap;
|
||||||
|
@ -34,11 +35,13 @@ public class OpExecution4AddColumn extends OpExecutionBuilder {
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
private AddColumnSession addColumnSession;
|
private AddColumnSession addColumnSession;
|
||||||
|
private Expression expression;
|
||||||
|
|
||||||
public OpExecution4AddColumn(TabularDataService service,
|
public OpExecution4AddColumn(TabularDataService service,
|
||||||
AddColumnSession addColumnSession) {
|
AddColumnSession addColumnSession, Expression expression) {
|
||||||
this.service = service;
|
this.service = service;
|
||||||
this.addColumnSession = addColumnSession;
|
this.addColumnSession = addColumnSession;
|
||||||
|
this.expression = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -52,12 +55,10 @@ public class OpExecution4AddColumn extends OpExecutionBuilder {
|
||||||
|
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
|
|
||||||
ColumnMockUp defNewColumn = addColumnSession.getColumn();
|
ColumnMockUp defNewColumn = addColumnSession.getColumnMockUp();
|
||||||
|
|
||||||
ColumnTypeCode type = defNewColumn.getColumnType();
|
ColumnTypeCode type = defNewColumn.getColumnType();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ANNOTATION:
|
case ANNOTATION:
|
||||||
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
|
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
|
||||||
|
@ -67,9 +68,19 @@ public class OpExecution4AddColumn extends OpExecutionBuilder {
|
||||||
ColumnDataTypeMap.map(ColumnDataType.Text));
|
ColumnDataTypeMap.map(ColumnDataType.Text));
|
||||||
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||||
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
||||||
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE,
|
|
||||||
TDTypeValueMap.map(ColumnDataType.Text,
|
if (defNewColumn.hasExpression()) {
|
||||||
defNewColumn.getDefaultValue()));
|
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, expression);
|
||||||
|
} else {
|
||||||
|
if (defNewColumn.getDefaultValue() != null
|
||||||
|
&& !defNewColumn.getDefaultValue().isEmpty()) {
|
||||||
|
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE,
|
||||||
|
TDTypeValueMap.map(ColumnDataType.Text,
|
||||||
|
defNewColumn.getDefaultValue()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
invocation = new OperationExecution(
|
invocation = new OperationExecution(
|
||||||
operationDefinition.getOperationId(), map);
|
operationDefinition.getOperationId(), map);
|
||||||
break;
|
break;
|
||||||
|
@ -77,13 +88,21 @@ public class OpExecution4AddColumn extends OpExecutionBuilder {
|
||||||
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
|
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
|
||||||
ColumnTypeCodeMap.getColumnType(defNewColumn
|
ColumnTypeCodeMap.getColumnType(defNewColumn
|
||||||
.getColumnType()));
|
.getColumnType()));
|
||||||
map.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE,
|
map.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE,
|
||||||
ColumnDataTypeMap.map(defNewColumn.getColumnDataType()));
|
ColumnDataTypeMap.map(defNewColumn.getColumnDataType()));
|
||||||
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||||
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
||||||
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, TDTypeValueMap.map(
|
if (defNewColumn.hasExpression()) {
|
||||||
defNewColumn.getColumnDataType(),
|
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, expression);
|
||||||
defNewColumn.getDefaultValue()));
|
} else {
|
||||||
|
if (defNewColumn.getDefaultValue() != null
|
||||||
|
&& !defNewColumn.getDefaultValue().isEmpty()) {
|
||||||
|
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE,
|
||||||
|
TDTypeValueMap.map(
|
||||||
|
defNewColumn.getColumnDataType(),
|
||||||
|
defNewColumn.getDefaultValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
invocation = new OperationExecution(
|
invocation = new OperationExecution(
|
||||||
operationDefinition.getOperationId(), map);
|
operationDefinition.getOperationId(), map);
|
||||||
break;
|
break;
|
||||||
|
@ -95,9 +114,16 @@ public class OpExecution4AddColumn extends OpExecutionBuilder {
|
||||||
ColumnDataTypeMap.map(ColumnDataType.Text));
|
ColumnDataTypeMap.map(ColumnDataType.Text));
|
||||||
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||||
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
||||||
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE,
|
if (defNewColumn.hasExpression()) {
|
||||||
TDTypeValueMap.map(ColumnDataType.Text,
|
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, expression);
|
||||||
defNewColumn.getDefaultValue()));
|
} else {
|
||||||
|
if (defNewColumn.getDefaultValue() != null
|
||||||
|
&& !defNewColumn.getDefaultValue().isEmpty()) {
|
||||||
|
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE,
|
||||||
|
TDTypeValueMap.map(ColumnDataType.Text,
|
||||||
|
defNewColumn.getDefaultValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
invocation = new OperationExecution(
|
invocation = new OperationExecution(
|
||||||
operationDefinition.getOperationId(), map);
|
operationDefinition.getOperationId(), map);
|
||||||
break;
|
break;
|
||||||
|
@ -109,9 +135,16 @@ public class OpExecution4AddColumn extends OpExecutionBuilder {
|
||||||
ColumnDataTypeMap.map(ColumnDataType.Text));
|
ColumnDataTypeMap.map(ColumnDataType.Text));
|
||||||
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||||
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
||||||
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE,
|
if (defNewColumn.hasExpression()) {
|
||||||
TDTypeValueMap.map(ColumnDataType.Text,
|
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, expression);
|
||||||
defNewColumn.getDefaultValue()));
|
} else {
|
||||||
|
if (defNewColumn.getDefaultValue() != null
|
||||||
|
&& !defNewColumn.getDefaultValue().isEmpty()) {
|
||||||
|
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE,
|
||||||
|
TDTypeValueMap.map(ColumnDataType.Text,
|
||||||
|
defNewColumn.getDefaultValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
invocation = new OperationExecution(
|
invocation = new OperationExecution(
|
||||||
operationDefinition.getOperationId(), map);
|
operationDefinition.getOperationId(), map);
|
||||||
break;
|
break;
|
||||||
|
@ -123,9 +156,13 @@ public class OpExecution4AddColumn extends OpExecutionBuilder {
|
||||||
ColumnDataTypeMap.map(ColumnDataType.Text));
|
ColumnDataTypeMap.map(ColumnDataType.Text));
|
||||||
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||||
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
||||||
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE,
|
if (defNewColumn.hasExpression()) {
|
||||||
TDTypeValueMap.map(ColumnDataType.Text,
|
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, expression);
|
||||||
defNewColumn.getDefaultValue()));
|
} else {
|
||||||
|
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE,
|
||||||
|
TDTypeValueMap.map(ColumnDataType.Text,
|
||||||
|
defNewColumn.getDefaultValue()));
|
||||||
|
}
|
||||||
invocation = new OperationExecution(
|
invocation = new OperationExecution(
|
||||||
operationDefinition.getOperationId(), map);
|
operationDefinition.getOperationId(), map);
|
||||||
break;
|
break;
|
||||||
|
@ -139,9 +176,18 @@ public class OpExecution4AddColumn extends OpExecutionBuilder {
|
||||||
ColumnDataTypeMap.map(defNewColumn.getColumnDataType()));
|
ColumnDataTypeMap.map(defNewColumn.getColumnDataType()));
|
||||||
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||||
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
||||||
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, TDTypeValueMap.map(
|
if (defNewColumn.hasExpression()) {
|
||||||
defNewColumn.getColumnDataType(),
|
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, expression);
|
||||||
defNewColumn.getDefaultValue()));
|
|
||||||
|
} else {
|
||||||
|
if (defNewColumn.getDefaultValue() != null
|
||||||
|
&& !defNewColumn.getDefaultValue().isEmpty()) {
|
||||||
|
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE,
|
||||||
|
TDTypeValueMap.map(
|
||||||
|
defNewColumn.getColumnDataType(),
|
||||||
|
defNewColumn.getDefaultValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
invocation = new OperationExecution(
|
invocation = new OperationExecution(
|
||||||
operationDefinition.getOperationId(), map);
|
operationDefinition.getOperationId(), map);
|
||||||
break;
|
break;
|
||||||
|
@ -152,7 +198,6 @@ public class OpExecution4AddColumn extends OpExecutionBuilder {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
operationExecutionSpec.setOp(invocation);
|
operationExecutionSpec.setOp(invocation);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,7 +298,7 @@ public class ColumnMockUp implements Serializable {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHasExpression() {
|
public boolean hasExpression() {
|
||||||
return hasExpression;
|
return hasExpression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,38 +16,48 @@ public class AddColumnSession implements Serializable {
|
||||||
private static final long serialVersionUID = -1896235499708614266L;
|
private static final long serialVersionUID = -1896235499708614266L;
|
||||||
|
|
||||||
private TRId trId;
|
private TRId trId;
|
||||||
private ColumnMockUp column;
|
private ColumnMockUp columnMockUp;
|
||||||
|
|
||||||
|
|
||||||
public AddColumnSession(){
|
public AddColumnSession(){
|
||||||
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AddColumnSession(TRId trId,ColumnMockUp column){
|
|
||||||
this.trId=trId;
|
public AddColumnSession(TRId trId, ColumnMockUp columnMockUp) {
|
||||||
this.column=column;
|
super();
|
||||||
|
this.trId = trId;
|
||||||
|
this.columnMockUp = columnMockUp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public TRId getTrId() {
|
public TRId getTrId() {
|
||||||
return trId;
|
return trId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setTrId(TRId trId) {
|
public void setTrId(TRId trId) {
|
||||||
this.trId = trId;
|
this.trId = trId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ColumnMockUp getColumn() {
|
|
||||||
return column;
|
public ColumnMockUp getColumnMockUp() {
|
||||||
|
return columnMockUp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColumn(ColumnMockUp column) {
|
|
||||||
this.column = column;
|
public void setColumnMockUp(ColumnMockUp columnMockUp) {
|
||||||
|
this.columnMockUp = columnMockUp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "AddColumnSession [trId=" + trId + ", column=" + column + "]";
|
return "AddColumnSession [trId=" + trId + ", columnMockUp="
|
||||||
|
+ columnMockUp + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue