Added Replace Column By Expression

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@99819 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-09-12 16:54:37 +00:00
parent aadcb19d38
commit c78f094b76
17 changed files with 538 additions and 122 deletions

View File

@ -1,5 +1,5 @@
eclipse.preferences.version=1
jarsExcludedFromWebInfLib=
lastWarOutDir=/home/giancarlo/workspace/tabular-data-expression-widget/target/tabular-data-expression-widget-1.0.0-SNAPSHOT
lastWarOutDir=/home/giancarlo/workspace/tabular-data-expression-widget/target/tabular-data-expression-widget-1.3.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -0,0 +1,2 @@
disabled=06target
eclipse.preferences.version=1

17
pom.xml
View File

@ -45,9 +45,9 @@
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.5.1</gwtVersion>
<KEYS>${env.KEYS}</KEYS>
<!-- GWT needs at least java 1.5 -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
@ -70,6 +70,17 @@
<version>1.0.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>home-library</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId>
<version>[1.0.2-SNAPSHOT,2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
</dependencies>
</profile>
</profiles>
@ -133,7 +144,7 @@
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<!-- tabular-data-monitor-widget -->
<dependency>
<groupId>org.gcube.portlets.user</groupId>

View File

@ -21,6 +21,8 @@ public class ExpressionWidgetEntry implements EntryPoint {
public void onModuleLoad() {
EventBus eventBus= new SimpleEventBus();
TRId trId=new TRId("154","1610");
String columnName="zwqvvx";
//Column Expression Dialog
//ColumnExpressionDialog expressionDialog=new ColumnExpressionDialog("1", ColumnTypeCode.ATTRIBUTE, ColumnDataType.Integer, eventBus);
@ -29,14 +31,16 @@ public class ExpressionWidgetEntry implements EntryPoint {
//Column Filter Dialog
//id=2, tableId=8, tableType=Generic
TRId trId=new TRId("2","8");
String columnName="twkvwc";
ColumnFilterDialog columnFilterDialog=new ColumnFilterDialog(trId, columnName, eventBus);
columnFilterDialog.show();
//ColumnFilterDialog columnFilterDialog=new ColumnFilterDialog(trId, columnName, eventBus);
//columnFilterDialog.show();
//Multi Column Filter Dialog
MultiColumnFilterDialog multiColumnFilterDialog= new MultiColumnFilterDialog(trId, eventBus);
multiColumnFilterDialog.show();
//MultiColumnFilterDialog multiColumnFilterDialog= new MultiColumnFilterDialog(trId, eventBus);
//multiColumnFilterDialog.show();
//Replace Column By Expression Dialog
ReplaceColumnByExpressionDialog replaceColumnByExpression= new ReplaceColumnByExpressionDialog(trId, columnName, eventBus);
replaceColumnByExpression.show();
Log.info("Hello!");
}

View File

@ -0,0 +1,247 @@
package org.gcube.portlets.user.td.expressionwidget.client;
import org.gcube.portlets.user.td.expressionwidget.client.resources.ExpressionResources;
import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync;
import org.gcube.portlets.user.td.expressionwidget.client.utils.UtilsGXT3;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.ReplaceColumnByExpressionSession;
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HTML;
import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.Window;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class ReplaceColumnByExpressionDialog extends Window implements MonitorDialogListener {
protected String WIDTH = "660px";
protected String HEIGHT = "400px";
protected ReplaceColumnByExpressionPanel replaceColumnByExpressionPanel;
protected C_Expression exp = null;
protected String replaceValue;
protected ColumnData column = null;
protected TRId trId;
protected String columnName = null;
protected EventBus eventBus;
private ReplaceColumnByExpressionSession replaceColumnByExpressionSession;
public ReplaceColumnByExpressionDialog(String columnId, ColumnTypeCode columnTypeCode,
ColumnDataType dataTypeName, EventBus eventBus) {
initWindow();
this.eventBus = eventBus;
column = new ColumnData();
column.setColumnId(columnId);
column.setDataTypeName(dataTypeName.toString());
column.setTypeCode(columnTypeCode.toString());
create();
}
public ReplaceColumnByExpressionDialog(TRId trId, String columnName, EventBus eventBus) {
initWindow();
this.eventBus = eventBus;
this.trId = trId;
this.columnName = columnName;
load(trId, columnName);
}
protected void initWindow() {
setWidth(WIDTH);
setHeight(HEIGHT);
setBodyBorder(false);
setResizable(false);
setHeadingText("Replace Column By Expression");
setClosable(true);
getHeader().setIcon(ExpressionResources.INSTANCE.columnReplaceByExpression());
}
/**
* {@inheritDoc}
*/
@Override
protected void initTools() {
super.initTools();
closeBtn.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
close();
}
});
}
protected void create() {
if (column.getTypeCode()
.compareTo(ColumnTypeCode.ANNOTATION.toString()) == 0
|| column.getTypeCode().compareTo(
ColumnTypeCode.ATTRIBUTE.toString()) == 0
|| column.getTypeCode().compareTo(
ColumnTypeCode.CODE.toString()) == 0
|| column.getTypeCode().compareTo(
ColumnTypeCode.CODEDESCRIPTION.toString()) == 0
|| column.getTypeCode().compareTo(
ColumnTypeCode.CODENAME.toString()) == 0
|| column.getTypeCode().compareTo(
ColumnTypeCode.MEASURE.toString()) == 0) {
replaceColumnByExpressionPanel = new ReplaceColumnByExpressionPanel(this, column,
eventBus);
add(replaceColumnByExpressionPanel);
} else {
HTML errorMessage = new HTML(
"This type of column is not supported for now!");
add(errorMessage);
UtilsGXT3.alert("Error",
"This type of column is not supported for now!");
}
}
public C_Expression getExpression() {
return exp;
}
protected void setExpression(C_Expression exp) {
Log.debug("New Expression set:" + exp.toString());
this.exp = exp;
}
protected void applyReplaceColumnByExpression(C_Expression exp, String replaceValue) {
this.exp = exp;
this.replaceValue=replaceValue;
callApplyReplaceByExpression();
}
protected void load(TRId trId, String columnName) {
TDGWTServiceAsync.INSTANCE.getColumn(trId, columnName,
new AsyncCallback<ColumnData>() {
public void onFailure(Throwable caught) {
Log.error("Error retrieving column: "
+ caught.getMessage());
UtilsGXT3.alert("Error retrieving column",
caught.getMessage());
}
public void onSuccess(ColumnData result) {
Log.debug("Retrived column: " + result);
if (result.isViewColumn()) {
UtilsGXT3
.info("View Column",
"You can not make expressions on view column for now");
hide();
} else {
column = result;
create();
}
}
});
}
protected void callApplyReplaceByExpression() {
replaceColumnByExpressionSession = new ReplaceColumnByExpressionSession(column, exp,replaceValue);
Log.debug(replaceColumnByExpressionSession.toString());
ExpressionServiceAsync.INSTANCE.startReplaceColumnByExpression(replaceColumnByExpressionSession,
new AsyncCallback<String>() {
@Override
public void onSuccess(String taskId) {
Log.debug("Submitted replace column by expression");
openMonitorDialog(taskId);
}
@Override
public void onFailure(Throwable caught) {
if (caught instanceof TDGWTSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
Log.error("Error submitting replace column by expression: "
+ caught.getLocalizedMessage());
caught.printStackTrace();
UtilsGXT3.alert(
"Error submitting replace column by expression",
caught.getLocalizedMessage());
}
}
});
}
protected void close() {
hide();
}
// /
protected void openMonitorDialog(String taskId) {
MonitorDialog monitorDialog = new MonitorDialog(taskId, eventBus);
monitorDialog.addProgressDialogListener(this);
monitorDialog.show();
}
@Override
public void operationComplete(TRId trId) {
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
ChangeTableRequestType.COLUMNFILTER, trId, why);
eventBus.fireEvent(changeTableRequestEvent);
close();
}
@Override
public void operationFailed(Throwable caught, String reason, String details) {
UtilsGXT3.alert(reason, details);
close();
}
@Override
public void operationStopped(TRId trId, String reason, String details) {
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
ChangeTableRequestType.COLUMNFILTER, trId, why);
eventBus.fireEvent(changeTableRequestEvent);
close();
}
@Override
public void operationAborted() {
close();
}
@Override
public void operationPutInBackground() {
close();
}
}

View File

@ -0,0 +1,174 @@
package org.gcube.portlets.user.td.expressionwidget.client;
import org.gcube.portlets.user.td.expressionwidget.client.resources.ExpressionResources;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
import com.allen_sauer.gwt.log.client.Log;
import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.FramedPanel;
import com.sencha.gxt.widget.core.client.button.TextButton;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
import com.sencha.gxt.widget.core.client.form.FieldLabel;
import com.sencha.gxt.widget.core.client.form.FieldSet;
import com.sencha.gxt.widget.core.client.form.TextField;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class ReplaceColumnByExpressionPanel extends FramedPanel {
protected static final String WIDTH = "648px";
protected static final String HEIGHT = "364px";
protected static final String CONDITIONWIDTH = "612px";
protected static final String CONDITIONHEIGHT = "150px";
protected EventBus eventBus;
protected ReplaceColumnByExpressionDialog parent;
protected ColumnData column;
private TextButton btnApply;
private TextButton btnClose;
private FieldSet conditionsFieldSet;
private ConditionWidget conditionWidget;
private TextField replaceValue;
public ReplaceColumnByExpressionPanel(
ReplaceColumnByExpressionDialog parent, ColumnData column,
EventBus eventBus) {
super();
this.parent = parent;
this.column = column;
this.eventBus = eventBus;
Log.debug(column.toString());
init();
create();
}
protected void init() {
setWidth(WIDTH);
setHeight(HEIGHT);
setBodyBorder(false);
setHeaderVisible(false);
// Important: fixed rendering of widgets
forceLayoutOnResize = true;
}
protected void create() {
VerticalLayoutContainer basicLayout = new VerticalLayoutContainer();
basicLayout.setAdjustForScroll(true);
basicLayout.setScrollMode(ScrollMode.AUTO);
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
flowButton.setPack(BoxLayoutPack.CENTER);
// Properties
FieldSet properties = new FieldSet();
properties.setHeadingText("Properties");
properties.setCollapsible(false);
VerticalLayoutContainer propertiesLayout = new VerticalLayoutContainer();
properties.add(propertiesLayout);
TextField columnName = new TextField();
columnName.setToolTip("Column");
columnName.setReadOnly(true);
columnName.setValue(column.getLabel());
propertiesLayout.add(new FieldLabel(columnName, "Column"),
new VerticalLayoutData(1, -1));
// Conditions
conditionsFieldSet = new FieldSet();
conditionsFieldSet.setHeadingText("Conditions");
conditionsFieldSet.setCollapsible(false);
conditionWidget = new ConditionWidget(column,CONDITIONWIDTH, CONDITIONHEIGHT);
Log.debug("ConditionWidget" + conditionWidget);
conditionsFieldSet.add(conditionWidget);
// Value
FieldSet replaceValueFieldSet = new FieldSet();
replaceValueFieldSet.setHeadingText("Replace Value");
replaceValueFieldSet.setCollapsible(false);
VerticalLayoutContainer replaceValueFieldSetLayout = new VerticalLayoutContainer();
replaceValueFieldSet.add(replaceValueFieldSetLayout);
replaceValue = new TextField();
replaceValue.setToolTip("Replace Value");
replaceValue.setValue("");
replaceValueFieldSetLayout.add(new FieldLabel(replaceValue,
"Replace Value"), new VerticalLayoutData(1, -1));
//
btnApply = new TextButton("Apply");
btnApply.setIcon(ExpressionResources.INSTANCE.columnReplaceByExpression());
btnApply.setIconAlign(IconAlign.RIGHT);
btnApply.setTitle("Apply replace by expression");
btnApply.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
Log.debug("Pressed Apply");
applyReplaceColumnByExpression();
}
});
btnClose = new TextButton("Close");
btnClose.setIcon(ExpressionResources.INSTANCE.close());
btnClose.setIconAlign(IconAlign.RIGHT);
btnClose.setTitle("Close");
btnClose.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
Log.debug("Pressed Close");
close();
}
});
flowButton.add(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4)));
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
//Add to basic layout
basicLayout.add(properties, new VerticalLayoutData(-1, -1, new Margins(
1)));
basicLayout.add(conditionsFieldSet, new VerticalLayoutData(-1, -1,
new Margins(1)));
basicLayout.add(replaceValueFieldSet, new VerticalLayoutData(-1, -1, new Margins(
1)));
basicLayout.add(flowButton, new VerticalLayoutData(-1, 36, new Margins(
5, 2, 5, 2)));
add(basicLayout);
}
protected void applyReplaceColumnByExpression() {
C_Expression exp = conditionWidget.getExpression();
String value = replaceValue.getCurrentValue();
parent.applyReplaceColumnByExpression(exp,value);
}
protected void close() {
parent.close();
}
}

View File

@ -44,6 +44,12 @@ public interface ExpressionResources extends ClientBundle {
@Source("column-filter-go.png")
ImageResource applyFilter();
@Source("column-replace-by-expression_32.png")
ImageResource columnReplaceByExpression32();
@Source("column-replace-by-expression.png")
ImageResource columnReplaceByExpression();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -7,6 +7,7 @@ package org.gcube.portlets.user.td.expressionwidget.client.rpc;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.FilterColumnSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.ReplaceColumnByExpressionSession;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@ -38,7 +39,9 @@ public interface ExpressionService extends RemoteService {
public String startFilterColumn(FilterColumnSession filterColumnSession) throws TDGWTServiceException;
public String startReplaceColumnByExpression(ReplaceColumnByExpressionSession replaceColumnByExpressionColumnSession) throws TDGWTServiceException;
}

View File

@ -4,6 +4,7 @@
package org.gcube.portlets.user.td.expressionwidget.client.rpc;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.FilterColumnSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.ReplaceColumnByExpressionSession;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
@ -22,5 +23,7 @@ public interface ExpressionServiceAsync {
void startFilterColumn(FilterColumnSession filterColumnSession,AsyncCallback<String> callback);
void startReplaceColumnByExpression(ReplaceColumnByExpressionSession replaceColumnByExpressionSession,AsyncCallback<String> callback);
}

View File

@ -21,6 +21,7 @@ import org.gcube.portlets.user.td.gwtservice.server.TDGWTServiceImpl;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.FilterColumnSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.ReplaceColumnByExpressionSession;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -79,113 +80,49 @@ public class ExpressionServiceImpl extends RemoteServiceServlet implements
+ e.getLocalizedMessage());
}
}
/**
*
* {@inheritDoc}
*/
@Override
public String startReplaceColumnByExpression(ReplaceColumnByExpressionSession replaceColumnByExpressionSession)
throws TDGWTServiceException {
try {
logger.debug("ExpressionService submitReplaceColumnByExpression");
HttpSession session = this.getThreadLocalRequest().getSession();
logger.debug("Session: "+session);
if(replaceColumnByExpressionSession==null){
logger.error("ReplaceColumnByExpressionSession is null");
new ExpressionServiceException("ReplaceColumnByExpressionSession is null");
}
ExpressionSession.setReplaceColumnByExpressionSession(session, replaceColumnByExpressionSession);
C_ExpressionParser parser=new C_ExpressionParser();
Expression expression=parser.parse(replaceColumnByExpressionSession.getCexpression());
logger.debug("Service Expression:"+expression);
TDGWTServiceImpl gwtService = new TDGWTServiceImpl();
String taskId= gwtService.startReplaceColumnByExpression(replaceColumnByExpressionSession, expression, session);
return taskId;
} catch (TDGWTSessionExpiredException e){
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException(
"Error in startReplaceColumnByExpression:"
+ e.getLocalizedMessage());
}
}
// /**
// * {@inheritDoc}
// */
// public ColumnFilterMonitor getColumnFilterMonitor()
// throws ExpressionServiceException {
// try {
// HttpSession session = this.getThreadLocalRequest().getSession();
// FilterColumnSession columnFilterSession = ExpressionSession
// .getColumnFilterSession(session);
//
// Task task = ExpressionSession.getColumnFilterTask(session);
// ColumnFilterMonitor columnFilterMonitor = new ColumnFilterMonitor();
//
// if (task == null) {
// logger.debug("Task null");
// throw new ExpressionServiceException(
// "Error in ColumnFilter task null");
// } else {
// TaskStatus status = task.getStatus();
// if (status == null) {
// logger.debug("Services TaskStatus : null");
// throw new ExpressionServiceException(
// "Error in ColumnFilter Status null");
// } else {
// logger.debug("Services TaskStatus: " + task.getStatus());
//
// columnFilterMonitor.setStatus(TaskStateMap.map(task
// .getStatus()));
// switch (columnFilterMonitor.getStatus()) {
// case FAILED:
// if (task.getResult() != null) {
// logger.debug("Task exception:"
// + task.getErrorCause());
// task.getErrorCause().printStackTrace();
// columnFilterMonitor.setError(new Throwable(task
// .getErrorCause()));
// } else {
// logger.debug("Task exception: Error In Column Filter");
// columnFilterMonitor.setError(new Throwable(
// "Error In Column Filter"));
// }
// columnFilterMonitor.setProgress(task.getProgress());
// break;
// case SUCCEDED:
// logger.debug("Task Result:" + task.getResult());
// columnFilterMonitor.setProgress(task.getProgress());
// Table table = task.getResult().getPrimaryTable();
// logger.debug("Table retrived: " + table.toString());
// TRId trId = new TRId();
// trId.setId(columnFilterSession.getColumn().getTrId()
// .getId());
//
// trId = retrieveTabularResourceBasicData(trId);
//
// columnFilterMonitor.setTrId(trId);
// TabResource tabResource = SessionUtil
// .getTabResource(session);
// tabResource.setTrId(trId);
// SessionUtil.setTabResource(session, tabResource);
// SessionUtil.setTRId(session, trId);
// break;
// case IN_PROGRESS:
// columnFilterMonitor.setProgress(task.getProgress());
// break;
// case VALIDATING_RULES:
// columnFilterMonitor.setProgress(task.getProgress());
// break;
// case GENERATING_VIEW:
// break;
// case ABORTED:
// break;
// case STOPPED:
// logger.debug("Task Result:" + task.getResult());
// columnFilterMonitor.setProgress(task.getProgress());
// trId = new TRId();
// trId.setId(columnFilterSession.getColumn().getTrId()
// .getId());
// trId = retrieveTabularResourceBasicData(trId);
//
// columnFilterMonitor.setTrId(trId);
// tabResource = SessionUtil.getTabResource(session);
// tabResource.setTrId(trId);
// SessionUtil.setTabResource(session, tabResource);
// SessionUtil.setTRId(session, trId);
// break;
// case INITIALIZING:
// break;
// default:
// break;
// }
// }
// ExpressionSession.setColumnFilterTask(session, task);
// }
//
// logger.info("ColumnFilterMonitor(): " + columnFilterMonitor);
// return columnFilterMonitor;
// } catch (TDGWTSessionExpiredException e){
// throw new ExpressionServiceException(e.getLocalizedMessage());
// } catch (Throwable e) {
// e.printStackTrace();
// throw new ExpressionServiceException(
// "Error applying column filter: " + e.getLocalizedMessage());
//
// }
//
// }
/**

View File

@ -7,6 +7,7 @@ import javax.servlet.http.HttpSession;
import org.gcube.data.analysis.tabulardata.service.operation.Task;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.FilterColumnSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.ReplaceColumnByExpressionSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -22,6 +23,7 @@ public class ExpressionSession {
protected static final String COLUMN_FILTER_SESSION = "COLUMN_FILTER_SESSION";
protected static final String COLUMN_FILTER_SESSION_TASK = "COLUMN_FILTER_SESSION_TASK";
protected static final String REPLACE_COLUMN_BY_EXPRESSION_SESSION = "REPLACE_COLUMN_BY_EXPRESSION_SESSION";
protected static Logger logger = LoggerFactory.getLogger(ExpressionSession.class);
@ -51,6 +53,33 @@ public class ExpressionSession {
columnFilterSession);
}
public static ReplaceColumnByExpressionSession getReplaceColumnByExpressionSession(
HttpSession httpSession) {
ReplaceColumnByExpressionSession replaceColumnByExpressionSession = (ReplaceColumnByExpressionSession) httpSession
.getAttribute(REPLACE_COLUMN_BY_EXPRESSION_SESSION);
if (replaceColumnByExpressionSession != null) {
return replaceColumnByExpressionSession;
} else {
replaceColumnByExpressionSession = new ReplaceColumnByExpressionSession();
httpSession.setAttribute(REPLACE_COLUMN_BY_EXPRESSION_SESSION,
replaceColumnByExpressionSession);
return replaceColumnByExpressionSession;
}
}
public static void setReplaceColumnByExpressionSession(HttpSession httpSession,
ReplaceColumnByExpressionSession replaceColumnByExpressionSession) {
ReplaceColumnByExpressionSession rce = (ReplaceColumnByExpressionSession) httpSession
.getAttribute(REPLACE_COLUMN_BY_EXPRESSION_SESSION);
if (rce != null) {
httpSession.removeAttribute(REPLACE_COLUMN_BY_EXPRESSION_SESSION);
}
httpSession.setAttribute(REPLACE_COLUMN_BY_EXPRESSION_SESSION,
replaceColumnByExpressionSession);
}

View File

@ -8,10 +8,10 @@ package org.gcube.portlets.user.td.expressionwidget.shared;
*/
public class Constants {
public final static String VERSION = "1.0.0";
public final static String DEFAULT_USER = "giancarlo.panichi";
public final static String DEFAULT_SCOPE = "/gcube/devsec";
public final static String VERSION = "2.4.0";
public final static String DEFAULT_USER = "test.user";
public final static String DEFAULT_SCOPE = "/gcube/devsec/devVRE";
public static final String PARAMETER_ENCODING = "encoding";
public static final String PARAMETER_HASHEADER = "hasHeader";
public static final String PARAMETER_SEPARATOR = "separator";

View File

@ -23,7 +23,7 @@
<!-- Specify the app entry point class. -->
<!-- <entry-point class='org.gcube.portlets.user.td.expressionwidget.client.ExpressionWidgetEntry' /> -->
<!-- <entry-point class='org.gcube.portlets.user.td.expressionwidget.client.ExpressionWidgetEntry' /> -->
<!-- Specify the paths for translatable code -->
<source path='client' />