## org.eclipse.datatools.sqltools.parsers.sql.query.postparse
Class RoutineReferenceResolver

    java.lang.Object
      org.eclipse.datatools.sqltools.parsers.sql.query.postparse.RoutineReferenceResolver

All Implemented Interfaces:
  PostParseProcessor

    public class RoutineReferenceResolver

extends java.lang.Object
implements PostParseProcessor

This class resolves and validates references to a SQL model stored procedure in a CALL statement during the post-parse processing (semantic processing) phase of parsing.

Constructor Summary
`RoutineReferenceResolver()` Constructs an instance of this class.
`RoutineReferenceResolver(Database database)` Constructs an instance of this class with the given SQL model database object.
`RoutineReferenceResolver(Database database, java.lang.String defaultSchemaName)` Constructs an instance of this class using the given database and default schema name.

Method Summary
`void` `config(PostParseProcessorConfiguration config)` Configures this post-parse process with the Database object and default schema name contained in the given configuration object.
`Database` `getDatabase()` Gets the current SQL model Database object.
`java.lang.String` `getDefaultSchemaName()` Gets the current default schema name.
`java.util.Map` `getParsedObjectsReplacementMap()` Returns a Map containing parsed `SQLQueryObject`s mapped to either the `SQLQueryObject` that replaces it, or is mapped to `null`, if that parsed object simply is to be removed.
`java.lang.Class[]` `getProcessCandidateTypes()` Gets a list of classes that this processor is interested in.
`java.util.List` `process(SQLQueryObject queryObj)` Post-parse processes the given SQL query object.
`void` `resetState()` If this `PostParseProcessor` is stateful within the context of one `QueryStatement`, this method should reset the state, as it might be used for post parse processing of more than one `QueryStatement`.
`void` `setDatabase(Database database)` Sets the SQL model Database object to use to find object references.
`void` `setDefaultSchemaName(java.lang.String defaultSchemaName)` Sets the default schema name to use to find SQL model object references.

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

Constructor Detail

### RoutineReferenceResolver

    public RoutineReferenceResolver()

  Constructs an instance of this class. This is the default constructor. Note: instances of this class should normally be constructed using the `RoutineReferenceResolver(Database, String)` constructor in order to provide SQL model information for validation.

### RoutineReferenceResolver

    public RoutineReferenceResolver(Database database)

  Constructs an instance of this class with the given SQL model database object. Note: instances of this class should normally be constructed using the `RoutineReferenceResolver(Database, String)` constructor in order to provide SQL model information for validation.

### RoutineReferenceResolver

    public RoutineReferenceResolver(Database database,
                                    java.lang.String defaultSchemaName)

  Constructs an instance of this class using the given database and default schema name.

  Parameters:
    `aDB` - the SQL model Database object to use to locate objects
    `aDefaultSchemaName` - the default schema name to use to locate objects

Method Detail

### getDatabase

    public Database getDatabase()

  Gets the current SQL model Database object.

  Returns:
    Returns the database.

### setDatabase

    public void setDatabase(Database database)

  Sets the SQL model Database object to use to find object references.

  Parameters:
    `database` - the SQL model Database to use

### getDefaultSchemaName

    public java.lang.String getDefaultSchemaName()

  Gets the current default schema name.

  Returns:
    the default schema name to use to find SQL model object references

### setDefaultSchemaName

    public void setDefaultSchemaName(java.lang.String defaultSchemaName)

  Sets the default schema name to use to find SQL model object references.

  Parameters:
    `defaultSchemaName` - the default schema name to use

### getProcessCandidateTypes

    public java.lang.Class[] getProcessCandidateTypes()

  Gets a list of classes that this processor is interested in.

  Specified by:
    `getProcessCandidateTypes` in interface `PostParseProcessor`
  Returns:
    an array of Class objects
  See Also:
    `org.eclipse.datatools.sqltools.parsers.sql.query.postparse.PostParseProcessor#getProcessCandidateTypes()`

### config

    public void config(PostParseProcessorConfiguration config)

  Configures this post-parse process with the Database object and default schema name contained in the given configuration object.

  Specified by:
    `config` in interface `PostParseProcessor`
  Parameters:
    `config` - the configuration object to use

### process

    public java.util.List process(SQLQueryObject queryObj)
                           throws SQLParserException

  Post-parse processes the given SQL query object.

  Specified by:
    `process` in interface `PostParseProcessor`
  Parameters:
    `queryObj` - the SQL Query object to process
  Returns:
    List of `SQLParseErrorInfo` objects, with information about the error encountered, must not be `null`
  Throws:
    `SQLParserException` - when the given object fails validation

### getParsedObjectsReplacementMap

    public java.util.Map getParsedObjectsReplacementMap()

  Description copied from interface: `PostParseProcessor`
  Returns a Map containing parsed `SQLQueryObject`s mapped to either the `SQLQueryObject` that replaces it, or is mapped to `null`, if that parsed object simply is to be removed. This method will be invoked after this `PostParseProcessor` is done processing one `QueryStatement` before the `PostParseProcessor.resetState()` method is called. This method should return a mapping, if during the post parse processing `SQLQueryObject`s are found that are determined to have been created by the parser mistakenly, because the parser did not have the knowledge about context or semantics. This then `PostParseProcessor` might create a substitution for it or simply delete it by mapping the original `SQLQueryObject` to `null`. By providing this mapping, invalid `SQLQueryObject`s can be removed from the parser's parsed-element-list and therefore will not be subject to further post parse processing of other `PostParseProcessor`s.
  - key: `SQLQueryObject` originally created by parser
  - value: `SQLQueryObject` created by this `PostParseProcessor` to substitute the originally created by the parser

  Specified by:
    `getParsedObjectsReplacementMap` in interface `PostParseProcessor`
  Returns:
    Map containing parsed `SQLQueryObject`s mapped to either the `SQLQueryObject` that replaces it to `null`, if that parsed object simply is to be removed

### resetState

    public void resetState()

  Description copied from interface: `PostParseProcessor`
  If this `PostParseProcessor` is stateful within the context of one `QueryStatement`, this method should reset the state, as it might be used for post parse processing of more than one `QueryStatement`. This method is invoked after the `SQLParserManager` bottom-up processed the `SQLQueryObject` elements of a `QueryStatement` up to the top/root-element - the `QueryStatement` object itself.

  Specified by:
    `resetState` in interface `PostParseProcessor`
  See Also:
    `org.eclipse.datatools.sqltools.parsers.sql.query.postparse.PostParseProcessor#resetState()`