DERBY-6362: CHECK constraint uses wrong schema for unqualified routine invocations

Part 3:

- Refactor code that rewrites trigger actions so that it can be reused
  for rewriting CHECK constraints.

- Rewrite CHECK constraints and make all identifiers schema qualified
  before storing them in the dictionary.

- Make the parser preserve the TableName node for the target type in
  CAST expressions for user-defined types, so that they get detected
  by the rewrite logic.

git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1548132 13f79535-47bb-0310-9956-ffa450edef68