Package net.sf.basedb.core.query
Class AnyToAnyRestriction
java.lang.Object
net.sf.basedb.core.query.AnyToAnyRestriction
- All Implemented Interfaces:
QueryElement
,Restriction
Expression that can be used to filter on the existence or non-existence
of a named any-to-any link.
- Since:
- 3.6
- Author:
- nicklas
-
Field Summary
Modifier and TypeFieldDescriptionprivate final String
private final boolean
private final EntityQuery
private final Restriction
private final Item
private final String
private String
-
Constructor Summary
ModifierConstructorDescriptionprivate
AnyToAnyRestriction
(String alias, String linkName, Item linkedTo, boolean hasLink, EntityQuery linkedQuery) -
Method Summary
Modifier and TypeMethodDescriptionboolean
This expression is equal to another AnyToAnyRestriction if their named link, 'hasLink' and subquery restriction are the same.static AnyToAnyRestriction
exists
(String alias, String linkName, Item linkedTo, EntityQuery linkedQuery) Create a restriction that restrict a query to return items that has a linked item with the given link name.Collection<? extends QueryElement>
Get the children of this query element or null if it has no children.int
hashCode()
static AnyToAnyRestriction
missing
(String alias, String linkName, Item linkedTo, EntityQuery linkedQuery) Create a restriction that restrict a query to return items that is missing a linked item with the given link name.Create a query language string of the query element.toString()
-
Field Details
-
alias
-
linkName
-
linkedTo
-
hasLink
private final boolean hasLink -
linkedQuery
-
linkedRestriction
-
parameterName
-
-
Constructor Details
-
AnyToAnyRestriction
private AnyToAnyRestriction(String alias, String linkName, Item linkedTo, boolean hasLink, EntityQuery linkedQuery)
-
-
Method Details
-
exists
public static AnyToAnyRestriction exists(String alias, String linkName, Item linkedTo, EntityQuery linkedQuery) Create a restriction that restrict a query to return items that has a linked item with the given link name.- Parameters:
alias
- Alias to resolve the link against, use null to resolve the link agains the root entitylinkName
- The name of the link (required)linkedTo
- The type of the linked item (optional)linkedQuery
- An optional query that the linked items must match
-
missing
public static AnyToAnyRestriction missing(String alias, String linkName, Item linkedTo, EntityQuery linkedQuery) Create a restriction that restrict a query to return items that is missing a linked item with the given link name.- Parameters:
alias
- Alias to resolve the link against, use null to resolve the link agains the root entitylinkName
- The name of the link (required)linkedTo
- The type of the linked item (optional)linkedQuery
- An optional query that the linked items must not match
-
toQl
Description copied from interface:QueryElement
Create a query language string of the query element. Use theQuery.getQueryType()
method to find out which query language is wanted in case the element requires different syntax for different languages.- Specified by:
toQl
in interfaceQueryElement
- Parameters:
query
- The query that is about to be executeddc
- TheDbControl
object used to execute the query
-
getChildren
Description copied from interface:QueryElement
Get the children of this query element or null if it has no children. For example theAddExpression
has two children, the expression beeing added.- Specified by:
getChildren
in interfaceQueryElement
- Returns:
- A collection or null
-
toString
-
equals
This expression is equal to another AnyToAnyRestriction if their named link, 'hasLink' and subquery restriction are the same. -
hashCode
public int hashCode()
-