diff --git a/.gwt/.gwt-log b/.gwt/.gwt-log index 7471344..b9ca0ac 100644 --- a/.gwt/.gwt-log +++ b/.gwt/.gwt-log @@ -446,3 +446,35 @@ Compiling... Compilation completed in 0.00 seconds Removing invalidated units Finding entry point classes +Public resources found in... +Translatable source found in... +Found 0 cached/archived units. Used 0 / 2719 units from cache. +Compiling... + 40% complete (ETR: 5 seconds) + 40% complete (ETR: 5 seconds) + 40% complete (ETR: 5 seconds) + 40% complete (ETR: 5 seconds) + 40% complete (ETR: 5 seconds) + 50% complete (ETR: 5 seconds) + 60% complete (ETR: 4 seconds) + 70% complete (ETR: 3 seconds) + 80% complete (ETR: 2 seconds) + 90% complete (ETR: 1 seconds) + 100% complete (ETR: 0 seconds) + Compilation completed in 10.04 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes diff --git a/pom.xml b/pom.xml index a8e8b35..1f1b435 100644 --- a/pom.xml +++ b/pom.xml @@ -133,6 +133,14 @@ [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT) provided + + + + org.gcube.portlets.user + tabular-data-monitor-widget + [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT) + provided + diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/ExpressionWidget.gwt.xml b/src/main/java/org/gcube/portlets/user/td/expressionwidget/ExpressionWidget.gwt.xml index 6e59e72..12def5f 100644 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/ExpressionWidget.gwt.xml +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/ExpressionWidget.gwt.xml @@ -19,7 +19,7 @@ - + diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ColumnFilterDialog.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ColumnFilterDialog.java index 1ca1f7e..2f7622e 100644 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ColumnFilterDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ColumnFilterDialog.java @@ -1,12 +1,16 @@ package org.gcube.portlets.user.td.expressionwidget.client; -import org.gcube.portlets.user.td.expressionwidget.client.progress.ColumnFilterProgressDialog; 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.expressionwidget.shared.session.ColumnFilterSession; +import org.gcube.portlets.user.td.expressionwidget.shared.session.FilterColumnSession; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; +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.type.ChangeTableRequestType; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy; 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; @@ -26,7 +30,7 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; * href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it * */ -public class ColumnFilterDialog extends Window { +public class ColumnFilterDialog extends Window implements MonitorDialogListener { protected String WIDTH = "660px"; protected String HEIGHT = "400px"; protected ColumnExpressionPanel columnExpressionPanel; @@ -35,8 +39,7 @@ public class ColumnFilterDialog extends Window { protected TRId trId; protected String columnName = null; protected EventBus eventBus; - private ColumnFilterSession columnFilterSession; - private ColumnFilterProgressDialog dialog; + private FilterColumnSession columnFilterSession; public ColumnFilterDialog(String columnId, ColumnTypeCode columnTypeCode, ColumnDataType dataTypeName, EventBus eventBus) { @@ -126,10 +129,6 @@ public class ColumnFilterDialog extends Window { callApplyFilter(); } - protected void close() { - hide(); - } - protected void load(TRId trId, String columnName) { TDGWTServiceAsync.INSTANCE.getColumn(trId, columnName, new AsyncCallback() { @@ -144,8 +143,9 @@ public class ColumnFilterDialog extends Window { 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"); + UtilsGXT3 + .info("View Column", + "You can not make expressions on view column for now"); hide(); } else { column = result; @@ -158,16 +158,17 @@ public class ColumnFilterDialog extends Window { } protected void callApplyFilter() { - columnFilterSession = new ColumnFilterSession(column, exp); + columnFilterSession = new FilterColumnSession(column, exp); Log.debug(columnFilterSession.toString()); - ExpressionServiceAsync.INSTANCE.submitColumnFilter(columnFilterSession, - new AsyncCallback() { + ExpressionServiceAsync.INSTANCE.startColumnFilter(columnFilterSession, + new AsyncCallback() { @Override - public void onSuccess(Void result) { + public void onSuccess(String taskId) { Log.debug("Submitted column filter"); - callColumnFilterProgressDialog(); + openMonitorDialog(taskId); + } @Override @@ -183,9 +184,53 @@ public class ColumnFilterDialog extends Window { } - protected void callColumnFilterProgressDialog() { - dialog = new ColumnFilterProgressDialog(this, eventBus); - dialog.show(); + 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(); + } } 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 deleted file mode 100644 index 63dfe78..0000000 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/progress/ColumnFilterProgressBarUpdater.java +++ /dev/null @@ -1,94 +0,0 @@ -/** - * - */ -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; - this.progressBar.updateProgress(0, "Please Wait..."); - } - - - /** - * {@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..."); - } - - @Override - public void operationUpdate(float elaborated) { - Log.info("Elaborated: "+elaborated); - 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..."); - - } - - @Override - public void operationValidate(float elaborated) { - Log.info("Validation Elaborated: "+elaborated); - if (elaborated == 0) progressBar.updateProgress(0, "Start Validation..."); - if (elaborated>0 && elaborated<1) { - Log.trace("Validation progress "+elaborated); - int elab=new Float(elaborated*100).intValue(); - progressBar.updateProgress(elaborated,elab+"% Validation Progress..."); - } - if (elaborated == 1) progressBar.updateProgress(1, "Validation..."); - } - - @Override - public void operationStopped(TRId trId,String reason, String details) { - Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]"); - progressBar.updateText("Validations failed"); - - } - - @Override - public void operationGeneratingView() { - Log.info("Generating View..."); - progressBar.updateText("Generating View..."); - - } - -} 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 deleted file mode 100644 index 80d3480..0000000 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/progress/ColumnFilterProgressDialog.java +++ /dev/null @@ -1,152 +0,0 @@ -package org.gcube.portlets.user.td.expressionwidget.client.progress; - -import org.gcube.portlets.user.td.expressionwidget.client.ColumnFilterDialog; -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.client.type.ChangeTableWhy; -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 = "140px"; - protected EventBus eventBus; - protected ColumnFilterProgressUpdater progressUpdater; - protected TextButton ok; - protected TRId trId; - protected ColumnFilterDialog dialog; - private ChangeTableWhy why; - - public ColumnFilterProgressDialog(ColumnFilterDialog dialog,EventBus eventBus) { - this.dialog=dialog; - this.eventBus=eventBus; - setWidth(WIDTH); - setHeight(HEIGHT); - setBodyBorder(false); - setResizable(true); - setModal(true); - setHeadingText("Column Filter 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()); - this.trId=trId; - why=ChangeTableWhy.TABLEUPDATED; - updateInvocation(); - } - - 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,why); - eventBus.fireEvent(changeTableRequestEvent); - } - dialog.hide(); - hide(); - } - - @Override - public void operationStopped(TRId trId,String reason, String details) { - Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]"); - ok.setVisible(true); - this.trId=trId; - why=ChangeTableWhy.TABLECURATION; - } - - @Override - public void operationGeneratingView() { - // TODO Auto-generated method stub - - } - - @Override - public void operationValidate(float elaborated) { - // TODO Auto-generated method stub - - } -} 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 deleted file mode 100644 index 34b3051..0000000 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/progress/ColumnFilterProgressListener.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * - */ -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 there is a validate for the operation. - * @param elaborated the elaborated part. - */ - public void operationValidate(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); - - /** - * Called when the operation is stopped - * - * @param trId - * @param reason - * @param details - */ - public void operationStopped(TRId trId, String reason, String details); - - /** - * Called when the operation is generating the view - */ - public void operationGeneratingView(); - -} 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 deleted file mode 100644 index d2c47f6..0000000 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/progress/ColumnFilterProgressUpdater.java +++ /dev/null @@ -1,197 +0,0 @@ -/** - * - */ -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: - fireOperationValidate(result.getProgress()); - break; - case GENERATING_VIEW: - Log.info("Generating View..."); - fireOperationGeneratingView(); - break; - case STOPPED: - cancel(); - stopMessage(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 void stopMessage(ColumnFilterMonitor result) { - Log.info("Apply column filter Stopped"); - String failure = null; - String details = null; - if (result.getError() != null) { - failure = "Stopped"; - details = result.getError().getLocalizedMessage(); - } else { - failure = "Stopped"; - details = "Stopped applying the column filter "; - } - - fireOperationStopped(result.getTrId(),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 fireOperationGeneratingView() { - for (ColumnFilterProgressListener listener : listeners) - listener.operationGeneratingView(); - } - - protected void fireOperationUpdate(float elaborated) { - for (ColumnFilterProgressListener listener : listeners) - listener.operationUpdate(elaborated); - } - - protected void fireOperationValidate(float elaborated) { - for (ColumnFilterProgressListener listener : listeners) - listener.operationValidate(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); - } - - protected void fireOperationStopped(TRId trId, String reason, String details) { - for (ColumnFilterProgressListener listener : listeners) - listener.operationStopped(trId,reason, details); - } - /** - * 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 cd2fcc9..1adca86 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,9 +6,7 @@ package org.gcube.portlets.user.td.expressionwidget.client.rpc; import org.gcube.portlets.user.td.expressionwidget.shared.exception.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.shared.exception.TDGWTServiceException; +import org.gcube.portlets.user.td.expressionwidget.shared.session.FilterColumnSession; import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; @@ -37,17 +35,9 @@ public interface ExpressionService extends RemoteService { * @param columnFilterSession * @throws ExpressionServiceException */ - public void submitColumnFilter(ColumnFilterSession columnFilterSession) throws ExpressionServiceException; + public String startColumnFilter(FilterColumnSession 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 c693e85..4ecf351 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,7 @@ */ package org.gcube.portlets.user.td.expressionwidget.client.rpc; -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.expressionwidget.shared.session.FilterColumnSession; import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.AsyncCallback; @@ -21,7 +20,7 @@ public interface ExpressionServiceAsync { public static ExpressionServiceAsync INSTANCE = (ExpressionServiceAsync) GWT .create(ExpressionService.class); - void submitColumnFilter(ColumnFilterSession columnFilterSession,AsyncCallback callback); - void getColumnFilterMonitor(AsyncCallback callback); + void startColumnFilter(FilterColumnSession columnFilterSession,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 3192c69..957fef8 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,7 +9,6 @@ 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.expression.Expression; @@ -22,16 +21,13 @@ import org.gcube.data.analysis.tabulardata.service.tabular.TabularResource; import org.gcube.data.analysis.tabulardata.service.tabular.TabularResourceId; import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionService; import org.gcube.portlets.user.td.expressionwidget.shared.exception.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.expressionwidget.shared.session.FilterColumnSession; 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.TaskStateMap; import org.gcube.portlets.user.td.gwtservice.shared.Constants; import org.gcube.portlets.user.td.gwtservice.shared.OperationsId; 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.TabResource; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -50,7 +46,7 @@ public class ExpressionServiceImpl extends RemoteServiceServlet implements "yyyy/MM/dd HH:mm"); protected OperationExecution retrieveOperationExecution( - TabularDataService service, ColumnFilterSession columnFilterSession) + TabularDataService service, FilterColumnSession columnFilterSession) throws TDGWTServiceException { OperationExecution invocation = null; @@ -77,11 +73,11 @@ public class ExpressionServiceImpl extends RemoteServiceServlet implements * {@inheritDoc} */ @Override - public void submitColumnFilter(ColumnFilterSession columnFilterSession) + public String startColumnFilter(FilterColumnSession columnFilterSession) throws ExpressionServiceException { try { - logger.debug("ExprssionService submitColumnFilter"); + logger.debug("ExpressionService submitColumnFilter"); HttpSession session = this.getThreadLocalRequest().getSession(); logger.debug("Session: "+session); ASLSession aslSession = SessionUtil.getAslSession(session); @@ -100,7 +96,7 @@ public class ExpressionServiceImpl extends RemoteServiceServlet implements Task trTask = service.execute(invocation,id); logger.debug("Start Task on service: TaskId " + trTask.getId()); ExpressionSession.setColumnFilterTask(session, trTask); - return; + return null; } catch (TDGWTSessionExpiredException e){ throw new ExpressionServiceException(e.getLocalizedMessage()); } catch (Throwable e) { @@ -111,112 +107,112 @@ 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()); - 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()); - - } - - } +// /** +// * {@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()); +// +// } +// +// } /** 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 index b854060..be164d1 100644 --- 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 @@ -7,7 +7,7 @@ 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.gcube.portlets.user.td.expressionwidget.shared.session.FilterColumnSession; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,14 +28,14 @@ public class ExpressionSession { protected static Logger logger = LoggerFactory.getLogger(ExpressionSession.class); - public static ColumnFilterSession getColumnFilterSession( + public static FilterColumnSession getColumnFilterSession( HttpSession httpSession) { - ColumnFilterSession columnFilterSession = (ColumnFilterSession) httpSession + FilterColumnSession columnFilterSession = (FilterColumnSession) httpSession .getAttribute(COLUMN_FILTER_SESSION); if (columnFilterSession != null) { return columnFilterSession; } else { - columnFilterSession = new ColumnFilterSession(); + columnFilterSession = new FilterColumnSession(); httpSession.setAttribute(COLUMN_FILTER_SESSION, columnFilterSession); return columnFilterSession; @@ -43,8 +43,8 @@ public class ExpressionSession { } public static void setColumnFilterSession(HttpSession httpSession, - ColumnFilterSession columnFilterSession) { - ColumnFilterSession cf = (ColumnFilterSession) httpSession + FilterColumnSession columnFilterSession) { + FilterColumnSession cf = (FilterColumnSession) httpSession .getAttribute(COLUMN_FILTER_SESSION); if (cf != null) { httpSession.removeAttribute(COLUMN_FILTER_SESSION); 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/FilterColumnSession.java similarity index 85% rename from src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/session/ColumnFilterSession.java rename to src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/session/FilterColumnSession.java index b8aa578..42f0903 100644 --- 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/FilterColumnSession.java @@ -5,17 +5,17 @@ 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{ +public class FilterColumnSession implements Serializable{ private static final long serialVersionUID = -5362632291599472352L; protected ColumnData column; protected C_Expression cexpression; - public ColumnFilterSession(){ + public FilterColumnSession(){ } - public ColumnFilterSession(ColumnData column, C_Expression cexpression){ + public FilterColumnSession(ColumnData column, C_Expression cexpression){ this.column=column; this.cexpression=cexpression; } diff --git a/src/main/resources/org/gcube/portlets/user/td/expressionwidget/ExpressionWidget.gwt.xml b/src/main/resources/org/gcube/portlets/user/td/expressionwidget/ExpressionWidget.gwt.xml index 479f5ec..c3fd016 100644 --- a/src/main/resources/org/gcube/portlets/user/td/expressionwidget/ExpressionWidget.gwt.xml +++ b/src/main/resources/org/gcube/portlets/user/td/expressionwidget/ExpressionWidget.gwt.xml @@ -19,7 +19,7 @@ - +