Class PortalHelper


  • public final class PortalHelper
    extends java.lang.Object
    Util methods for the portal
    Author:
    Julie Sullivan
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String generatePermaLink​(FastPathObject obj, java.lang.String baseUrl, java.util.Map<java.lang.String,​java.util.List<FieldDescriptor>> classKeys)
      Generate a perma-link to a report page for an InterMine object.
      static java.lang.String generatePermaPath​(FastPathObject obj, java.util.Map<java.lang.String,​java.util.List<FieldDescriptor>> classKeys)
      Generate a link suitable for use as an external, permanent link, in that the link should work between rebuilds of the database.
      static java.lang.String generatePortalLink​(FastPathObject obj, InterMineAPI im, javax.servlet.http.HttpServletRequest request)
      Generate a stable link to a report page for the given object, this will create a portal link with the correct class and a value from a non-null class key field of the object.
      static java.lang.String generatePortalPath​(FastPathObject obj, InterMineAPI im)
      Generate an external portal link (perma-link) for an InterMine object.
      static java.lang.String generateReportLink​(ResultElement elem, java.lang.String baseUrl)
      Generate a link to the object details page using the internal id.
      static java.lang.String generateReportPath​(ResultCell elem)
      Get the path fragment (starting with "/") for the report page for an object in the mine.
      static java.lang.String getAdditionalParameter​(javax.servlet.http.HttpServletRequest request, java.lang.String params)
      Searches a request for additional parameters that might match an additional converter.
      static BagConverter getBagConverter​(InterMineAPI im, WebConfig webConfig, java.lang.String converterClassName)
      Returns a BagConverter for the given parameters.
      static java.lang.String getBaseUrl​(javax.servlet.http.HttpServletRequest request)
      Get the base url for this web-app.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getBagConverter

        public static BagConverter getBagConverter​(InterMineAPI im,
                                                   WebConfig webConfig,
                                                   java.lang.String converterClassName)
        Returns a BagConverter for the given parameters.
        Parameters:
        im - the InterMine API to use
        webConfig - the WebConfig to take configuration from
        converterClassName - the class name of the converter
        Returns:
        a new or recycled BagConverter object
      • getAdditionalParameter

        public static java.lang.String getAdditionalParameter​(javax.servlet.http.HttpServletRequest request,
                                                              java.lang.String params)
        Searches a request for additional parameters that might match an additional converter. The additional converter config is passed in through the paramArray parameter, which is a String array, where the first element is a comma-separated list of possible parameter names to search for. The value of the last parameter in the request that matches one of the names in the list will be returned, or null if none match.
        Parameters:
        request - a request to search in
        params - comma-separated list of parameter names to search for in the request
        Returns:
        a parameter value from the request, or null if none is found
      • generatePermaLink

        public static java.lang.String generatePermaLink​(FastPathObject obj,
                                                         java.lang.String baseUrl,
                                                         java.util.Map<java.lang.String,​java.util.List<FieldDescriptor>> classKeys)
        Generate a perma-link to a report page for an InterMine object.
        Parameters:
        obj - A Fast-Path Object
        baseUrl - The base url to use
        classKeys - The Class keys for this web-app
        Returns:
        The url
      • generatePermaPath

        public static java.lang.String generatePermaPath​(FastPathObject obj,
                                                         java.util.Map<java.lang.String,​java.util.List<FieldDescriptor>> classKeys)
        Generate a link suitable for use as an external, permanent link, in that the link should work between rebuilds of the database.
        Parameters:
        obj - The object to link to.
        classKeys - The class-key configuration for determining which fields to use for identification.
        Returns:
        A path, beginning with "/" suitable for appending to a base url.
      • generateReportLink

        public static java.lang.String generateReportLink​(ResultElement elem,
                                                          java.lang.String baseUrl)
        Generate a link to the object details page using the internal id. This does not produce a link suitable for use as a permalink.
        Parameters:
        elem - a result element
        baseUrl - The base URL to use to create the link.
        Returns:
        The URL.
      • generateReportPath

        public static java.lang.String generateReportPath​(ResultCell elem)
        Get the path fragment (starting with "/") for the report page for an object in the mine.
        Parameters:
        elem - The element containing data related to this object.
        Returns:
        A path fragment suitable for appending to a base URL. The generated path is not suitable for permanent links, as it will include the internal id, which is liable to change between releases.
      • getBaseUrl

        public static java.lang.String getBaseUrl​(javax.servlet.http.HttpServletRequest request)
        Get the base url for this web-app. This includes the host and context path fragment.
        Parameters:
        request - An incoming request.
        Returns:
        The base URL.