Fixed Error on operation progress
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-codelistmapping-import-widget@114582 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
2085becaa4
commit
2786fe7035
|
@ -3,22 +3,12 @@
|
|||
*/
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
|
||||
|
||||
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.TDGWTIsFinalException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDDescriptor;
|
||||
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.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.OperationResult;
|
||||
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.google.gwt.user.client.rpc.AsyncCallback;
|
||||
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;
|
||||
|
@ -35,8 +25,7 @@ import com.sencha.gxt.widget.core.client.form.TextField;
|
|||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class CodelistMappingTableDetailCard extends WizardCard implements
|
||||
MonitorDialogListener {
|
||||
public class CodelistMappingTableDetailCard extends WizardCard {
|
||||
|
||||
protected CodelistMappingSession codelistMappingSession;
|
||||
protected CodelistMappingTableDetailCard thisCard;
|
||||
|
@ -149,115 +138,19 @@ public class CodelistMappingTableDetailCard extends WizardCard implements
|
|||
|
||||
codelistMappingSession.setResourceTDDescriptor(resourceDetails);
|
||||
|
||||
/*
|
||||
* CodelistMappingOperationInProgressCard
|
||||
* codelistMappingOperationInProgressCard = new
|
||||
* CodelistMappingOperationInProgressCard( codelistMappingSession);
|
||||
* getWizardWindow
|
||||
* ().addCard(codelistMappingOperationInProgressCard);
|
||||
* Log.info("NextCard CodelistMappingOperationInProgressCard");
|
||||
* getWizardWindow().nextCard();
|
||||
*/
|
||||
importCodelistMapping();
|
||||
CodelistMappingOperationInProgressCard codelistMappingOperationInProgressCard = new CodelistMappingOperationInProgressCard(
|
||||
codelistMappingSession);
|
||||
getWizardWindow().addCard(codelistMappingOperationInProgressCard);
|
||||
Log.info("NextCard CodelistMappingOperationInProgressCard");
|
||||
getWizardWindow().nextCard();
|
||||
|
||||
|
||||
|
||||
} catch (Throwable e) {
|
||||
Log.error("sayNextCard :" + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
protected void importCodelistMapping() {
|
||||
TDGWTServiceAsync.INSTANCE.startCodelistMappingImport(
|
||||
codelistMappingSession, new AsyncCallback<String>() {
|
||||
|
||||
public void onSuccess(String taskId) {
|
||||
openMonitorDialog(taskId);
|
||||
}
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
getEventBus()
|
||||
.fireEvent(
|
||||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsLockedException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
showErrorAndHide("Error Locked",
|
||||
caught.getLocalizedMessage(), "", caught);
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsFinalException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
showErrorAndHide("Error Final",
|
||||
caught.getLocalizedMessage(),
|
||||
"", caught);
|
||||
} else {
|
||||
showErrorAndHide(
|
||||
"Error in import codelist mapping",
|
||||
"An error occured in import codelist mapping: "
|
||||
+ caught.getLocalizedMessage(),
|
||||
"", caught);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void openMonitorDialog(String taskId) {
|
||||
MonitorDialog monitorDialog = new MonitorDialog(taskId, getEventBus());
|
||||
monitorDialog.add(thisCard);
|
||||
monitorDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationComplete(OperationResult operationResult) {
|
||||
getWizardWindow().fireCompleted(operationResult.getTrId());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationFailed(Throwable caught, String reason, String details) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
getEventBus()
|
||||
.fireEvent(
|
||||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsLockedException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
showErrorAndHide("Error Locked", caught.getLocalizedMessage(),
|
||||
"", caught);
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsFinalException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
showErrorAndHide("Error Final",
|
||||
caught.getLocalizedMessage(), "", caught);
|
||||
} else {
|
||||
getWizardWindow().fireFailed("Error",
|
||||
"Error in Codelist Mapping Import", "", caught);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationStopped(OperationResult operationResult, String reason, String details) {
|
||||
getWizardWindow().fireCompleted(operationResult.getTrId());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationAborted() {
|
||||
getWizardWindow().fireAborted();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationPutInBackground() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue