diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/progress/ColumnFilterProgressBarUpdater.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/progress/ColumnFilterProgressBarUpdater.java
new file mode 100644
index 0000000..4591f81
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/progress/ColumnFilterProgressBarUpdater.java
@@ -0,0 +1,67 @@
+/**
+ *
+ */
+package org.gcube.portlets.user.td.expressionwidget.client.progress;
+
+
+
+
+import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.sencha.gxt.widget.core.client.ProgressBar;
+
+/**
+ *
+ * @author "Giancarlo Panichi"
+ * g.panichi@isti.cnr.it
+ *
+ */
+public class ColumnFilterProgressBarUpdater implements ColumnFilterProgressListener {
+
+ protected ProgressBar progressBar;
+
+ /**
+ * Creates a new {@link ProgressBar} updater.
+ * @param progressBar the {@link ProgressBar} to update.
+ */
+ public ColumnFilterProgressBarUpdater(ProgressBar progressBar) {
+ this.progressBar = progressBar;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void operationComplete(TRId trId) {
+ Log.info("Completed");
+ progressBar.updateProgress(1, "Completed");
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void operationFailed(Throwable caught, String reason, String failureDetails) {
+ Log.info("Failed");
+ progressBar.updateText("Failed");
+ }
+
+ public void operationInitializing() {
+ Log.info("Inizializing");
+ progressBar.updateProgress(0, "Initializing...");
+ }
+
+ public void operationUpdate(float elaborated) {
+ Log.info("Import elaborated: "+elaborated);
+ if (elaborated == 0) progressBar.updateProgress(0, "Initializing...");
+ if (elaborated>0 && elaborated<1) {
+ Log.trace("progress "+elaborated);
+ int elab=new Float(elaborated*100).intValue();
+ progressBar.updateProgress(elaborated,elab+"% Progress...");
+ }
+ if (elaborated == 1) progressBar.updateProgress(1, "Completing...");
+
+ }
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/progress/ColumnFilterProgressDialog.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/progress/ColumnFilterProgressDialog.java
new file mode 100644
index 0000000..004eb93
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/progress/ColumnFilterProgressDialog.java
@@ -0,0 +1,123 @@
+package org.gcube.portlets.user.td.expressionwidget.client.progress;
+
+import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
+import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType;
+import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.google.web.bindery.event.shared.EventBus;
+import com.sencha.gxt.core.client.util.Margins;
+import com.sencha.gxt.widget.core.client.FramedPanel;
+import com.sencha.gxt.widget.core.client.ProgressBar;
+import com.sencha.gxt.widget.core.client.Window;
+import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
+import com.sencha.gxt.widget.core.client.button.TextButton;
+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.HideEvent;
+import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
+import com.sencha.gxt.widget.core.client.event.SelectEvent;
+import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
+
+
+
+/**
+ * ColumnFilterProgressDialog is a Dialog that show progress of change the column label
+ *
+ * @author "Giancarlo Panichi"
+ * g.panichi@isti.cnr.it
+ *
+ */
+public class ColumnFilterProgressDialog extends Window implements ColumnFilterProgressListener {
+ public static final int STATUS_POLLING_DELAY = 1000;
+ protected String WIDTH = "400px";
+ protected String HEIGHT = "120px";
+ protected EventBus eventBus;
+ protected ColumnFilterProgressUpdater progressUpdater;
+ protected TextButton ok;
+ protected TRId trId;
+
+ public ColumnFilterProgressDialog(EventBus eventBus) {
+ this.eventBus=eventBus;
+ setWidth(WIDTH);
+ setHeight(HEIGHT);
+ setBodyBorder(false);
+ setResizable(true);
+ setModal(true);
+ setHeadingText("Change The Column Label Progress");
+
+ trId=null;
+
+ FramedPanel panel=new FramedPanel();
+ panel.setHeaderVisible(false);
+ panel.setBodyBorder(false);
+
+ VerticalLayoutContainer v = new VerticalLayoutContainer();
+
+
+ ProgressBar progressBar = new ProgressBar();
+
+ ok=new TextButton("OK");
+ ok.addSelectHandler(new SelectHandler() {
+
+ public void onSelect(SelectEvent event) {
+ updateInvocation();
+
+ }
+ });
+
+ v.add(progressBar, new VerticalLayoutData(1,
+ 1, new Margins(5, 5, 5, 5)));
+
+ panel.add(v);
+ panel.addButton(ok);
+ add(panel);
+
+
+ progressUpdater = new ColumnFilterProgressUpdater();
+ progressUpdater.addListener(new ColumnFilterProgressBarUpdater(progressBar));
+
+ progressUpdater.addListener(this);
+ progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY);
+ show();
+ ok.setVisible(false);
+
+ }
+
+ public void operationInitializing() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void operationUpdate(float elaborated) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void operationComplete(TRId trId) {
+ Log.debug("Operation Complete return: "+trId.toString());
+ ok.setVisible(true);
+ this.trId=trId;
+ }
+
+ public void operationFailed(Throwable caught, String reason,
+ String failureDetails) {
+ ok.setVisible(true);
+ this.trId=null;
+ AlertMessageBox d = new AlertMessageBox("Error Applying Column Filter", reason);
+ d.addHideHandler(new HideHandler() {
+ public void onHide(HideEvent event) {
+ }
+ });
+ d.show();
+ }
+
+ public void updateInvocation(){
+ if(trId!=null){
+ ChangeTableRequestEvent changeTableRequestEvent=
+ new ChangeTableRequestEvent(ChangeTableRequestType.COLUMNFILTER, trId);
+ eventBus.fireEvent(changeTableRequestEvent);
+ }
+ hide();
+ }
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/progress/ColumnFilterProgressListener.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/progress/ColumnFilterProgressListener.java
new file mode 100644
index 0000000..8957650
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/progress/ColumnFilterProgressListener.java
@@ -0,0 +1,42 @@
+/**
+ *
+ */
+package org.gcube.portlets.user.td.expressionwidget.client.progress;
+
+import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
+
+
+
+/**
+ * Defines a listener for operation progress.
+ *
+ * @author "Giancarlo Panichi"
+ * g.panichi@isti.cnr.it
+ *
+ */
+public interface ColumnFilterProgressListener {
+
+ /**
+ * Called when the operation is starting.
+ */
+ public void operationInitializing();
+
+ /**
+ * Called when there is a progress for the operation.
+ * @param elaborated the elaborated part.
+ */
+ public void operationUpdate(float elaborated);
+
+
+ /**
+ * Called when the operation is complete.
+ */
+ public void operationComplete(TRId trId);
+
+ /**
+ * Called when the operation is failed.
+ * @param caught the failure exception.
+ * @param reason the failure reason.
+ */
+ public void operationFailed(Throwable caught, String reason, String failureDetails);
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/progress/ColumnFilterProgressUpdater.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/progress/ColumnFilterProgressUpdater.java
new file mode 100644
index 0000000..4240f13
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/progress/ColumnFilterProgressUpdater.java
@@ -0,0 +1,160 @@
+/**
+ *
+ */
+package org.gcube.portlets.user.td.expressionwidget.client.progress;
+
+import java.util.ArrayList;
+
+import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync;
+import org.gcube.portlets.user.td.expressionwidget.shared.session.ColumnFilterMonitor;
+import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+
+/**
+ *
+ * @author "Giancarlo Panichi"
+ * g.panichi@isti.cnr.it
+ *
+ */
+public class ColumnFilterProgressUpdater extends Timer {
+
+ protected ArrayList listeners = new ArrayList();
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void run() {
+ Log.debug("requesting operation progress");
+ ExpressionServiceAsync.INSTANCE
+ .getColumnFilterMonitor(new AsyncCallback() {
+
+
+ public void onFailure(Throwable caught) {
+ cancel();
+ Log.error("Error retrieving the operation state",
+ caught);
+ String message = getStack(caught);
+ fireOperationFailed(caught,
+ "Failed getting operation updates", message);
+ }
+
+ public void onSuccess(ColumnFilterMonitor result) {
+ Log.info("retrieved ColumnFilterMonitor: "
+ + result.getStatus());
+ switch (result.getStatus()) {
+ case INITIALIZING:
+ Log.info("Column Filter Initializing...");
+ fireOperationInitializing();
+ break;
+ case ABORTED:
+ cancel();
+ Log.info("Column Filter Operation Aborted");
+ break;
+ case IN_PROGRESS:
+ fireOperationUpdate(result.getProgress());
+ break;
+ case VALIDATING_RULES:
+ fireOperationUpdate(result.getProgress());
+ break;
+ case STOPPED:
+ cancel();
+ errorMessage(result);
+ break;
+ case FAILED:
+ cancel();
+ errorMessage(result);
+ break;
+ case SUCCEDED:
+ cancel();
+ Log.info("Column Filter fisnish TableId :"
+ + result.getTrId());
+ fireOperationComplete(result.getTrId());
+ break;
+ default:
+ Log.info("Unknow State");
+ break;
+ }
+
+ }
+
+
+
+ });
+
+ }
+
+ protected void errorMessage(ColumnFilterMonitor result) {
+ Log.info("Apply column filter failed");
+ Throwable th = null;
+ String failure = null;
+ String details = null;
+ if (result.getError() != null) {
+ th = result.getError();
+ failure = "Failed Client Library applying column filter";
+ details = result.getError().getLocalizedMessage();
+ } else {
+ th = new Throwable("Failed");
+ failure = "Failed Client Library applying column filter";
+ details = "Apply column filter failed";
+ }
+
+
+ fireOperationFailed(th, failure, details);
+ }
+
+ protected String getStack(Throwable e) {
+ String message = e.getLocalizedMessage() + " ->
";
+ Throwable c = e.getCause();
+ if (c != null)
+ message += getStack(c);
+ return message;
+ }
+
+ protected void fireOperationInitializing() {
+ for (ColumnFilterProgressListener listener : listeners)
+ listener.operationInitializing();
+ }
+
+ protected void fireOperationUpdate(float elaborated) {
+ for (ColumnFilterProgressListener listener : listeners)
+ listener.operationUpdate(elaborated);
+ }
+
+ protected void fireOperationComplete(TRId trId) {
+ for (ColumnFilterProgressListener listener : listeners)
+ listener.operationComplete(trId);
+ }
+
+ protected void fireOperationFailed(Throwable caught, String failure,
+ String failureDetails) {
+ for (ColumnFilterProgressListener listener : listeners)
+ listener.operationFailed(caught, failure, failureDetails);
+ }
+
+ /**
+ * Add a new {@link ColumnFilterProgressListener} to this
+ * {@link ColumnFilterProgressUpdater}.
+ *
+ * @param listener
+ * the listener to add.
+ */
+ public void addListener(ColumnFilterProgressListener listener) {
+ listeners.add(listener);
+ }
+
+ /**
+ * Removes the specified {@link ColumnFilterProgressListener} from this
+ * {@link ColumnFilterProgressUpdater}.
+ *
+ * @param listener
+ * the listener to remove.
+ */
+ public void removeListener(ColumnFilterProgressListener listener) {
+ listeners.remove(listener);
+ }
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/rpc/ExpressionService.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/rpc/ExpressionService.java
index 2ee334d..b37d028 100644
--- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/rpc/ExpressionService.java
+++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/rpc/ExpressionService.java
@@ -6,8 +6,9 @@ package org.gcube.portlets.user.td.expressionwidget.client.rpc;
import org.gcube.portlets.user.td.expressionwidget.shared.expression.ExpressionServiceException;
-import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
-import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
+import org.gcube.portlets.user.td.expressionwidget.shared.session.ColumnFilterMonitor;
+import org.gcube.portlets.user.td.expressionwidget.shared.session.ColumnFilterSession;
+import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@@ -30,7 +31,23 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@RemoteServiceRelativePath("ExpressionService")
public interface ExpressionService extends RemoteService {
- public void submitColumnFilter(ColumnData column, C_Expression expression) throws ExpressionServiceException;
+ /**
+ * Submit Column Filter Operation
+ *
+ * @param columnFilterSession
+ * @throws ExpressionServiceException
+ */
+ public void submitColumnFilter(ColumnFilterSession columnFilterSession) throws ExpressionServiceException;
+
+ /**
+ * Get Operation Monitor during the applying Column Filter operation
+ *
+ *
+ * @return
+ * @throws ExpressionServiceException
+ */
+ public ColumnFilterMonitor getColumnFilterMonitor()
+ throws ExpressionServiceException;
diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/rpc/ExpressionServiceAsync.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/rpc/ExpressionServiceAsync.java
index 36b6df6..c693e85 100644
--- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/rpc/ExpressionServiceAsync.java
+++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/rpc/ExpressionServiceAsync.java
@@ -3,8 +3,8 @@
*/
package org.gcube.portlets.user.td.expressionwidget.client.rpc;
-import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
-import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
+import org.gcube.portlets.user.td.expressionwidget.shared.session.ColumnFilterMonitor;
+import org.gcube.portlets.user.td.expressionwidget.shared.session.ColumnFilterSession;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -21,6 +21,7 @@ public interface ExpressionServiceAsync {
public static ExpressionServiceAsync INSTANCE = (ExpressionServiceAsync) GWT
.create(ExpressionService.class);
- void submitColumnFilter(ColumnData column, C_Expression expression,AsyncCallback callback);
-
+ void submitColumnFilter(ColumnFilterSession columnFilterSession,AsyncCallback callback);
+ void getColumnFilterMonitor(AsyncCallback callback);
+
}
diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/server/ExpressionServiceImpl.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/server/ExpressionServiceImpl.java
index 6a2e61d..afffec2 100644
--- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/server/ExpressionServiceImpl.java
+++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/server/ExpressionServiceImpl.java
@@ -9,17 +9,23 @@ import javax.servlet.http.HttpSession;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationProvider;
import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationToken;
+import org.gcube.data.analysis.tabulardata.commons.webservice.types.TaskStatus;
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.model.table.Table;
import org.gcube.data.analysis.tabulardata.service.TabularDataService;
import org.gcube.data.analysis.tabulardata.service.impl.TabularDataServiceFactory;
+import org.gcube.data.analysis.tabulardata.service.operation.Task;
import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionService;
import org.gcube.portlets.user.td.expressionwidget.shared.expression.ExpressionServiceException;
+import org.gcube.portlets.user.td.expressionwidget.shared.session.ColumnFilterMonitor;
+import org.gcube.portlets.user.td.expressionwidget.shared.session.ColumnFilterSession;
import org.gcube.portlets.user.td.gwtservice.server.SessionUtil;
import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationDefinitionMap;
import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationsId;
-import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
-import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
+import org.gcube.portlets.user.td.gwtservice.server.trservice.TaskStateMap;
+import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
+import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -28,7 +34,9 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
public class ExpressionServiceImpl extends RemoteServiceServlet implements
ExpressionService {
- private static final long serialVersionUID = -5707400086333186368L;
+
+ private static final long serialVersionUID = 4632292751581364137L;
+
protected static Logger logger = LoggerFactory
.getLogger(ExpressionServiceImpl.class);
@@ -41,7 +49,7 @@ public class ExpressionServiceImpl extends RemoteServiceServlet implements
* {@inheritDoc}
*/
@Override
- public void submitColumnFilter(ColumnData column, C_Expression expression)
+ public void submitColumnFilter(ColumnFilterSession columnFilterSession)
throws ExpressionServiceException {
try {
@@ -78,7 +86,97 @@ public class ExpressionServiceImpl extends RemoteServiceServlet implements
}
}
-
+ /**
+ * {@inheritDoc}
+ */
+ public ColumnFilterMonitor getColumnFilterMonitor()
+ throws ExpressionServiceException {
+ try {
+ HttpSession session = this.getThreadLocalRequest().getSession();
+ ColumnFilterSession 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());
+ 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.setTableId(String
+ .valueOf(table.getId().getValue()));
+ trId.setTableType(table.getTableType().getName());
+ 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 ABORTED:
+ break;
+ case STOPPED:
+ columnFilterMonitor.setError(new Throwable(
+ "Operation Stopped on service"));
+ break;
+ case INITIALIZING:
+ break;
+ default:
+ break;
+ }
+ }
+ ExpressionSession.setColumnFilterTask(session, task);
+ }
+
+ logger.info("ColumnFilterMonitor(): " + columnFilterMonitor);
+ return columnFilterMonitor;
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new ExpressionServiceException("Error applying column filter: "
+ + e.getLocalizedMessage());
+
+ }
+
+ }
diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/server/ExpressionSession.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/server/ExpressionSession.java
new file mode 100644
index 0000000..b854060
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/server/ExpressionSession.java
@@ -0,0 +1,101 @@
+/**
+ *
+ */
+package org.gcube.portlets.user.td.expressionwidget.server;
+
+import javax.servlet.http.HttpSession;
+
+import org.gcube.data.analysis.tabulardata.service.operation.Task;
+import org.gcube.portlets.user.td.expressionwidget.shared.session.ColumnFilterMonitor;
+import org.gcube.portlets.user.td.expressionwidget.shared.session.ColumnFilterSession;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author "Giancarlo Panichi" g.panichi@isti.cnr.it
+ *
+ */
+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 COLUMN_FILTER_SESSION_MONITOR = "COLUMN_FILTER_SESSION_MONITOR";
+
+
+ protected static Logger logger = LoggerFactory.getLogger(ExpressionSession.class);
+
+
+ public static ColumnFilterSession getColumnFilterSession(
+ HttpSession httpSession) {
+ ColumnFilterSession columnFilterSession = (ColumnFilterSession) httpSession
+ .getAttribute(COLUMN_FILTER_SESSION);
+ if (columnFilterSession != null) {
+ return columnFilterSession;
+ } else {
+ columnFilterSession = new ColumnFilterSession();
+ httpSession.setAttribute(COLUMN_FILTER_SESSION,
+ columnFilterSession);
+ return columnFilterSession;
+ }
+ }
+
+ public static void setColumnFilterSession(HttpSession httpSession,
+ ColumnFilterSession columnFilterSession) {
+ ColumnFilterSession cf = (ColumnFilterSession) httpSession
+ .getAttribute(COLUMN_FILTER_SESSION);
+ if (cf != null) {
+ httpSession.removeAttribute(COLUMN_FILTER_SESSION);
+ }
+ httpSession.setAttribute(COLUMN_FILTER_SESSION,
+ columnFilterSession);
+
+ }
+
+ public static ColumnFilterMonitor getColumnFilterMonitor(
+ HttpSession httpSession) {
+ ColumnFilterMonitor columnFilterMonitor = (ColumnFilterMonitor) httpSession
+ .getAttribute(COLUMN_FILTER_SESSION_MONITOR);
+ if (columnFilterMonitor != null) {
+ return columnFilterMonitor;
+ } else {
+ columnFilterMonitor = new ColumnFilterMonitor();
+ httpSession.setAttribute(COLUMN_FILTER_SESSION_MONITOR,
+ columnFilterMonitor);
+ return columnFilterMonitor;
+ }
+ }
+
+ public static void setColumnFilterMonitor(HttpSession httpSession,
+ ColumnFilterMonitor columnFilterMonitor) {
+ ColumnFilterMonitor cf = (ColumnFilterMonitor) httpSession
+ .getAttribute(COLUMN_FILTER_SESSION_MONITOR);
+ if (cf != null) {
+ httpSession.removeAttribute(COLUMN_FILTER_SESSION_MONITOR);
+ }
+ httpSession.setAttribute(COLUMN_FILTER_SESSION_MONITOR,
+ columnFilterMonitor);
+
+ }
+
+ public static Task getColumnFilterTask(HttpSession httpSession) {
+ Task monitor = (Task) httpSession.getAttribute(COLUMN_FILTER_SESSION_TASK);
+ if (monitor == null) {
+ logger.error("CHANGE_THE_COLUMN_LABEL_TASK was not acquired");
+ }
+ return monitor;
+ }
+
+ public static void setColumnFilterTask(HttpSession httpSession,
+ Task task) {
+ Task monitor = (Task) httpSession.getAttribute(COLUMN_FILTER_SESSION_TASK);
+ if (monitor != null)
+ httpSession.removeAttribute(COLUMN_FILTER_SESSION_TASK);
+ httpSession.setAttribute(COLUMN_FILTER_SESSION_TASK, task);
+ }
+
+
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/session/ColumnFilterMonitor.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/session/ColumnFilterMonitor.java
new file mode 100644
index 0000000..6afdf35
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/session/ColumnFilterMonitor.java
@@ -0,0 +1,22 @@
+/**
+ *
+ */
+package org.gcube.portlets.user.td.expressionwidget.shared.session;
+
+import java.io.Serializable;
+
+import org.gcube.portlets.user.td.gwtservice.shared.OperationMonitor;
+
+/**
+ *
+ * @author "Giancarlo Panichi"
+ * g.panichi@isti.cnr.it
+ *
+ */
+public class ColumnFilterMonitor extends OperationMonitor implements Serializable {
+
+
+ private static final long serialVersionUID = 4722919347946633238L;
+
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/session/ColumnFilterSession.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/session/ColumnFilterSession.java
new file mode 100644
index 0000000..529b5d6
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/session/ColumnFilterSession.java
@@ -0,0 +1,33 @@
+package org.gcube.portlets.user.td.expressionwidget.shared.session;
+
+import java.io.Serializable;
+
+import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
+import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
+
+public class ColumnFilterSession implements Serializable{
+
+ private static final long serialVersionUID = -5362632291599472352L;
+ protected ColumnData column;
+ protected C_Expression cexpression;
+
+ public ColumnData getColumn() {
+ return column;
+ }
+ public void setColumn(ColumnData column) {
+ this.column = column;
+ }
+ public C_Expression getCexpression() {
+ return cexpression;
+ }
+ public void setCexpression(C_Expression cexpression) {
+ this.cexpression = cexpression;
+ }
+
+ @Override
+ public String toString() {
+ return "ColumnFilterSession [column=" + column + ", cexpression="
+ + cexpression + "]";
+ }
+
+}