Class WidgetService

    • Constructor Detail

      • WidgetService

        public WidgetService​(InterMineAPI im)
        Construct the webservice controller.
        Parameters:
        im - The API object.
    • Method Detail

      • retrieveBag

        protected InterMineBag retrieveBag​(java.lang.String bagName)
        Get the bag in question.
        Parameters:
        bagName - The name of the bag.
        Returns:
        The list.
      • addOutputAttribute

        protected void addOutputAttribute​(java.lang.String label,
                                          java.lang.String value)
        Wrapper around addOutputInfo that makes sure we don't add empty values.
        Parameters:
        label - The attribute name.
        value - The value of the attribute.
      • addOutputListInfo

        protected void addOutputListInfo​(InterMineBag imBag)
        Add metadata about the list we are processing.
        Parameters:
        imBag - The list object.
      • addOutputIdsInfo

        protected void addOutputIdsInfo​(java.lang.String ids,
                                        java.lang.String populationIds)
        Add metadata about the IDs we are processing. Use these IDs instead of bag or populationBag.
        Parameters:
        ids - intermine object ids to be analysed
        populationIds - intermine object ids to use as background population
      • addOutputConfig

        protected void addOutputConfig​(WidgetConfig config)
        Add metadata about the widget we are using.
        Parameters:
        config - The description of the widget.
      • addOutputFilter

        protected void addOutputFilter​(WidgetConfig widgetConfig,
                                       java.lang.String filterSelectedValue,
                                       InterMineBag imBag,
                                       java.lang.String ids)
        Add information about the filters as attributes to the result.
        Parameters:
        widgetConfig - The description of the widgets.
        filterSelectedValue - The currently selected value.
        imBag - The list we are processing.
        ids - The ids we are processing, use instead of imBag
      • addOutputResult

        protected void addOutputResult​(Widget widget)
                                throws java.lang.Exception
        Send results to the outside world.
        Parameters:
        widget - The widget we are processing.
        Throws:
        java.lang.Exception - If we can't get results.
      • getProcessor

        protected abstract WidgetResultProcessor getProcessor()
        Returns:
        A widget result processor for outputting results.
      • getHeaderAttributes

        protected java.util.Map<java.lang.String,​java.lang.Object> getHeaderAttributes()
        Description copied from class: JSONService
        Get the header attributes to apply to the formatter.
        Overrides:
        getHeaderAttributes in class JSONService
        Returns:
        A map from string to object.
      • getDefaultFilterValue

        protected java.lang.String getDefaultFilterValue​(WidgetConfig widgetConfig,
                                                         InterMineBag imBag,
                                                         java.lang.String ids)
        Get the default filter value for a widget.
        Parameters:
        widgetConfig - The widget description.
        imBag - The bag we are thinking of running this widget on.
        ids - The ids we are thinking of running this widget on, use instead of imBag
        Returns:
        A string (possibly null) which contains the default filter value.