Class QueryUploadService

  • Direct Known Subclasses:
    QueryUpdateService

    public class QueryUploadService
    extends WebService
    A service to enable queries to be uploaded programmatically.
    Author:
    Alexis Kalderimis
    • Field Detail

      • QUERIES_PARAMETER

        public static final java.lang.String QUERIES_PARAMETER
        The key for the queries parameter
        See Also:
        Constant Field Values
      • VERSION_PARAMETER

        public static final java.lang.String VERSION_PARAMETER
        The key for the version parameter
        See Also:
        Constant Field Values
      • profile

        protected Profile profile
    • Constructor Detail

      • QueryUploadService

        public QueryUploadService​(InterMineAPI im)
        Constructor.
        Parameters:
        im - A reference to the API configuration and settings bundle.
    • Method Detail

      • getDefaultFormat

        protected Format getDefaultFormat()
        Overrides:
        getDefaultFormat in class WebService
        Returns:
        The default format constant for this service.
      • canServe

        protected boolean canServe​(Format f)
        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 class WebService
        Parameters:
        f - The format to check.
        Returns:
        whether or not this format is acceptable.
      • postInit

        protected void postInit()
        Description copied from class: WebService
        Subclasses can hook in here to do common behaviour that needs to happen after initialisation.
        Overrides:
        postInit in class WebService
      • 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 class WebService
      • 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 class WebService
        Throws:
        java.lang.Exception - if some error occurs
      • saveQueries

        protected java.util.Map<java.lang.String,​java.lang.String> saveQueries​(java.util.Map<java.lang.String,​PathQuery> toSave)
        Save the given queries.
        Parameters:
        toSave - The queries to save.
        Returns:
        A mapping from given name to the name they were actually saved under.
      • getQueryString

        protected java.lang.String getQueryString()
                                           throws java.io.IOException
        Get the XML which represents the queries to be saved.
        Returns:
        The XML.
        Throws:
        java.io.IOException - If we can't read from the request.
      • makeXMLOutput

        protected Output makeXMLOutput​(java.io.PrintWriter out,
                                       java.lang.String separator)
        Description copied from class: WebService
        Make the XML output given the HttpResponse's PrintWriter.
        Overrides:
        makeXMLOutput in class WebService
        Parameters:
        out - The PrintWriter from the HttpResponse.
        separator - the line-separator for the client's platform.
        Returns:
        An Output that produces good XML.