Use Prolog Cafe for ChangeControl.canSubmit()

Re-implement the canSubmit() logic in Prolog, removing one of the
last uses of FunctionState.  This is a simple re-implementation
that does not provide any new functionality.

PatchSetApproval objects are exposed into Prolog on demand by
loading them from the database if the submit predicate needs
them. These get indexed in a temporary HashMap by their label name
(aka ApprovalCategory), making access faster during evaluation of
the rule.

ApprovalTypes are loaded into Prolog on demand from the Guice
Injector.  This will eventually go away when we get rid of the
global declaration of ApprovalCategories in the web UI.

CurrentUser instances are loaded and cached within the Prolog
environment as needed to consider PatchSetApproval objects and if
the user has the necessary permission to make that assertion.

Bug: 971
Change-Id: I7e261948db08b7c3180e590e81f492ff3e6f237e
Signed-off-by: Shawn O. Pearce <sop@google.com>
20 files changed