Class QueryJoin
java.lang.Object
com.kingsrook.qqq.backend.core.model.actions.tables.query.QueryJoin
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
ImplicitQueryJoinForSecurityLock
Part of query (or count, aggregate) input, to do a Join as part of a query.
Conceptually, when you're adding a QueryJoin to a query, you're adding a new
table to the query - this is named the `joinTable` in this class. This table
can be given an alias, which can be referenced in the rest of the query.
Every joinTable needs to have a `baseTable` that it is "joined" with - e.g.,
the table that the joinOn clauses link up with.
However - the caller doesn't necessarily need to specify the `baseTable` -
as the framework will look for Joins defined in the qInstance, and if an
unambiguous one is found (between the joinTable and other tables in the
query), then it'll use the "other" table in that Join as the baseTable.
For use-cases where a baseTable has been included in a query multiple times,
with aliases, then the baseTableOrAlias field must be set to the appropriate alias.
If there are multiple Joins defined between the base invalid input: '&' join tables, then the
specific joinMetaData to use must be set. The joinMetaData field can also be
used instead of specify joinTable and baseTableOrAlias, but only for cases
where the baseTable is not an alias.
The securityCriteria member, in general, is meant to be populated when a
JoinsContext is constructed before executing a query, and not meant to be set
by users.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
define the types of joins - INNER, LEFT, RIGHT, or FULL. -
Constructor Summary
ConstructorsConstructorDescriptionConstructorQueryJoin
(QJoinMetaData joinMetaData) Constructor that takes a joinMetaData - the rightTable in the joinMetaData will be used as the joinTable.Constructor that only takes a joinTable.Constructor that takes baseTableOrAlias and joinTable. -
Method Summary
Modifier and TypeMethodDescriptionclone()
getAlias()
Getter for aliasGetter for baseTableOrAliasGetter for joinMetaDataGetter for joinTableGetter for securityCriteriaboolean
Getter for selectgetType()
Getter for typevoid
Setter for aliasvoid
setBaseTableOrAlias
(String baseTableOrAlias) Setter for baseTableOrAliasvoid
setJoinMetaData
(QJoinMetaData joinMetaData) Setter for joinMetaDatavoid
setJoinTable
(String joinTable) Setter for joinTablevoid
setSecurityCriteria
(List<QFilterCriteria> securityCriteria) Setter for securityCriteriavoid
setSelect
(boolean select) Setter for selectvoid
setType
(QueryJoin.Type type) Setter for typetoString()
Fluent setter for aliaswithBaseTableOrAlias
(String baseTableOrAlias) Fluent setter for baseTableOrAliaswithJoinMetaData
(QJoinMetaData joinMetaData) Fluent setter for joinMetaDatawithJoinTable
(String joinTable) Fluent setter for joinTablewithSecurityCriteria
(QFilterCriteria securityCriteria) Fluent setter for securityCriteriawithSecurityCriteria
(List<QFilterCriteria> securityCriteria) Fluent setter for securityCriteriawithSelect
(boolean select) Fluent setter for selectwithType
(QueryJoin.Type type) Fluent setter for type
-
Constructor Details
-
QueryJoin
public QueryJoin()Constructor -
QueryJoin
Constructor that only takes a joinTable. Unless you also set the baseTableOrAlias, the framework will attempt to ascertain the baseTableOrAlias, based on Joins defined in the instance and other tables in the query. -
QueryJoin
Constructor that takes baseTableOrAlias and joinTable. Useful if it's not explicitly clear what the base table should be just from the joinTable. e.g., if the baseTable has an alias, or if there's more than 1 join in the instance that matches the joinTable and the other tables in the query. -
QueryJoin
Constructor that takes a joinMetaData - the rightTable in the joinMetaData will be used as the joinTable. The leftTable in the joinMetaData will be used as the baseTable. This is probably (only?) what you want to use if you have a table that joins more than once to another table (e.g., order.shipToCustomerId and order.billToCustomerId). Alternatively, you could just do new QueryJoin("customer").withJoinMetaData("orderJoinShipToCustomer").
-
-
Method Details
-
clone
-
getBaseTableOrAlias
Getter for baseTableOrAlias -
setBaseTableOrAlias
Setter for baseTableOrAlias -
withBaseTableOrAlias
-
getJoinTable
Getter for joinTable -
setJoinTable
Setter for joinTable -
withJoinTable
-
getAlias
Getter for alias -
setAlias
Setter for alias -
withAlias
-
getSelect
public boolean getSelect()Getter for select -
setSelect
public void setSelect(boolean select) Setter for select -
withSelect
Fluent setter for select -
getJoinTableOrItsAlias
-
getType
Getter for type -
setType
Setter for type -
withType
Fluent setter for type -
getJoinMetaData
Getter for joinMetaData -
setJoinMetaData
Setter for joinMetaData -
withJoinMetaData
Fluent setter for joinMetaData -
getSecurityCriteria
Getter for securityCriteria -
setSecurityCriteria
Setter for securityCriteria -
withSecurityCriteria
Fluent setter for securityCriteria -
withSecurityCriteria
Fluent setter for securityCriteria -
toString
-