Changeset 20787


Ignore:
Timestamp:
03/03/10 16:44:00 (2 years ago)
Author:
julie
Message:

log error and return null when error is encountered rendering a widget

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/intermine/web/main/src/org/intermine/dwr/AjaxServices.java

    r20784 r20787  
    9191import org.intermine.web.logic.widget.EnrichmentWidget; 
    9292import org.intermine.web.logic.widget.GraphWidget; 
    93 import org.intermine.web.logic.widget.GridWidget; 
    9493import org.intermine.web.logic.widget.HTMLWidget; 
    9594import org.intermine.web.logic.widget.TableWidget; 
    9695import org.intermine.web.logic.widget.config.EnrichmentWidgetConfig; 
    9796import org.intermine.web.logic.widget.config.GraphWidgetConfig; 
    98 import org.intermine.web.logic.widget.config.GridWidgetConfig; 
    9997import org.intermine.web.logic.widget.config.HTMLWidgetConfig; 
    10098import org.intermine.web.logic.widget.config.TableWidgetConfig; 
     
    147145            processException(e); 
    148146        } 
     147    } 
     148 
     149    private static void processWidgetException(Exception e, String widgetId) { 
     150        String msg = "Failed to render widget: " + widgetId; 
     151        LOG.error(msg, e); 
    149152    } 
    150153 
     
    784787            } 
    785788        } catch (RuntimeException e) { 
    786             processException(e); 
     789            processWidgetException(e, widgetId); 
    787790        } 
    788791        return null; 
     
    817820            } 
    818821        } catch (RuntimeException e) { 
    819             processException(e); 
     822            processWidgetException(e, widgetId); 
    820823        } 
    821824        return null; 
     
    854857            } 
    855858        } catch (RuntimeException e) { 
    856             processException(e); 
     859            processWidgetException(e, widgetId); 
    857860        } 
    858861        return null; 
     
    900903            } 
    901904        } catch (RuntimeException e) { 
    902             processException(e); 
    903         } 
    904         return null; 
    905     } 
    906  
    907     /** 
    908      * 
    909      * @param widgetId unique ID for each widget 
    910      * @param bagName name of list 
    911      * @param highlight for highlighting 
    912      * @param pValue pValue 
    913      * @param numberOpt numberOpt 
    914      * @param externalLink link to external datasource 
    915      * @param externalLinkLabel name of external datasource. 
    916      * @return enrichment widget 
    917      */ 
    918     public static GridWidget getProcessGridWidget(String widgetId, String bagName, 
    919             String highlight, String pValue, String numberOpt, String externalLink, 
    920             String externalLinkLabel) { 
    921         try { 
    922             ServletContext servletContext = WebContextFactory.get().getServletContext(); 
    923             HttpSession session = WebContextFactory.get().getSession(); 
    924             final InterMineAPI im = SessionMethods.getInterMineAPI(session); 
    925             WebConfig webConfig = SessionMethods.getWebConfig(servletContext); 
    926             ObjectStore os = im.getObjectStore(); 
    927             Model model = os.getModel(); 
    928             Profile profile = SessionMethods.getProfile(session); 
    929             BagManager bagManager = im.getBagManager(); 
    930  
    931             InterMineBag imBag = bagManager.getUserOrGlobalBag(profile, bagName); 
    932             Type type = webConfig.getTypes().get(model.getPackageName() 
    933                     + "." + imBag.getType()); 
    934             List<WidgetConfig> widgets = type.getWidgets(); 
    935             for (WidgetConfig widgetConfig : widgets) { 
    936                 if (widgetConfig.getId().equals(widgetId)) { 
    937                     GridWidgetConfig gridWidgetConfig = (GridWidgetConfig) widgetConfig; 
    938                     gridWidgetConfig.setExternalLink(externalLink); 
    939                     gridWidgetConfig.setExternalLinkLabel(externalLinkLabel); 
    940                     GridWidget gridWidget = new GridWidget(gridWidgetConfig, imBag, os, null, 
    941                             highlight, pValue, numberOpt); 
    942                     return gridWidget; 
    943                 } 
    944             } 
    945         } catch (RuntimeException e) { 
    946             processException(e); 
     905            processWidgetException(e, widgetId); 
    947906        } 
    948907        return null; 
Note: See TracChangeset for help on using the changeset viewer.