Package org.intermine.web.logic
Class PortalHelper
- java.lang.Object
-
- org.intermine.web.logic.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.
-
-
-
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 usewebConfig
- the WebConfig to take configuration fromconverterClassName
- 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 inparams
- 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
-
generatePortalLink
public 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. Will return null if there is no non-null value or class key available.- Parameters:
obj
- the object to link toim
- the InterMineApirequest
- the request object- Returns:
- a portal URL to the object or null
- See Also:
generatePermaLink(org.intermine.model.FastPathObject,java.lang.String,java.util.Map<java.lang.String,java.util.List<org.intermine.metadata.FieldDescriptor>>)
-
generatePortalPath
public static java.lang.String generatePortalPath(FastPathObject obj, InterMineAPI im)
Generate an external portal link (perma-link) for an InterMine object.- Parameters:
obj
- The object to link to.im
- The InterMine API configuration bundle.- Returns:
- A path, beginning with "/" suitable for appending to a base URL.
- See Also:
generatePermaPath(org.intermine.model.FastPathObject,java.util.Map<java.lang.String,java.util.List<org.intermine.metadata.FieldDescriptor>>)
-
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 ObjectbaseUrl
- The base url to useclassKeys
- 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 elementbaseUrl
- 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.
-
-