@ -71,6 +71,9 @@ import org.gcube.portlets.widgets.fileupload.client.events.FileUploadSelectedEve
import org.gcube.portlets.widgets.fileupload.client.events.FileUploadSelectedEventHandler ;
import org.gcube.portlets.widgets.fileupload.client.view.UploadProgressDialog ;
import com.extjs.gxt.ui.client.event.Listener ;
import com.extjs.gxt.ui.client.event.MessageBoxEvent ;
import com.extjs.gxt.ui.client.widget.Dialog ;
import com.extjs.gxt.ui.client.widget.MessageBox ;
import com.google.gwt.core.client.GWT ;
import com.google.gwt.core.client.RunAsyncCallback ;
@ -1344,37 +1347,42 @@ public class Presenter {
*
* /
public void exportReportToRSG ( ) {
if ( Window . confirm ( "Are you sure you want to commit the " + model . getTemplateName ( ) + " into the VME Database?" ) ) {
dlg . center ( ) ;
dlg . show ( ) ;
Model toSave = model . getSerializableModel ( ) ;
reportService . exportReportToRSG ( currentVmeType , toSave , new AsyncCallback < VmeExportResponse > ( ) {
public void onFailure ( Throwable caught ) {
dlg . hide ( ) ;
MessageBox . alert ( "Warning" , "Report Not Exported: " + caught . getMessage ( ) , null ) ;
}
public void onSuccess ( VmeExportResponse response ) {
dlg . hide ( ) ;
//write ok
if ( response . isGloballySucceded ( ) ) {
MessageBox . info ( "Exporting to RSG Operation" , "Report Exported Successfully" , null ) ;
newDoc ( ) ;
}
//runtime exception
else if ( response . getResponseMessageList ( ) . size ( ) = = 1 & & response . getResponseMessageList ( ) . get ( 0 ) . getResponseEntryCode ( ) . equals ( "RUNTIME_EXCEPTION" ) ) {
MessageBox . alert ( "Exporting to RSG Operation Failed" , "Report Exporting has failed for the following reason: <br/> " + response . getResponseMessageList ( ) . get ( 0 ) . getResponseMessage ( ) , null ) ;
}
//user report compile exception
else {
String failReasons = "" ;
for ( VmeResponseEntry entry : response . getResponseMessageList ( ) ) {
failReasons + = entry . getResponseMessage ( ) + "<br/>" ;
}
MessageBox . alert ( "Exporting to RSG Operation Failed" , "Report Exporting has failed for the following reasons: <br/> " + failReasons , null ) ;
}
}
} ) ;
}
MessageBox . confirm ( "Commit to VME-DB" , "Are you sure you want to commit the " + model . getTemplateName ( ) + " into the VME Database?" , new Listener < MessageBoxEvent > ( ) {
@Override
public void handleEvent ( MessageBoxEvent be ) {
if ( Dialog . YES . equalsIgnoreCase ( be . getButtonClicked ( ) . getItemId ( ) ) ) {
dlg . center ( ) ;
Model toSave = model . getSerializableModel ( ) ;
reportService . exportReportToRSG ( currentVmeType , toSave , new AsyncCallback < VmeExportResponse > ( ) {
public void onFailure ( Throwable caught ) {
dlg . hide ( ) ;
MessageBox . alert ( "Warning" , "Report Not Exported: " + caught . getMessage ( ) , null ) ;
}
public void onSuccess ( VmeExportResponse response ) {
dlg . hide ( ) ;
//write ok
if ( response . isGloballySucceded ( ) ) {
MessageBox . info ( "Exporting to RSG Operation" , "Report Exported Successfully" , null ) ;
newDoc ( ) ;
}
//runtime exception
else if ( response . getResponseMessageList ( ) . size ( ) = = 1 & & response . getResponseMessageList ( ) . get ( 0 ) . getResponseEntryCode ( ) . equals ( "RUNTIME_EXCEPTION" ) ) {
MessageBox . alert ( "Exporting to RSG Operation Failed" , "Report Exporting has failed for the following reason: <br/> " + response . getResponseMessageList ( ) . get ( 0 ) . getResponseMessage ( ) , null ) ;
}
//user report compile exception
else {
String failReasons = "" ;
for ( VmeResponseEntry entry : response . getResponseMessageList ( ) ) {
failReasons + = entry . getResponseMessage ( ) + "<br/>" ;
}
MessageBox . alert ( "Exporting to RSG Operation Failed" , "Report Exporting has failed for the following reasons: <br/> " + failReasons , null ) ;
}
}
} ) ;
}
}
} ) ;
}
private void deleteVMEReport ( String reportId , String name , final VMETypeIdentifier type ) {