Class WidgetService
- java.lang.Object
-
- org.intermine.webservice.server.WebService
-
- org.intermine.webservice.server.core.JSONService
-
- org.intermine.webservice.server.widget.WidgetService
-
- Direct Known Subclasses:
EnrichmentWidgetResultService
,GraphService
,TableWidgetService
public abstract class WidgetService extends JSONService
- Author:
- dbutano
-
-
Field Summary
-
Fields inherited from class org.intermine.webservice.server.core.JSONService
bagManager, model
-
Fields inherited from class org.intermine.webservice.server.WebService
dataPackageOutput, DEFAULT_CALLBACK, im, os, out, output, request, response, webProperties
-
-
Constructor Summary
Constructors Constructor Description WidgetService(InterMineAPI im)
Construct the webservice controller.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addOutputAttribute(java.lang.String label, java.lang.String value)
Wrapper around addOutputInfo that makes sure we don't add empty values.protected void
addOutputConfig(WidgetConfig config)
Add metadata about the widget we are using.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.protected void
addOutputIdsInfo(java.lang.String ids, java.lang.String populationIds)
Add metadata about the IDs we are processing.protected void
addOutputListInfo(InterMineBag imBag)
Add metadata about the list we are processing.protected void
addOutputResult(Widget widget)
Send results to the outside world.protected java.lang.String
getDefaultFilterValue(WidgetConfig widgetConfig, InterMineBag imBag, java.lang.String ids)
Get the default filter value for a widget.protected java.util.Map<java.lang.String,java.lang.Object>
getHeaderAttributes()
Get the header attributes to apply to the formatter.protected abstract WidgetResultProcessor
getProcessor()
protected InterMineBag
retrieveBag(java.lang.String bagName)
Get the bag in question.-
Methods inherited from class org.intermine.webservice.server.core.JSONService
addOutputInfo, addResultEntries, addResultEntries, addResultEntry, addResultEntry, addResultItem, addResultItem, addResultValue, addResultValue, addResultValue, getDefaultFormat, getResultsKey, lazyList, postInit
-
Methods inherited from class org.intermine.webservice.server.WebService
canServe, cleanUp, execute, formatIsFlatFile, formatIsJSON, formatIsJSONP, formatIsXML, getAuthenticatedUser, getCallback, getColumnHeaderStyle, getDefaultFileName, getDefaultOutput, getDefaultOutput, getExtension, getFormat, getIntParameter, getIntParameter, getLineBreak, getListManager, getOptionalParameter, getOptionalParameter, getPermission, getProperty, getRawOutput, getRequestFileName, getRequiredParameter, hasCallback, initState, isAuthenticated, isGzip, isUncompressed, isZip, makeJSONOutput, makeXMLOutput, service, setFormat, setNameSpace, validateState, wantsColumnHeaders, wantsDataPackage
-
-
-
-
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 analysedpopulationIds
- 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 classJSONService
- 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.
-
-