Class QueryToListService
- java.lang.Object
-
- org.intermine.webservice.server.WebService
-
- org.intermine.webservice.server.query.AbstractQueryService
-
- org.intermine.webservice.server.query.QueryToListService
-
- Direct Known Subclasses:
QueryListAppendService
,TemplateToListService
public class QueryToListService extends AbstractQueryService
A service for transforming a query, represented as a PathQuery serialised to XML, to a list.- Author:
- Alex Kalderimis
-
-
Field Summary
Fields Modifier and Type Field Description protected BagManager
bagManager
-
Fields inherited from class org.intermine.webservice.server.WebService
dataPackageOutput, DEFAULT_CALLBACK, im, os, out, output, request, response, webProperties
-
-
Constructor Summary
Constructors Constructor Description QueryToListService(InterMineAPI im)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canServe(Format format)
Check whether the format is acceptable.protected void
execute()
Runs service.protected void
generateListFromQuery(PathQuery pq, ListInput input, Profile profile)
Generate a list from a pathquery.protected Format
getDefaultFormat()
protected PathQuery
getQuery(javax.servlet.http.HttpServletRequest request)
Get the pathquery to use for this request.protected Query
getQuery(PathQuery pq, Profile profile)
Get the Objectstore Query to run to generate the list.protected void
setHeaderAttributes(java.lang.String name, java.lang.Integer id)
Sets the header attributes map on the current output object.protected void
validateState()
Subclasses can put initialisation checks here.-
Methods inherited from class org.intermine.webservice.server.query.AbstractQueryService
formatIsJsonObj, getQueryBuilder, getSchemaLocation, getSchemaUrl
-
Methods inherited from class org.intermine.webservice.server.WebService
cleanUp, 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, postInit, service, setFormat, setNameSpace, wantsColumnHeaders, wantsDataPackage
-
-
-
-
Field Detail
-
bagManager
protected final BagManager bagManager
-
-
Constructor Detail
-
QueryToListService
public QueryToListService(InterMineAPI im)
Constructor.- Parameters:
im
- The intermine settings bundle
-
-
Method Detail
-
getDefaultFormat
protected Format getDefaultFormat()
- Overrides:
getDefaultFormat
in classWebService
- Returns:
- The default format constant for this service.
-
canServe
protected boolean canServe(Format format)
Description copied from class:WebService
Check whether the format is acceptable. By default returns true. Services with a particular set of accepted formats should override this and check.- Overrides:
canServe
in classWebService
- Parameters:
format
- The format to check.- Returns:
- whether or not this format is acceptable.
-
validateState
protected void validateState()
Description copied from class:WebService
Subclasses can put initialisation checks here. The main use case is for confirming authentication.- Overrides:
validateState
in classWebService
-
execute
protected void execute() throws java.lang.Exception
Description copied from class:WebService
Runs service. This is abstract method, that must be defined in subclasses and so performs something useful. Standard procedure is overwrite this method in subclasses and let this method to be called from WebService.doGet method that encapsulates logic common for all web services else you can overwrite doGet method in your web service class and manage all the things alone.- Specified by:
execute
in classWebService
- Throws:
java.lang.Exception
- if some error occurs
-
getQuery
protected PathQuery getQuery(javax.servlet.http.HttpServletRequest request)
Get the pathquery to use for this request.- Parameters:
request
- The http request.- Returns:
- A pathquery
-
generateListFromQuery
protected void generateListFromQuery(PathQuery pq, ListInput input, Profile profile) throws ObjectStoreException, PathException
Generate a list from a pathquery.- Parameters:
pq
- The pathqueryinput
- The inputprofile
- The profile the list should belong to- Throws:
ObjectStoreException
- If there is an issue running the queries that generate the list.PathException
- If the paths supplied are illegal.
-
getQuery
protected Query getQuery(PathQuery pq, Profile profile)
Get the Objectstore Query to run to generate the list.- Parameters:
pq
- The pathquery to generate the query from.profile
- The profile to search for bags.- Returns:
- A query.
-
setHeaderAttributes
protected void setHeaderAttributes(java.lang.String name, java.lang.Integer id)
Sets the header attributes map on the current output object.- Parameters:
name
- The name of the list.id
- intermine id for list
-
-