Class PathQueryResultHelper
- java.lang.Object
-
- org.intermine.web.logic.pathqueryresult.PathQueryResultHelper
-
public final class PathQueryResultHelper extends java.lang.Object
Helper for everything related to PathQueryResults- Author:
- Xavier Watkins
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<java.lang.String>
getAliasedColumnHeaders(PathQuery pq, WebConfig webConfig)
Get the view for a path query reformatted to obey the labels given in webconfig.static java.util.List<java.lang.String>
getDefaultViewForClass(java.lang.String type, Model model, WebConfig webConfig)
Return a list of string paths that are defined as WebConfig to be shown in results.static java.util.List<java.lang.String>
getDefaultViewForClass(java.lang.String type, Model model, WebConfig webConfig, java.lang.String startingPath)
Return a list of string paths that are defined as WebConfig to be shown in results.protected static PathQuery
getQueryWithDefaultView(java.lang.String objType, Model model, WebConfig webConfig, java.lang.String fieldType)
Used for making a query for a reference or collection.static PathQuery
makePathQueryForBag(InterMineBag imBag, WebConfig webConfig, Model model)
Create a PathQuery to get the contents of an InterMineBagstatic PathQuery
makePathQueryForCollection(WebConfig webConfig, ObjectStore os, InterMineObject object, java.lang.String referencedClassName, java.lang.String field)
Create a PathQuery to get results for a collection of items from an InterMineObjectstatic java.util.List<java.lang.Class<?>>
queryForTypesInCollection(InterMineObject object, java.lang.String field, ObjectStore os)
Search for the classes in a collection for a given InterMineObject, for example find all of the sub-classes of Employee in the Department.employees collection of a given Department.
-
-
-
Method Detail
-
getDefaultViewForClass
public static java.util.List<java.lang.String> getDefaultViewForClass(java.lang.String type, Model model, WebConfig webConfig, java.lang.String startingPath)
Return a list of string paths that are defined as WebConfig to be shown in results. This will include only attributes of the given class and not follow references. Optionally provide a prefix to for creating a view for references/collections.- Parameters:
type
- the class name to create a view formodel
- the modelwebConfig
- we configurationstartingPath
- a path to prefix the class, can be null- Returns:
- the configured view paths for the class
-
getDefaultViewForClass
public static java.util.List<java.lang.String> getDefaultViewForClass(java.lang.String type, Model model, WebConfig webConfig)
Return a list of string paths that are defined as WebConfig to be shown in results. This will include attributes of the given class and follow references.- Parameters:
type
- the class name to create a view formodel
- the modelwebConfig
- we configuration- Returns:
- the configured view paths for the class
-
makePathQueryForBag
public static PathQuery makePathQueryForBag(InterMineBag imBag, WebConfig webConfig, Model model)
Create a PathQuery to get the contents of an InterMineBag- Parameters:
imBag
- the bagwebConfig
- the WebConfigmodel
- the Model- Returns:
- a PathQuery
-
makePathQueryForCollection
public static PathQuery makePathQueryForCollection(WebConfig webConfig, ObjectStore os, InterMineObject object, java.lang.String referencedClassName, java.lang.String field)
Create a PathQuery to get results for a collection of items from an InterMineObject- Parameters:
webConfig
- the WebConfigos
- the production ObjectStoreobject
- the InterMineObjectreferencedClassName
- the collection typefield
- the name of the field for the collection in the InterMineObject- Returns:
- a PathQuery
-
queryForTypesInCollection
public static java.util.List<java.lang.Class<?>> queryForTypesInCollection(InterMineObject object, java.lang.String field, ObjectStore os)
Search for the classes in a collection for a given InterMineObject, for example find all of the sub-classes of Employee in the Department.employees collection of a given Department. If there are no subclasses or the collection is empty a list with the type of the collection is returned.- Parameters:
object
- an InterMineObject to inspectfield
- the name if the collection to checkos
- the ObjectStore in which to execute the query- Returns:
- a list of classes in the collection
-
getQueryWithDefaultView
protected static PathQuery getQueryWithDefaultView(java.lang.String objType, Model model, WebConfig webConfig, java.lang.String fieldType)
Used for making a query for a reference or collection. Only used when a user clicks on [show all] under an inline table on an Object's report page. The type of that object is "startingPath", eg. Department. This path will be prepended to every path in the query. The "type" is the type of the reference/collection, eg. Employee. TODO use getDefaultViewForClass() instead- Parameters:
objType
- class of object we are querying for eg. Managermodel
- the modelwebConfig
- the webconfigfieldType
- the type of the field this object is in, eg Employee- Returns:
- query, eg. Department.employees.name
-
getAliasedColumnHeaders
public static java.util.List<java.lang.String> getAliasedColumnHeaders(PathQuery pq, WebConfig webConfig)
Get the view for a path query reformatted to obey the labels given in webconfig. So if Employee has the alias "Arbeitnehmer", department the alias "Abteilung", then Employee.department.name would become "Arbeitnehmer > Abteilung > Name". Also, camel-cased names will be decamelised, so "Contractor.oldCompanys.vatNumber" would become "Contractor > Old Companys > Vat Number". ("VAT Number" can be achieved if that field is labelled as such).- Parameters:
pq
- The pathquery whose views to get.webConfig
- The Web-Configuration- Returns:
- A transformed list of strings.
-
-