Added Delete Validations
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-table-widget@115468 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
2c8fb0efce
commit
568345d059
|
@ -0,0 +1,122 @@
|
||||||
|
package org.gcube.portlets.user.td.tablewidget.client.validation;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||||
|
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.monitorwidget.client.MonitorDialog;
|
||||||
|
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
|
||||||
|
import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||||
|
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.client.type.SessionExpiredType;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.OperationResult;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.web.bindery.event.shared.EventBus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ValidationsDelete implements MonitorDialogListener {
|
||||||
|
|
||||||
|
private TRId trId;
|
||||||
|
private EventBus eventBus;
|
||||||
|
|
||||||
|
public ValidationsDelete(TRId trId, EventBus eventBus) {
|
||||||
|
this.trId = trId;
|
||||||
|
this.eventBus = eventBus;
|
||||||
|
callValidationsDelete();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void callValidationsDelete() {
|
||||||
|
|
||||||
|
TDGWTServiceAsync.INSTANCE.startValidationsDelete(trId,
|
||||||
|
new AsyncCallback<String>() {
|
||||||
|
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
eventBus.fireEvent(new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
if (caught instanceof TDGWTIsLockedException) {
|
||||||
|
Log.error(caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert("Error Locked",
|
||||||
|
caught.getLocalizedMessage());
|
||||||
|
} else {
|
||||||
|
if (caught instanceof TDGWTIsFinalException) {
|
||||||
|
Log.error(caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert("Error Final",
|
||||||
|
caught.getLocalizedMessage());
|
||||||
|
} else {
|
||||||
|
Log.debug("Error Deleting Validations: "
|
||||||
|
+ caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert(
|
||||||
|
"Error Deleting Validations",
|
||||||
|
caught.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSuccess(String taskId) {
|
||||||
|
openMonitorDialog(taskId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// /
|
||||||
|
protected void openMonitorDialog(String taskId) {
|
||||||
|
MonitorDialog monitorDialog = new MonitorDialog(taskId, eventBus);
|
||||||
|
monitorDialog.addProgressDialogListener(this);
|
||||||
|
monitorDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operationComplete(OperationResult operationResult) {
|
||||||
|
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
|
||||||
|
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||||
|
ChangeTableRequestType.CHANGETABLETYPE,
|
||||||
|
operationResult.getTrId(), why);
|
||||||
|
eventBus.fireEvent(changeTableRequestEvent);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operationFailed(Throwable caught, String reason, String details) {
|
||||||
|
UtilsGXT3.alert(reason, details);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operationStopped(OperationResult operationResult,
|
||||||
|
String reason, String details) {
|
||||||
|
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
|
||||||
|
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||||
|
ChangeTableRequestType.CHANGETABLETYPE,
|
||||||
|
operationResult.getTrId(), why);
|
||||||
|
eventBus.fireEvent(changeTableRequestEvent);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operationAborted() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operationPutInBackground() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue