diff --git a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingFileUploadPanel.java b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingFileUploadPanel.java
index 38cbe27..d565567 100644
--- a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingFileUploadPanel.java
+++ b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingFileUploadPanel.java
@@ -3,11 +3,11 @@
*/
package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
-import org.gcube.portlets.user.td.wizardwidget.client.dataresource.ResourceBundle;
import org.gcube.portlets.user.td.codelistmappingimportwidget.client.progress.FileUploadProgressBarUpdater;
import org.gcube.portlets.user.td.codelistmappingimportwidget.client.progress.FileUploadProgressListener;
import org.gcube.portlets.user.td.codelistmappingimportwidget.client.progress.FileUploadProgressUpdater;
-import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
+import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
+import org.gcube.portlets.user.td.wizardwidget.client.dataresource.ResourceBundle;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
@@ -51,7 +51,7 @@ public class CodelistMappingFileUploadPanel extends FormPanel {
protected TextButton cancelButton;
public CodelistMappingFileUploadPanel(ResourceBundle res, final CodelistMappingUploadFileCard card,
- final CSVImportSession importSession) {
+ final CodelistMappingSession codelistMappingSession) {
this.res = res;
setId("CodelistMappingUploadPanel");
@@ -111,7 +111,7 @@ public class CodelistMappingFileUploadPanel extends FormPanel {
}
- importSession.setLocalFileName(filename);
+ codelistMappingSession.setLocalFileName(filename);
}
});
@@ -134,7 +134,7 @@ public class CodelistMappingFileUploadPanel extends FormPanel {
|| fileUploadField.getValue().equals("")) {
Log.info("fileUploadField is null or empty");
AlertMessageBox alertMessageBox = new AlertMessageBox(
- "CSV file missing", "Please specify a CSV file.");
+ "XML file missing", "Please specify a XML file.");
alertMessageBox.show();
return;
} else {
@@ -162,7 +162,7 @@ public class CodelistMappingFileUploadPanel extends FormPanel {
public void operationFailed(Throwable caught, String reason,
String failureDetails) {
- card.showErrorAndHide("Error uploading the csv file", reason,
+ card.showErrorAndHide("Error uploading the xml file", reason,
failureDetails, caught);
}
diff --git a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingImportWizardTD.java b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingImportWizardTD.java
index 5540b97..3795174 100644
--- a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingImportWizardTD.java
+++ b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingImportWizardTD.java
@@ -1,8 +1,9 @@
package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
+import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow;
-import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
+
import com.google.web.bindery.event.shared.EventBus;
/**
@@ -12,8 +13,7 @@ import com.google.web.bindery.event.shared.EventBus;
*/
public class CodelistMappingImportWizardTD extends WizardWindow {
- protected CSVImportSession importSession;
- //private CSVImportWizardTD wizard;
+ protected CodelistMappingSession codelistMappingSession;
/**
* The id of the {@link CSVTarget} to use.
@@ -23,10 +23,9 @@ public class CodelistMappingImportWizardTD extends WizardWindow {
public CodelistMappingImportWizardTD(TRId trId, String title, EventBus eventBus) {
super(title,eventBus);
- importSession= new CSVImportSession();
- //this.wizard=this;
+ codelistMappingSession= new CodelistMappingSession();
- SourceSelectionCard sourceSelection= new SourceSelectionCard(importSession);
+ SourceSelectionCard sourceSelection= new SourceSelectionCard(codelistMappingSession);
addCard(sourceSelection);
sourceSelection.setup();
diff --git a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingOperationInProgressCard.java b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingOperationInProgressCard.java
index 3bbe8f9..9b6a943 100644
--- a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingOperationInProgressCard.java
+++ b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingOperationInProgressCard.java
@@ -3,16 +3,16 @@
*/
package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
-import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
-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.wizardwidget.client.WizardCard;
import org.gcube.portlets.user.td.codelistmappingimportwidget.client.progress.CodelistMappingImportProgressBarUpdater;
import org.gcube.portlets.user.td.codelistmappingimportwidget.client.progress.CodelistMappingImportProgressListener;
import org.gcube.portlets.user.td.codelistmappingimportwidget.client.progress.CodelistMappingImportProgressUpdater;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
-import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
+import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
+import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
+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.wizardwidget.client.WizardCard;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.Command;
@@ -28,8 +28,7 @@ import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer.VBoxLayou
import com.sencha.gxt.widget.core.client.event.HideEvent;
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
-//import com.allen_sauer.gwt.log.client.Log;
-//import com.google.gwt.user.client.Command;
+
/**
*
@@ -42,35 +41,33 @@ public class CodelistMappingOperationInProgressCard extends WizardCard implement
public static final int STATUS_POLLING_DELAY = 1000;
protected CodelistMappingOperationInProgressCard thisCard;
- protected CSVImportSession importSession;
+ protected CodelistMappingSession codelistMappingSession;
protected CodelistMappingImportProgressUpdater progressUpdater;
- public CodelistMappingOperationInProgressCard(final CSVImportSession importSession) {
+ public CodelistMappingOperationInProgressCard(final CodelistMappingSession codelistMappingSession) {
super("Operation In Progress", "");
- this.importSession = importSession;
+ this.codelistMappingSession = codelistMappingSession;
thisCard = this;
VBoxLayoutContainer operationInProgressPanel = new VBoxLayoutContainer();
operationInProgressPanel.setVBoxLayoutAlign(VBoxLayoutAlign.CENTER);
final FlexTable description = new FlexTable();
- // FlexCellFormatter cellFormatter = description.getFlexCellFormatter();
description.setCellSpacing(10);
description.setCellPadding(4);
description.setBorderWidth(0);
- // display:block;vertical-align:text-top;
description.setHTML(0, 0,
"Document: ");
- description.setText(0, 1, "CSV File");
+ description.setText(0, 1, "Codelist Mapping");
description.setHTML(1, 0,
"Source: ");
- description.setText(1, 1, importSession.getSource().getName());
+ description.setText(1, 1, codelistMappingSession.getSource().getName());
description.setHTML(2, 0,
- "File: ");
- description.setText(2, 1, importSession.getTabResource().getName());
+ "Name: ");
+ description.setText(2, 1, codelistMappingSession.getResourceTD().getName());
FramedPanel summary = new FramedPanel();
summary.setHeadingText("Import Summary");
@@ -93,10 +90,9 @@ public class CodelistMappingOperationInProgressCard extends WizardCard implement
}
- // columnToImportMask
-
- public void importCSV() {
- TDGWTServiceAsync.INSTANCE.startCSVImport(importSession,
+
+ public void importCodelistMapping() {
+ TDGWTServiceAsync.INSTANCE.startCodelistMappingImport(codelistMappingSession,
new AsyncCallback() {
public void onSuccess(Void result) {
@@ -111,8 +107,8 @@ public class CodelistMappingOperationInProgressCard extends WizardCard implement
SessionExpiredType.EXPIREDONSERVER));
} else {
showErrorAndHide(
- "Error in importCSV",
- "An error occured in importCSV: "
+ "Error in import codelist mapping",
+ "An error occured in import codelist mapping: "
+ caught.getLocalizedMessage(),
caught.getStackTrace().toString(), caught);
}
@@ -127,7 +123,7 @@ public class CodelistMappingOperationInProgressCard extends WizardCard implement
setNextButtonVisible(false);
getWizardWindow().setEnableNextButton(false);
getWizardWindow().setNextButtonToFinish();
- importCSV();
+ importCodelistMapping();
}
public void operationInitializing() {
@@ -139,15 +135,13 @@ public class CodelistMappingOperationInProgressCard extends WizardCard implement
}
public void operationComplete(final TRId trId) {
- // final String tableId,final String tableResourceId) {
-
+
Command sayComplete = new Command() {
public void execute() {
try {
getWizardWindow().close(false);
- Log.info("fire Complete: tabular resource " + trId.getId());
- Log.info("fire Complete: tableId " + trId.getTableId());
-
+ Log.info("fire Complete: "+ trId);
+
getWizardWindow().fireCompleted(trId);
} catch (Exception e) {
@@ -170,7 +164,7 @@ public class CodelistMappingOperationInProgressCard extends WizardCard implement
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
- AlertMessageBox d = new AlertMessageBox("Error in CSV Import",
+ AlertMessageBox d = new AlertMessageBox("Error in Codelist Mapping Import",
reason);
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
@@ -182,8 +176,7 @@ public class CodelistMappingOperationInProgressCard extends WizardCard implement
@Override
public void operationStopped(final TRId trId, String reason, String details) {
- // final String tableId,final String tableResourceId) {
-
+
Command sayComplete = new Command() {
public void execute() {
try {
diff --git a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingTableDetailCard.java b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingTableDetailCard.java
index c59b591..e922a60 100644
--- a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingTableDetailCard.java
+++ b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingTableDetailCard.java
@@ -3,8 +3,8 @@
*/
package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
-import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
-import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
+import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
+import org.gcube.portlets.user.td.gwtservice.shared.resource.ResourceTD;
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
import com.allen_sauer.gwt.log.client.Log;
@@ -33,7 +33,7 @@ public class CodelistMappingTableDetailCard extends WizardCard {
protected final String TABLEDETAILPANELHEIGHT = "100%";
protected final String FORMWIDTH = "538px";
- protected CSVImportSession importSession;
+ protected CodelistMappingSession codelistMappingSession;
protected CodelistMappingTableDetailCard thisCard;
protected VerticalLayoutContainer p;
@@ -43,12 +43,13 @@ public class CodelistMappingTableDetailCard extends WizardCard {
protected TextArea description;
protected TextArea rights;
- protected TabResource detail = new TabResource();
+ protected ResourceTD resourceDetails = new ResourceTD();
- public CodelistMappingTableDetailCard(final CSVImportSession importSession) {
+ public CodelistMappingTableDetailCard(
+ final CodelistMappingSession codelistMappingSession) {
super("Codelist Mapping Detail", "");
- this.importSession = importSession;
+ this.codelistMappingSession = codelistMappingSession;
thisCard = this;
tableDetailPanel = new VerticalPanel();
@@ -72,7 +73,7 @@ public class CodelistMappingTableDetailCard extends WizardCard {
name = new TextField();
name.setAllowBlank(false);
name.setEmptyText("Enter a name...");
- name.setValue(importSession.getLocalFileName());
+ name.setValue(codelistMappingSession.getLocalFileName());
name.setAllowBlank(false);
p.add(new FieldLabel(name, "Name"), new VerticalLayoutData(1, -1));
@@ -84,19 +85,16 @@ public class CodelistMappingTableDetailCard extends WizardCard {
p.add(new FieldLabel(description, "Description"),
new VerticalLayoutData(1, -1));
-
tableDetailPanel.add(form);
setContent(tableDetailPanel);
}
-
@Override
public void setup() {
Command sayNextCard = new Command() {
-
public void execute() {
checkData();
}
@@ -137,8 +135,7 @@ public class CodelistMappingTableDetailCard extends WizardCard {
if (name.getValue() == null || name.getValue().isEmpty()
|| !name.isValid() || description.getValue() == null
- || description.getValue().isEmpty() || !description.isValid()
- ) {
+ || description.getValue().isEmpty() || !description.isValid()) {
d = new AlertMessageBox("Attention!", "Fill in all fields");
d.addHideHandler(hideHandler);
d.show();
@@ -152,15 +149,14 @@ public class CodelistMappingTableDetailCard extends WizardCard {
protected void goNext() {
try {
- detail.setName(name.getCurrentValue());
- detail.setDescription(description.getCurrentValue());
- detail.setRight(rights.getCurrentValue());
+ resourceDetails.setName(name.getCurrentValue());
+ resourceDetails.setDescription(description.getCurrentValue());
- importSession.setTabResource(detail);
+ codelistMappingSession.setResourceTD(resourceDetails);
- CodelistMappingOperationInProgressCard csvOperationInProgressCard = new CodelistMappingOperationInProgressCard(
- importSession);
- getWizardWindow().addCard(csvOperationInProgressCard);
+ CodelistMappingOperationInProgressCard codelistMappingOperationInProgressCard = new CodelistMappingOperationInProgressCard(
+ codelistMappingSession);
+ getWizardWindow().addCard(codelistMappingOperationInProgressCard);
Log.info("NextCard CodelistMappingOperationInProgressCard");
getWizardWindow().nextCard();
} catch (Exception e) {
diff --git a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingUploadFileCard.java b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingUploadFileCard.java
index 81b81f5..294e3ef 100644
--- a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingUploadFileCard.java
+++ b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingUploadFileCard.java
@@ -3,8 +3,8 @@
*/
package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
+import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
-import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.Command;
@@ -16,16 +16,16 @@ import com.google.gwt.user.client.Command;
*
*/
public class CodelistMappingUploadFileCard extends WizardCard {
- protected CSVImportSession importSession;
+ protected CodelistMappingSession codelistMappingSession;
protected CodelistMappingFileUploadPanel fileUploadPanel;
protected CodelistMappingUploadFileCard thisCard;
- public CodelistMappingUploadFileCard(final CSVImportSession importSession) {
+ public CodelistMappingUploadFileCard(final CodelistMappingSession codelistMappingSession) {
super("Codelist Mapping Import File Upload", "");
this.thisCard = this;
- this.importSession = importSession;
+ this.codelistMappingSession = codelistMappingSession;
- this.fileUploadPanel = new CodelistMappingFileUploadPanel(res, thisCard,importSession);
+ this.fileUploadPanel = new CodelistMappingFileUploadPanel(res, thisCard,codelistMappingSession);
setContent(fileUploadPanel);
@@ -36,7 +36,7 @@ public class CodelistMappingUploadFileCard extends WizardCard {
Command sayNextCard = new Command() {
public void execute() {
- CodelistMappingTableDetailCard detailsCard = new CodelistMappingTableDetailCard(importSession);
+ CodelistMappingTableDetailCard detailsCard = new CodelistMappingTableDetailCard(codelistMappingSession);
getWizardWindow().addCard(detailsCard);
Log.info("NextCard CodelistMappingTableDetailCard");
getWizardWindow().nextCard();
@@ -51,7 +51,7 @@ public class CodelistMappingUploadFileCard extends WizardCard {
try {
getWizardWindow().previousCard();
getWizardWindow().removeCard(thisCard);
- Log.info("Remove CSVUploadFileCard");
+ Log.info("Remove CodelistMappingUploadFileCard");
} catch (Exception e) {
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
}
diff --git a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingUrlSelectionCard.java b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingUrlSelectionCard.java
new file mode 100644
index 0000000..a87b1eb
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingUrlSelectionCard.java
@@ -0,0 +1,146 @@
+/**
+ *
+ */
+package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
+
+import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
+import org.gcube.portlets.user.td.gwtservice.shared.resource.ResourceTD;
+import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.user.client.Command;
+import com.sencha.gxt.widget.core.client.FramedPanel;
+import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
+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.form.FieldLabel;
+import com.sencha.gxt.widget.core.client.form.FieldSet;
+import com.sencha.gxt.widget.core.client.form.TextArea;
+import com.sencha.gxt.widget.core.client.form.TextField;
+
+/**
+ *
+ * @author "Giancarlo Panichi" g.panichi@isti.cnr.it
+ *
+ */
+public class CodelistMappingUrlSelectionCard extends WizardCard {
+ protected final String FORMWIDTH = "538px";
+
+ protected CodelistMappingSession codelistMappingSession;
+ protected CodelistMappingUrlSelectionCard thisCard;
+
+ protected TextField name;
+ protected TextArea description;
+
+ public CodelistMappingUrlSelectionCard(
+ final CodelistMappingSession codelistMappingSession) {
+ super("Codelist Mapping Url Selection", "");
+ this.thisCard = this;
+ this.codelistMappingSession = codelistMappingSession;
+
+ FramedPanel form = new FramedPanel();
+ form.setHeadingText("Url Selection");
+ form.setWidth(FORMWIDTH);
+
+ FieldSet fieldSet = new FieldSet();
+ fieldSet.setHeadingText("");
+ fieldSet.setCollapsible(false);
+ form.add(fieldSet);
+
+ VerticalLayoutContainer v = new VerticalLayoutContainer();
+ fieldSet.add(v);
+
+ name = new TextField();
+ name.setAllowBlank(false);
+ name.setEmptyText("Enter a name...");
+ name.setValue(codelistMappingSession.getLocalFileName());
+ name.setAllowBlank(false);
+ v.add(new FieldLabel(name, "Name"), new VerticalLayoutData(1, -1));
+
+ description = new TextArea();
+ description.setAllowBlank(false);
+ description.setEmptyText("Enter a description...");
+ description.setValue("XML codelist mapping");
+ description.setAllowBlank(false);
+ v.add(new FieldLabel(description, "Description"),
+ new VerticalLayoutData(1, -1));
+
+ setContent(form);
+
+ }
+
+ protected void checkUrl() {
+ getWizardWindow().setEnableNextButton(false);
+ getWizardWindow().setEnableBackButton(false);
+ AlertMessageBox d;
+ HideHandler hideHandler = new HideHandler() {
+
+ public void onHide(HideEvent event) {
+ getWizardWindow().setEnableNextButton(true);
+ getWizardWindow().setEnableBackButton(false);
+
+ }
+ };
+
+ if (name.getValue() == null || name.getValue().isEmpty()
+ || !name.isValid() || description.getValue() == null
+ || description.getValue().isEmpty() || !description.isValid()) {
+ d = new AlertMessageBox("Attention!", "Fill in all fields");
+ d.addHideHandler(hideHandler);
+ d.show();
+ } else {
+ name.setReadOnly(true);
+ description.setReadOnly(true);
+ goNext();
+ }
+ }
+
+ protected void goNext() {
+ try {
+ ResourceTD resourceTD=new ResourceTD();
+ resourceTD.setName(name.getCurrentValue());
+ resourceTD.setDescription(description.getCurrentValue());
+ codelistMappingSession.setResourceTD(resourceTD);
+
+ CodelistMappingTableDetailCard detailsCard = new CodelistMappingTableDetailCard(
+ codelistMappingSession);
+ getWizardWindow().addCard(detailsCard);
+ Log.info("NextCard CodelistMappingTableDetailCard");
+ getWizardWindow().nextCard();
+ } catch (Throwable e) {
+ Log.error("sayNextCard :" + e.getLocalizedMessage());
+ }
+ }
+
+ @Override
+ public void setup() {
+ Command sayNextCard = new Command() {
+
+ public void execute() {
+ checkUrl();
+ }
+
+ };
+
+ getWizardWindow().setNextButtonCommand(sayNextCard);
+
+ Command sayPreviousCard = new Command() {
+ public void execute() {
+ try {
+ getWizardWindow().previousCard();
+ getWizardWindow().removeCard(thisCard);
+ Log.info("Remove CodelistMappingUrlSelectionCard");
+ } catch (Exception e) {
+ Log.error("sayPreviousCard :" + e.getLocalizedMessage());
+ }
+ }
+ };
+
+ getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
+ getWizardWindow().setEnableNextButton(false);
+ }
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingWorkSpaceSelectionCard.java b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingWorkSpaceSelectionCard.java
index d033d39..3f637ef 100644
--- a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingWorkSpaceSelectionCard.java
+++ b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingWorkSpaceSelectionCard.java
@@ -3,13 +3,13 @@
*/
package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
+import org.gcube.portlets.user.td.codelistmappingimportwidget.client.workspace.WorkspacePanel;
+import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
+import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
+import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
-import org.gcube.portlets.user.td.codelistmappingimportwidget.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.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.widgets.lighttree.client.Item;
import org.gcube.portlets.widgets.lighttree.client.ItemType;
import org.gcube.portlets.widgets.lighttree.client.event.ItemSelectionEvent;
@@ -28,7 +28,7 @@ import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
*/
public class CodelistMappingWorkSpaceSelectionCard extends WizardCard {
- protected CSVImportSession importSession;
+ protected CodelistMappingSession codelistMappingSession;
protected CodelistMappingWorkSpaceSelectionCard thisCard;
protected Item item;
@@ -36,10 +36,10 @@ public class CodelistMappingWorkSpaceSelectionCard extends WizardCard {
protected WorkspacePanel wpanel;
public CodelistMappingWorkSpaceSelectionCard(
- final CSVImportSession importSession) {
+ final CodelistMappingSession codelistMappingSession) {
super("CSV Import From Workspace", "");
- this.importSession = importSession;
+ this.codelistMappingSession = codelistMappingSession;
thisCard = this;
p = new VerticalLayoutContainer();
@@ -52,7 +52,7 @@ public class CodelistMappingWorkSpaceSelectionCard extends WizardCard {
wpanel.setSelectableTypes(ItemType.EXTERNAL_FILE);
wpanel.getSelectableTypes().remove(ItemType.ROOT);
wpanel.getSelectableTypes().remove(ItemType.FOLDER);
- wpanel.setAllowedMimeTypes("text/csv", "application/zip",
+ wpanel.setAllowedMimeTypes("application/xml", "application/zip",
"application/x-zip", "application/x-zip-compressed",
"application/octet", "application/octet-stream");
wpanel.addSelectionHandler(new ItemSelectionHandler() {
@@ -66,7 +66,7 @@ public class CodelistMappingWorkSpaceSelectionCard extends WizardCard {
Log.debug("Item name: " + filename);
Log.debug("Item path: " + item.getPath());
- importSession.setItemId(item.getId());
+ codelistMappingSession.setItemId(item.getId());
getWizardWindow().setEnableNextButton(true);
} else {
@@ -88,11 +88,11 @@ public class CodelistMappingWorkSpaceSelectionCard extends WizardCard {
@Override
public void setup() {
- Log.debug("CSVWorkSpaceSelectionCard Call Setup ");
+ Log.debug("CodelistMappingWorkSpaceSelectionCard Call Setup ");
Command sayNextCard = new Command() {
public void execute() {
- Log.debug("CSVWorkSpaceSelectionCard Call sayNextCard wpanel:"
+ Log.debug("CodelistMappingWorkSpaceSelectionCard Call sayNextCard wpanel:"
+ wpanel);
wpanel.disable();
wpanel.startWaiting();
@@ -110,7 +110,7 @@ public class CodelistMappingWorkSpaceSelectionCard extends WizardCard {
try {
getWizardWindow().previousCard();
getWizardWindow().removeCard(thisCard);
- Log.debug("Remove CSVWorkSpaceSelectionCard");
+ Log.debug("Remove CodelistMappingWorkSpaceSelectionCard");
} catch (Exception e) {
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
}
@@ -124,7 +124,7 @@ public class CodelistMappingWorkSpaceSelectionCard extends WizardCard {
protected void getFileFromWorkspace() {
TDGWTServiceAsync tdGwtServiceAsync = TDGWTServiceAsync.INSTANCE;
- tdGwtServiceAsync.getFileFromWorkspace(importSession,
+ tdGwtServiceAsync.getFileFromWorkspace(codelistMappingSession,
new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -144,7 +144,7 @@ public class CodelistMappingWorkSpaceSelectionCard extends WizardCard {
public void onSuccess(Void result) {
wpanel.endWaiting();
- goForward();
+ goNext();
}
@@ -152,9 +152,9 @@ public class CodelistMappingWorkSpaceSelectionCard extends WizardCard {
}
- protected void goForward() {
+ protected void goNext() {
CodelistMappingTableDetailCard detailsCard = new CodelistMappingTableDetailCard(
- importSession);
+ codelistMappingSession);
getWizardWindow().addCard(detailsCard);
Log.info("NextCard CodelistMappingTableDetailCard");
getWizardWindow().nextCard();
diff --git a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/SourceSelectionCard.java b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/SourceSelectionCard.java
index c099cc0..0457ad4 100644
--- a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/SourceSelectionCard.java
+++ b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/SourceSelectionCard.java
@@ -3,12 +3,12 @@
*/
package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
-import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
-
-import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
+import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
import org.gcube.portlets.user.td.gwtservice.shared.source.FileSource;
+import org.gcube.portlets.user.td.gwtservice.shared.source.SourceType;
import org.gcube.portlets.user.td.gwtservice.shared.source.UrlSource;
import org.gcube.portlets.user.td.gwtservice.shared.source.WorkspaceSource;
+import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
@@ -27,18 +27,18 @@ import com.sencha.gxt.widget.core.client.form.Radio;
*/
public class SourceSelectionCard extends WizardCard {
- protected final CSVImportSession importSession;
+ protected final CodelistMappingSession codelistMappingSession;
final UrlSource urlSource = UrlSource.INSTANCE;
final FileSource fileSource = FileSource.INSTANCE;
final WorkspaceSource workspaceSource = WorkspaceSource.INSTANCE;
- public SourceSelectionCard(final CSVImportSession importSession) {
+ public SourceSelectionCard(final CodelistMappingSession codelistMappingSession) {
super("Codelist Mapping source selection", "");
- this.importSession = importSession;
+ this.codelistMappingSession = codelistMappingSession;
// Default
- importSession.setSource(urlSource);
+ codelistMappingSession.setSource(urlSource);
VerticalPanel sourceSelectionPanel = new VerticalPanel();
sourceSelectionPanel.setStylePrimaryName(res.wizardCSS()
@@ -88,15 +88,15 @@ public class SourceSelectionCard extends WizardCard {
Radio radio = (Radio) group.getValue();
Log.info("Source Selected:" + radio.getName());
if (radio.getName().compareTo(urlSource.getName()) == 0) {
- importSession.setSource(urlSource);
+ codelistMappingSession.setSource(urlSource);
} else {
if (radio.getName()
.compareTo(workspaceSource.getName()) == 0) {
- importSession.setSource(workspaceSource);
+ codelistMappingSession.setSource(workspaceSource);
} else {
if (radio.getName().compareTo(fileSource.getName()) == 0) {
- importSession.setSource(fileSource);
+ codelistMappingSession.setSource(fileSource);
} else {
}
@@ -122,26 +122,35 @@ public class SourceSelectionCard extends WizardCard {
Command sayNextCard = new Command() {
public void execute() {
try {
- String sourceId = importSession.getSource().getId();
+ String sourceId = codelistMappingSession.getSource().getId();
if (sourceId == null || sourceId.isEmpty()) {
- Log.error("CSV Import Source Id: " + sourceId);
+ Log.error("Codelist Mapping Import Source Id: " + sourceId);
} else {
- if (sourceId.compareTo("File") == 0) {
- Log.info("NextCard CSVUploadFileCard");
- CodelistMappingUploadFileCard csvUploadFileCard = new CodelistMappingUploadFileCard(
- importSession);
- getWizardWindow().addCard(csvUploadFileCard);
+ if (sourceId.compareTo(SourceType.FILE.toString()) == 0) {
+ Log.info("NextCard CodelistMappingUploadFileCard");
+ CodelistMappingUploadFileCard codelistMappingUploadFileCard = new CodelistMappingUploadFileCard(
+ codelistMappingSession);
+ getWizardWindow().addCard(codelistMappingUploadFileCard);
getWizardWindow().nextCard();
} else {
- if (sourceId.compareTo("Workspace") == 0) {
+ if (sourceId.compareTo(SourceType.WORKSPACE.toString()) == 0) {
Log.info("NextCard CSVWorkspaceSelectionCard");
- CodelistMappingWorkSpaceSelectionCard csvWorkspaceSelectionCard = new CodelistMappingWorkSpaceSelectionCard(
- importSession);
+ CodelistMappingWorkSpaceSelectionCard codelistMappingWorkspaceSelectionCard = new CodelistMappingWorkSpaceSelectionCard(
+ codelistMappingSession);
getWizardWindow().addCard(
- csvWorkspaceSelectionCard);
+ codelistMappingWorkspaceSelectionCard);
getWizardWindow().nextCard();
} else {
- Log.debug("No source selected and no card loaded");
+ if (sourceId.compareTo(SourceType.URL.toString()) == 0) {
+ Log.info("NextCard CodelistMappingURLSelectionCard");
+ CodelistMappingUrlSelectionCard codelistMappingUrlSelectionCard = new CodelistMappingUrlSelectionCard(
+ codelistMappingSession);
+ getWizardWindow().addCard(
+ codelistMappingUrlSelectionCard);
+ getWizardWindow().nextCard();
+ } else {
+ Log.debug("No source selected and no card loaded");
+ }
}
}
}
diff --git a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/progress/CodelistMappingImportProgressUpdater.java b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/progress/CodelistMappingImportProgressUpdater.java
index 87744c9..f522483 100644
--- a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/progress/CodelistMappingImportProgressUpdater.java
+++ b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/progress/CodelistMappingImportProgressUpdater.java
@@ -6,7 +6,7 @@ package org.gcube.portlets.user.td.codelistmappingimportwidget.client.progress;
import java.util.ArrayList;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
-import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportMonitor;
+import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingMonitor;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log;
@@ -33,7 +33,7 @@ public class CodelistMappingImportProgressUpdater extends Timer {
public void run() {
Log.debug("requesting operation progress");
TDGWTServiceAsync.INSTANCE
- .getCSVImportMonitor(new AsyncCallback() {
+ .getCodelistMappingMonitor(new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -45,7 +45,7 @@ public class CodelistMappingImportProgressUpdater extends Timer {
"Failed getting operation updates", message);
}
- public void onSuccess(CSVImportMonitor result) {
+ public void onSuccess(CodelistMappingMonitor result) {
Log.info("retrieved CSVImportMonitor: "
+ result.getStatus());
switch (result.getStatus()) {
@@ -77,7 +77,7 @@ public class CodelistMappingImportProgressUpdater extends Timer {
break;
case SUCCEDED:
cancel();
- Log.info("Import fisnish TableId :"
+ Log.info("Import fisnish:"
+ result.getTrId());
fireOperationComplete(result.getTrId());
break;
@@ -92,26 +92,26 @@ public class CodelistMappingImportProgressUpdater extends Timer {
}
- protected void errorMessage(CSVImportMonitor result) {
- Log.info("CSV Import Failed");
+ protected void errorMessage(CodelistMappingMonitor result) {
+ Log.info("Codelist Mapping Import Failed");
Throwable th = null;
String failure = null;
String details = null;
if (result.getError() != null) {
th = result.getError();
- failure = "Failed Client Library Import";
+ failure = "Failed Client Library Codelist Mapping Import";
details = result.getError().getLocalizedMessage();
} else {
th = new Throwable("Failed");
- failure = "Failed Client Library Import";
- details = "Error in import";
+ failure = "Failed Client Library Codelist Mapping Import";
+ details = "Error in codelist mapping import";
}
fireOperationFailed(th, failure, details);
}
- protected void stopMessage(CSVImportMonitor result) {
- Log.info("CSV Import Stopped");
+ protected void stopMessage(CodelistMappingMonitor result) {
+ Log.info("Codelist Mapping Import Stopped");
String failure = null;
String details = null;
if (result.getError() != null) {
@@ -119,7 +119,7 @@ public class CodelistMappingImportProgressUpdater extends Timer {
details = result.getError().getLocalizedMessage();
} else {
failure = "Stopped";
- details = "Stopped import CSV";
+ details = "Stopped codelist mapping import";
}
fireOperationStopped(result.getTrId(),failure, details);