Class QueryJoin

java.lang.Object
com.kingsrook.qqq.backend.core.model.actions.tables.query.QueryJoin
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
ImplicitQueryJoinForSecurityLock

public class QueryJoin extends Object implements Cloneable
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.
  • Constructor Details

    • QueryJoin

      public QueryJoin()
      Constructor
    • QueryJoin

      public QueryJoin(String joinTable)
      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

      public QueryJoin(String baseTableOrAlias, String joinTable)
      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

      public QueryJoin(QJoinMetaData joinMetaData)
      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

      public QueryJoin clone()
      Overrides:
      clone in class Object
    • getBaseTableOrAlias

      public String getBaseTableOrAlias()
      Getter for baseTableOrAlias
    • setBaseTableOrAlias

      public void setBaseTableOrAlias(String baseTableOrAlias)
      Setter for baseTableOrAlias
    • withBaseTableOrAlias

      public QueryJoin withBaseTableOrAlias(String baseTableOrAlias)
      Fluent setter for baseTableOrAlias
    • getJoinTable

      public String getJoinTable()
      Getter for joinTable
    • setJoinTable

      public void setJoinTable(String joinTable)
      Setter for joinTable
    • withJoinTable

      public QueryJoin withJoinTable(String joinTable)
      Fluent setter for joinTable
    • getAlias

      public String getAlias()
      Getter for alias
    • setAlias

      public void setAlias(String alias)
      Setter for alias
    • withAlias

      public QueryJoin withAlias(String alias)
      Fluent setter for alias
    • getSelect

      public boolean getSelect()
      Getter for select
    • setSelect

      public void setSelect(boolean select)
      Setter for select
    • withSelect

      public QueryJoin withSelect(boolean select)
      Fluent setter for select
    • getJoinTableOrItsAlias

      public String getJoinTableOrItsAlias()
    • getType

      public QueryJoin.Type getType()
      Getter for type
    • setType

      public void setType(QueryJoin.Type type)
      Setter for type
    • withType

      public QueryJoin withType(QueryJoin.Type type)
      Fluent setter for type
    • getJoinMetaData

      public QJoinMetaData getJoinMetaData()
      Getter for joinMetaData
    • setJoinMetaData

      public void setJoinMetaData(QJoinMetaData joinMetaData)
      Setter for joinMetaData
    • withJoinMetaData

      public QueryJoin withJoinMetaData(QJoinMetaData joinMetaData)
      Fluent setter for joinMetaData
    • getSecurityCriteria

      public List<QFilterCriteria> getSecurityCriteria()
      Getter for securityCriteria
    • setSecurityCriteria

      public void setSecurityCriteria(List<QFilterCriteria> securityCriteria)
      Setter for securityCriteria
    • withSecurityCriteria

      public QueryJoin withSecurityCriteria(List<QFilterCriteria> securityCriteria)
      Fluent setter for securityCriteria
    • withSecurityCriteria

      public QueryJoin withSecurityCriteria(QFilterCriteria securityCriteria)
      Fluent setter for securityCriteria
    • toString

      public String toString()
      Overrides:
      toString in class Object