Package ubic.gemma.persistence.util
Class FilterQueryUtils
java.lang.Object
ubic.gemma.persistence.util.FilterQueryUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addRestrictionParameters
(Query query, Filters filters) Adds all parameters contained in the filters argument to the query by callingQuery.setParameter(String, Object)
orQuery.setParameterList(String, Collection)
as needed.static String
formOrderByClause
(Sort sort) Forms an order by clause for a Hibernate query based on given arguments.static String
formRestrictionClause
(Filters filters) Creates a CNF restriction clause from the given Filters list.
-
Constructor Details
-
FilterQueryUtils
public FilterQueryUtils()
-
-
Method Details
-
formOrderByClause
Forms an order by clause for a Hibernate query based on given arguments.- Parameters:
sort
- the property and direction the query should be ordered by.- Returns:
- an order by clause. Empty string if the orderByProperty argument is null or empty.
-
formRestrictionClause
Creates a CNF restriction clause from the given Filters list. FIXME The problem with this: it assumes the join is already there.- Parameters:
filters
- A list of filtering properties arrays. Elements in each array will be in a disjunction (OR) with each other. Arrays will then be in a conjunction (AND) with each other. I.e. The filter will be in a conjunctive normal form.[0 OR 1 OR 2] AND [0 OR 1] AND [0 OR 1 OR 3]
- Returns:
- a string containing the clause, without the leading "WHERE" keyword.
-
addRestrictionParameters
Adds all parameters contained in the filters argument to the query by callingQuery.setParameter(String, Object)
orQuery.setParameterList(String, Collection)
as needed.Use this if you've appended
formRestrictionClause(Filters)
to the query so that the provided filters will be bound.If the
invalid reference
Filter#getRequiredValue()
Collection
, it will be sorted and duplicates will be excluded.- Parameters:
query
- the query that needs parameters populated.filters
- filters that provide the parameter values.
-