Updated Replace by Expression
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@99995 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
eb026f1a79
commit
88f9961bc5
|
@ -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.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.codelisthelper.CodelistMappingSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
||||
|
@ -77,10 +76,10 @@ 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;
|
||||
|
||||
|
@ -88,7 +87,7 @@ public class SessionUtil {
|
|||
session = SessionManager.getInstance().getASLSession(
|
||||
httpSession.getId(), username);
|
||||
session.setScope(scope);
|
||||
|
||||
*/
|
||||
} else {
|
||||
session = SessionManager.getInstance().getASLSession(
|
||||
httpSession.getId(), username);
|
||||
|
|
|
@ -3919,15 +3919,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
/**
|
||||
* Start Replace Column by Expression
|
||||
*
|
||||
*
|
||||
* @param replaceColumnByExpressionSession
|
||||
* @param expression
|
||||
* @param conditionExpression
|
||||
* @param replaceExpression
|
||||
* @param session
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
public String startReplaceColumnByExpression(ReplaceColumnByExpressionSession replaceColumnByExpressionSession,
|
||||
Expression expression, HttpSession session)
|
||||
Expression conditionExpression, Expression replaceExpression,HttpSession session)
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
// HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
|
@ -3947,7 +3948,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
.getTrId());
|
||||
|
||||
OpExecution4ReplaceColumnByExpression opEx = new OpExecution4ReplaceColumnByExpression(
|
||||
service, replaceColumnByExpressionSession, expression);
|
||||
service, replaceColumnByExpressionSession, conditionExpression,replaceExpression);
|
||||
OpExecutionDirector director = new OpExecutionDirector();
|
||||
director.setOperationExecutionBuilder(opEx);
|
||||
director.constructOperationExecution();
|
||||
|
|
|
@ -29,14 +29,16 @@ public class OpExecution4ReplaceColumnByExpression extends OpExecutionBuilder {
|
|||
|
||||
private TabularDataService service;
|
||||
private ReplaceColumnByExpressionSession replaceColumnByExpressionSession;
|
||||
private Expression expression;
|
||||
private Expression conditionExpression;
|
||||
private Expression replaceExpression;
|
||||
|
||||
public OpExecution4ReplaceColumnByExpression(TabularDataService service,
|
||||
ReplaceColumnByExpressionSession replaceColumnByExpressionSession,
|
||||
Expression expression) {
|
||||
Expression conditionExpression, Expression replaceExpression) {
|
||||
this.service = service;
|
||||
this.replaceColumnByExpressionSession = replaceColumnByExpressionSession;
|
||||
this.expression=expression;
|
||||
this.conditionExpression = conditionExpression;
|
||||
this.replaceExpression = replaceExpression;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -53,14 +55,20 @@ public class OpExecution4ReplaceColumnByExpression extends OpExecutionBuilder {
|
|||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.ReplaceColumnByExpression.toString(), service);
|
||||
|
||||
|
||||
Expression value = ExpressionGenerator
|
||||
.genReplaceValueParameterValue(replaceColumnByExpressionSession);
|
||||
|
||||
map.put(Constants.PARAMETER_REPLACE_BY_EXPRESSION_COLUMN_CONDITION,
|
||||
expression);
|
||||
map.put(Constants.PARAMETER_REPLACE_BY_EXPRESSION_COLUMN_VALUE, value);
|
||||
if (replaceColumnByExpressionSession.isReplaceByValue()) {
|
||||
Expression value = ExpressionGenerator
|
||||
.genReplaceValueParameterValue(replaceColumnByExpressionSession);
|
||||
|
||||
map.put(Constants.PARAMETER_REPLACE_BY_EXPRESSION_COLUMN_CONDITION,
|
||||
conditionExpression);
|
||||
map.put(Constants.PARAMETER_REPLACE_BY_EXPRESSION_COLUMN_VALUE,
|
||||
value);
|
||||
} else {
|
||||
map.put(Constants.PARAMETER_REPLACE_BY_EXPRESSION_COLUMN_CONDITION,
|
||||
conditionExpression);
|
||||
map.put(Constants.PARAMETER_REPLACE_BY_EXPRESSION_COLUMN_VALUE,
|
||||
replaceExpression);
|
||||
}
|
||||
invocation = new OperationExecution(replaceColumnByExpressionSession
|
||||
.getColumn().getColumnId(),
|
||||
operationDefinition.getOperationId(), map);
|
||||
|
|
|
@ -18,7 +18,7 @@ public class ReplaceColumnByExpressionSession implements Serializable{
|
|||
protected C_Expression cConditionExpression;
|
||||
protected C_Expression cReplaceExpression;
|
||||
protected String replaceValue;
|
||||
protected boolean useExpression;
|
||||
protected boolean replaceByValue;
|
||||
|
||||
public ReplaceColumnByExpressionSession(){
|
||||
|
||||
|
@ -29,7 +29,7 @@ public class ReplaceColumnByExpressionSession implements Serializable{
|
|||
this.column=column;
|
||||
this.cConditionExpression=cConditionExpression;
|
||||
this.replaceValue=replaceValue;
|
||||
this.useExpression=false;
|
||||
this.replaceByValue=true;
|
||||
}
|
||||
|
||||
public ReplaceColumnByExpressionSession(ColumnData column, C_Expression cConditionExpression,
|
||||
|
@ -37,7 +37,7 @@ public class ReplaceColumnByExpressionSession implements Serializable{
|
|||
this.column=column;
|
||||
this.cConditionExpression=cConditionExpression;
|
||||
this.cReplaceExpression=cReplaceExpression;
|
||||
this.useExpression=false;
|
||||
this.replaceByValue=false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,12 +74,12 @@ public class ReplaceColumnByExpressionSession implements Serializable{
|
|||
this.replaceValue = replaceValue;
|
||||
}
|
||||
|
||||
public boolean isUseExpression() {
|
||||
return useExpression;
|
||||
public boolean isReplaceByValue() {
|
||||
return replaceByValue;
|
||||
}
|
||||
|
||||
public void setUseExpression(boolean useExpression) {
|
||||
this.useExpression = useExpression;
|
||||
public void setReplaceByValue(boolean replaceByValue) {
|
||||
this.replaceByValue = replaceByValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -87,10 +87,12 @@ public class ReplaceColumnByExpressionSession implements Serializable{
|
|||
return "ReplaceColumnByExpressionSession [column=" + column
|
||||
+ ", cConditionExpression=" + cConditionExpression
|
||||
+ ", cReplaceExpression=" + cReplaceExpression
|
||||
+ ", replaceValue=" + replaceValue + ", useExpression="
|
||||
+ useExpression + "]";
|
||||
+ ", replaceValue=" + replaceValue + ", replaceByValue="
|
||||
+ replaceByValue + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue