abstract class AnnotationRestriction extends Object implements Restriction
getRestrictionSql(Query, DbControl)
and setRestrictionParameters(SQLQuery)
method.Annotations
Modifier and Type | Field and Description |
---|---|
(package private) String |
alias |
(package private) int |
annotationTypeId |
private static boolean |
debugSqlEnabled
So we don't always have to call logSql.debug()
|
(package private) boolean |
includeInheriting |
(package private) boolean |
includePrimary |
private static org.slf4j.Logger |
logSql
Log all SQL statements.
|
(package private) Type |
valueType |
Constructor and Description |
---|
AnnotationRestriction(String alias,
AnnotationType annotationType,
boolean includePrimary,
boolean includeInheriting)
Create a new annotation restriction for an annotation type.
|
AnnotationRestriction(String alias,
int annotationTypeId,
Type valueType,
boolean includePrimary,
boolean includeInheriting)
Create a new annotation restriction given the id and value type of
an annotation.
|
Modifier and Type | Method and Description |
---|---|
Collection<? extends QueryElement> |
getChildren()
Get the children of this query element or null if it has no children.
|
(package private) abstract String |
getRestrictionSql(Query query,
DbControl dc)
Get an SQL fragment that includes the actual restriction.
|
int |
hashCode() |
protected Boolean |
maybeEquals(Object other)
Check as many things as possible to try to determine if the other
object is equal to this object.
|
(package private) boolean |
notAmongSelected()
If the main restriction should match items that had annotations
among the selected annotation sets, or not.
|
(package private) abstract void |
setRestrictionParameters(SQLQuery query)
Set the value for all parameters defined in the SQL fragment
returned by
getRestrictionSql(Query, DbControl) . |
String |
toQl(Query query,
DbControl dc)
Create a query language string of the query element.
|
private static final org.slf4j.Logger logSql
private static final boolean debugSqlEnabled
final Type valueType
final int annotationTypeId
final boolean includePrimary
final boolean includeInheriting
final String alias
AnnotationRestriction(String alias, AnnotationType annotationType, boolean includePrimary, boolean includeInheriting) throws InvalidDataException
annotationType
- The annotation type to use in the queryInvalidDataException
AnnotationRestriction(String alias, int annotationTypeId, Type valueType, boolean includePrimary, boolean includeInheriting) throws InvalidDataException
annotationTypeId
- The id of the annotation typevalueType
- The type of values for annotationsInvalidDataException
public String toQl(Query query, DbControl dc) throws BaseException
QueryElement
Query.getQueryType()
method to find out which query language is wanted
in case the element requires different syntax for different languages.toQl
in interface QueryElement
query
- The query that is about to be executeddc
- The DbControl
object used to execute the queryBaseException
- If there is any other errorpublic Collection<? extends QueryElement> getChildren()
QueryElement
AddExpression
has two children, the expression
beeing added.getChildren
in interface QueryElement
protected Boolean maybeEquals(Object other)
abstract String getRestrictionSql(Query query, DbControl dc) throws BaseException
v.value = :theValue
The setRestrictionParameters
method is called to
allow the subclass to set the value of the parameters specified
in the SQL fragment.
query
- The query object we are about to executeBaseException
setRestrictionParameters(SQLQuery)
abstract void setRestrictionParameters(SQLQuery query)
getRestrictionSql(Query, DbControl)
.query
- The Hibernate SQLQuery
object which is
used to query the databaseboolean notAmongSelected()