diff --git a/src/main/java/org/gcube/portlets/user/td/csvimportwidget/client/CSVWorkSpaceSelectionCard.java b/src/main/java/org/gcube/portlets/user/td/csvimportwidget/client/CSVWorkSpaceSelectionCard.java index 1157673..b62c4ed 100644 --- a/src/main/java/org/gcube/portlets/user/td/csvimportwidget/client/CSVWorkSpaceSelectionCard.java +++ b/src/main/java/org/gcube/portlets/user/td/csvimportwidget/client/CSVWorkSpaceSelectionCard.java @@ -5,6 +5,7 @@ package org.gcube.portlets.user.td.csvimportwidget.client; import org.gcube.portlets.user.td.csvimportwidget.client.general.WizardCard; import org.gcube.portlets.user.td.csvimportwidget.client.workspace.WorkspacePanel; +import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession; import org.gcube.portlets.widgets.lighttree.client.Item; import org.gcube.portlets.widgets.lighttree.client.ItemType; @@ -13,6 +14,7 @@ import org.gcube.portlets.widgets.lighttree.client.event.ItemSelectionHandler; import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.user.client.Command; +import com.google.gwt.user.client.rpc.AsyncCallback; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer; /** @@ -56,15 +58,12 @@ public class CSVWorkSpaceSelectionCard extends WizardCard { if(item.getType()==ItemType.EXTERNAL_FILE){ String filename=item.getName(); if(filename!=null&&!filename.isEmpty()){ - if(filename.compareToIgnoreCase("empty")!=0){ Log.debug("Item name: "+filename); Log.debug("Item path: "+item.getPath()); - getWizardWindow().setEnableNextButton(true); - } else { - Log.debug("Item"+filename); - getWizardWindow().setEnableNextButton(false); - } + importSession.setItemId(item.getId()); + getWizardWindow().setEnableNextButton(true); + } else { Log.debug("Item name null or empty"); getWizardWindow().setEnableNextButton(false); @@ -91,6 +90,7 @@ public class CSVWorkSpaceSelectionCard extends WizardCard { @Override public void execute() { + getFileFromWorkspace(); //TODO /*importSession.setTabResource(detail); @@ -122,5 +122,25 @@ public class CSVWorkSpaceSelectionCard extends WizardCard { getWizardWindow().setEnableNextButton(false); } + + protected void getFileFromWorkspace(){ + TDGWTServiceAsync tdGwtServiceAsync=TDGWTServiceAsync.INSTANCE; + tdGwtServiceAsync.getFileFromWorkspace(importSession, new AsyncCallback(){ + @Override + public void onFailure(Throwable caught) { + thisCard.showErrorAndHide("Error", "Error retrieving the file from the workspace: "+caught.getLocalizedMessage(), + caught.toString(), caught); + + } + + @Override + public void onSuccess(Void result) { + // TODO Auto-generated method stub + + } + + }); + + } } diff --git a/src/main/java/org/gcube/portlets/user/td/csvimportwidget/client/FileUploadPanel.java b/src/main/java/org/gcube/portlets/user/td/csvimportwidget/client/FileUploadPanel.java index d51b784..2dd4216 100644 --- a/src/main/java/org/gcube/portlets/user/td/csvimportwidget/client/FileUploadPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/csvimportwidget/client/FileUploadPanel.java @@ -185,19 +185,9 @@ public class FileUploadPanel extends FormPanel { protected void startUpload() { disableUpload(); - // we update the action url with the session id - // this is necessary in order to let the servlet retrieve the session id - // before the POST request parsing StringBuilder actionUrl = new StringBuilder(); actionUrl.append(GWT.getModuleBaseURL()); - // actionUrl.append(UPLOAD_SERVLET+"?sessionId="); actionUrl.append(UPLOAD_SERVLET); - /* - * if(session==null){ Log.info("No valid Session"); AlertMessageBox - * alertMessageBox = new AlertMessageBox("No session valid", - * "Error generating the session"); alertMessageBox.show(); return; } - */ - // actionUrl.append(session.getId()); setAction(actionUrl.toString()); Log.info("Start Upload action Url " + actionUrl.toString()); submit();