Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha5
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.jcr.query.validate
Class ImmutableSchemata.Builder

    java.lang.Object
      org.modeshape.jcr.query.validate.ImmutableSchemata.Builder

Enclosing class:
  ImmutableSchemata

    @NotThreadSafe
    public static class ImmutableSchemata.Builder

extends Object

A builder of immutable `Schemata` objects.

Constructor Summary
`protected` | `ImmutableSchemata.Builder(ExecutionContext context)`

Method Summary
`ImmutableSchemata.Builder` | `addColumn(String tableName, String columnName, String type)` Add a column with the supplied name and type to the named table.
`ImmutableSchemata.Builder` | `addColumn(String tableName, String columnName, String type, PropertyType requiredType, boolean fullTextSearchable, boolean orderable, Object minimum, Object maximum, Set<Operator> operations)` Add a column with the supplied name and type to the named table.
`ImmutableSchemata.Builder` | `addKey(String tableName, String... columnNames)` Add to the specified table a key that references the existing named columns.
`ImmutableSchemata.Builder` | `addTable(String name, String... columnNames)` Add a table with the supplied name and column names.
`ImmutableSchemata.Builder` | `addTable(String name, String[] columnNames, String[] types)` Add a table with the supplied name and column names and types.
`ImmutableSchemata.Builder` | `addView(String name, QueryCommand definition)` Add a view with the supplied name and definition.
`ImmutableSchemata.Builder` | `addView(String name, String definition)` Add a view with the supplied name and SQL string definition.
`Schemata` | `build()` Build the `Schemata` instance, using the current state of the builder.
`ImmutableSchemata.Builder` | `excludeFromSelectStar(String tableName, String columnName)` Specify that the named column in the given table should be excluded from the selected columns when "SELECT *" is used.
`ImmutableSchemata.Builder` | `makeSearchable(String tableName, String columnName)` Make sure the column on the named table is searchable.
`ImmutableSchemata.Builder` | `markExtraColumns(String tableName)` Make sure the column on the named table has extra columns that can be used without validation error.
`ImmutableSchemata.Builder` | `markOperators(String tableName, String columnName, Set<Operator> operators)` Record the operators that are allowed for the named column on the named table.
`ImmutableSchemata.Builder` | `markOrderable(String tableName, String columnName, boolean orderable)` Record whether the column on the named table should be orderable.
`protected Set<Operator>` | `operators(SelectorName tableName, String columnName, Set<Operator> defaultOperators)`
`protected boolean` | `orderable(SelectorName tableName, String columnName, boolean defaultValue)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ImmutableSchemata.Builder

    protected ImmutableSchemata.Builder(ExecutionContext context)

Method Detail

### addTable

    public ImmutableSchemata.Builder addTable(String name,
                                              String... columnNames)

  Add a table with the supplied name and column names. Each column will be given a default type. The table will also overwrite any existing table definition with the same name.

  Parameters:
    `name` - the name of the new table
    `columnNames` - the names of the columns.
  Returns:
    this builder, for convenience in method chaining; never null
  Throws:
    `IllegalArgumentException` - if the table name is null or empty, any column name is null or empty, or if no column names are given

### addTable

    public ImmutableSchemata.Builder addTable(String name,
                                              String[] columnNames,
                                              String[] types)

  Add a table with the supplied name and column names and types. The table will also overwrite any existing table definition with the same name.

  Parameters:
    `name` - the name of the new table
    `columnNames` - the names of the columns
    `types` - the types for the columns
  Returns:
    this builder, for convenience in method chaining; never null
  Throws:
    `IllegalArgumentException` - if the table name is null or empty, any column name is null or empty, if no column names are given, or if the number of types does not match the number of columns

### addView

    public ImmutableSchemata.Builder addView(String name,
                                             String definition)

  Add a view with the supplied name and SQL string definition. The column names and types will be inferred from the source table(s) and views(s) used in the definition.

  Parameters:
    `name` - the name of the new view
    `definition` - the SQL definition of the view
  Returns:
    this builder, for convenience in method chaining; never null
  Throws:
    `IllegalArgumentException` - if the view name is null or empty or the definition is null
    `ParsingException` - if the supplied definition is cannot be parsed as a SQL query

### addView

    public ImmutableSchemata.Builder addView(String name,
                                             QueryCommand definition)

  Add a view with the supplied name and definition. The column names and types will be inferred from the source table(s) used in the definition.

  Parameters:
    `name` - the name of the new view
    `definition` - the definition of the view
  Returns:
    this builder, for convenience in method chaining; never null
  Throws:
    `IllegalArgumentException` - if the view name is null or empty or the definition is null

### addColumn

    public ImmutableSchemata.Builder addColumn(String tableName,
                                               String columnName,
                                               String type)

  Add a column with the supplied name and type to the named table. Any existing column with that name will be replaced with the new column. If the table does not yet exist, it will be added.

  Parameters:
    `tableName` - the name of the new table
    `columnName` - the names of the column
    `type` - the type for the column
  Returns:
    this builder, for convenience in method chaining; never null
  Throws:
    `IllegalArgumentException` - if the table name is null or empty, any column name is null or empty, if no column names are given, or if the number of types does not match the number of columns

### addColumn

    public ImmutableSchemata.Builder addColumn(String tableName,
                                               String columnName,
                                               String type,
                                               PropertyType requiredType,
                                               boolean fullTextSearchable,
                                               boolean orderable,
                                               Object minimum,
                                               Object maximum,
                                               Set<Operator> operations)

  Add a column with the supplied name and type to the named table. Any existing column with that name will be replaced with the new column. If the table does not yet exist, it will be added.

  Parameters:
    `tableName` - the name of the new table
    `columnName` - the names of the column
    `type` - the type for the column
    `requiredType` - the requiredType for the column; never null
    `fullTextSearchable` - true if the column should be full-text searchable, or false if not
    `orderable` - true if the column can be used in order clauses, or false if not
    `minimum` - the minimum value for the column; may be null
    `maximum` - the maximum value for the column; may be null
    `operations` - the set operations that can be applied to this column within comparisons; may be empty or null if all operations apply
  Returns:
    this builder, for convenience in method chaining; never null
  Throws:
    `IllegalArgumentException` - if the table name is null or empty, the column name is null or empty, or if the property type is null

### makeSearchable

    public ImmutableSchemata.Builder makeSearchable(String tableName,
                                                    String columnName)

  Make sure the column on the named table is searchable.

  Parameters:
    `tableName` - the name of the new table
    `columnName` - the names of the column
  Returns:
    this builder, for convenience in method chaining; never null
  Throws:
    `IllegalArgumentException` - if the table name is null or empty or if the column name is null or empty

### markOrderable

    public ImmutableSchemata.Builder markOrderable(String tableName,
                                                   String columnName,
                                                   boolean orderable)

  Record whether the column on the named table should be orderable.

  Parameters:
    `tableName` - the name of the new table
    `columnName` - the names of the column
    `orderable` - true if the column should be orderable, or false otherwise
  Returns:
    this builder, for convenience in method chaining; never null

### orderable

    protected boolean orderable(SelectorName tableName,
                                String columnName,
                                boolean defaultValue)

### markOperators

    public ImmutableSchemata.Builder markOperators(String tableName,
                                                   String columnName,
                                                   Set<Operator> operators)

  Record the operators that are allowed for the named column on the named table.

  Parameters:
    `tableName` - the name of the new table
    `columnName` - the names of the column
    `operators` - the set of operators, or null or empty if the default operators should be used
  Returns:
    this builder, for convenience in method chaining; never null

### operators

    protected Set<Operator> operators(SelectorName tableName,
                                      String columnName,
                                      Set<Operator> defaultOperators)

### markExtraColumns

    public ImmutableSchemata.Builder markExtraColumns(String tableName)

  Make sure the column on the named table has extra columns that can be used without validation error.

  Parameters:
    `tableName` - the name of the table
  Returns:
    this builder, for convenience in method chaining; never null
  Throws:
    `IllegalArgumentException` - if the table name is null or empty, or the table does not exist

### excludeFromSelectStar

    public ImmutableSchemata.Builder excludeFromSelectStar(String tableName,
                                                           String columnName)

  Specify that the named column in the given table should be excluded from the selected columns when "SELECT *" is used.

  Parameters:
    `tableName` - the name of the new table
    `columnName` - the names of the column
  Returns:
    this builder, for convenience in method chaining; never null
  Throws:
    `IllegalArgumentException` - if the table name is null or empty or if the column name is null or empty

### addKey

    public ImmutableSchemata.Builder addKey(String tableName,
                                            String... columnNames)

  Add to the specified table a key that references the existing named columns.

  Parameters:
    `tableName` - the name of the new table
    `columnNames` - the names of the (existing) columns that make up the key
  Returns:
    this builder, for convenience in method chaining; never null
  Throws:
    `IllegalArgumentException` - if the table name is null or empty, the array of column names is null or empty, or if the column names do not reference existing columns in the table

### build

    public Schemata build()

  Build the `Schemata` instance, using the current state of the builder. This method creates a snapshot of the tables (with their columns) as they exist at the moment this method is called.

  Returns:
    the new Schemata; never null
  Throws:
    `InvalidQueryException` - if any of the view definitions is invalid and cannot be resolved

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha5
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.