added error handling when list reports fails for VME-DB case

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@98280 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2014-07-02 13:12:44 +00:00
parent 198ec80e9a
commit a8fa203e2b
2 changed files with 25 additions and 4 deletions

View File

@ -17,6 +17,7 @@ import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.GroupingStore;
import com.extjs.gxt.ui.client.store.Store;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Html;
import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.StoreFilterField;
@ -91,7 +92,8 @@ public class SelectVMEReportDialog extends Window {
reportService.listVMEReports(new AsyncCallback<ArrayList<VMEReportBean>>() {
@Override
public void onFailure(Throwable caught) {
mainPanel.unmask();
mainPanel.unmask();
showCommunicationError();
}
@Override
@ -104,7 +106,8 @@ public class SelectVMEReportDialog extends Window {
reportService.listVMEReportRefByType(type, new AsyncCallback<ArrayList<VMEReportBean>>() {
@Override
public void onFailure(Throwable caught) {
mainPanel.unmask();
mainPanel.unmask();
showCommunicationError();
}
@Override
@ -116,6 +119,16 @@ public class SelectVMEReportDialog extends Window {
}
}
private void showCommunicationError() {
mainPanel.add(new Html(""
+ "<div style=\"text-align: center; font-size: 16px; margin: 100px 20px;\">We're sorry, it seems something is broken in the communication with the VMEs Repository. "
+ "</div>"
+ "<div style=\"text-align: center; font-size: 16px; margin: 50px 20px;\">"
+ "In the meantime you may <a target=\"_blank\" href=\"https://support.d4science.research-infrastructures.eu\">report the issue.<a/></div>"
+ ""));
mainPanel.setLayout(new FitLayout());
mainPanel.layout();
}
/**
*
* @param reports

View File

@ -41,6 +41,7 @@ import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.application.framework.core.session.SessionManager;
import org.gcube.application.reporting.reader.ModelReader;
import org.gcube.application.rsg.client.RsgClient;
import org.gcube.application.rsg.client.support.ClientException;
import org.gcube.application.rsg.service.RsgService;
import org.gcube.application.rsg.service.dto.ReportEntry;
import org.gcube.application.rsg.service.dto.ReportType;
@ -1716,15 +1717,22 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
RsgClient rsgClient = getRsgSecureClient();
_log.debug("listVMEReports() securedWithEncryptedToken completed");
ReportEntry[] reports = null;
try {
reports = rsgClient.listReports(type);
} catch (ClientException e) {
_log.error("failed to get the list of VME Reports: " + e.getMessage());
}
if (isVREManager()) {
for (ReportEntry re : rsgClient.listReports(type)) {
for (ReportEntry re : reports) {
String rfmo = re.getOwner();
String name = re.getIdentifier();
toReturn.add(new VMEReportBean(""+re.getId(), rfmo, name));
}
} else {
ArrayList<String> allowedRFMOs = getUserRFMOs();
for (ReportEntry re : rsgClient.listReports(type)) {
for (ReportEntry re : reports) {
String rfmo = re.getOwner().trim();
String name = re.getIdentifier();
for (String allowedRFMO : allowedRFMOs) {