Class DatabaseQueryBuilder

java.lang.Object
net.tirasa.connid.commons.db.DatabaseQueryBuilder

public class DatabaseQueryBuilder extends Object
The Database Query builder creates the database query.

The main functionality of this helper class is create SQL query statement with bundled object references

Since:
1.0
Version:
$Revision 1.0$
  • Constructor Details

    • DatabaseQueryBuilder

      public DatabaseQueryBuilder(String tableName, Set<String> columns)
      DatabaseQuery Constructor, construct selectFrom from table name, columns and where clause
      Parameters:
      tableName - The name of the database table to selectFrom from
      columns - the names of the column to be in the result
    • DatabaseQueryBuilder

      public DatabaseQueryBuilder(String selectFrom)
      DatabaseQuery Constructor which takes advantage of prepared selectFrom SQL clause
      Parameters:
      selectFrom - mandatory selectFrom clause
  • Method Details

    • setColumns

      public void setColumns(Set<String> columns)
      Set the columnNames to get
      Parameters:
      columns - the required columns in SQL query
    • setSelectFrom

      public void setSelectFrom(String selectFrom)
      Set selectFrom and from clause
      Parameters:
      selectFrom - the selectFrom part including the from table
    • setTableName

      public void setTableName(String tableName)
      Set the table name
      Parameters:
      tableName - name of the table
    • setWhere

      public void setWhere(FilterWhereBuilder whereBuilder)
      set the where builder
      Parameters:
      whereBuilder - FilterWhereBuilder the where filer builder
    • setOrderBy

      public void setOrderBy(List<DatabaseQueryBuilder.OrderBy> orderBy)
      sET THE ORDER BY CLAUSE
      Parameters:
      orderBy - a list of Pair pair as colunName and sort order
    • getSQL

      public String getSQL()
      Return full sql statement string
      Returns:
      Sql query statement to execute
    • getParams

      public List<SQLParam> getParams()
      Values in wrapped object
      Returns:
      the where values