Introduce ConstraintCheckPlan class

Authored by Lucas_Werkmeister_WMDE on Aug 29 2017, 5:21 PM.

Description

Introduce ConstraintCheckPlan class

This class holds a plan of constraint checks that the
DelegatingConstraintChecker should run. Later commits can add features
to optimize the plan.

This is intended as a pure refactoring for now, but it does cause a
minor functional change: previously, exceptions were handled in
checkConstraintsForMainSnak but not in the -Qualifiers and -References
methods, whereas now they are centrally handled in
ConstraintCheckPlan::run(). I believe the previous behavior of not
supporting exceptions on qualifier and reference constraint checks was
an accident (I can neither recall nor find any decision on this), and
the new behavior of supporting them is more desirable.

Another thing we can do in later commits is to change the
DelegatingConstraintChecker interface so that API requests checking
multiple entities and/or statements at once can use a single plan,
possibly deduplicating constraint checks across several of these
requests. For now, we just stick with the old interface, and create a
new plan for each call to checkAgainstConstraintsOn*().

Bug: T180796
Change-Id: Idfcbacfbce1780d5dbc7723dfd027be742098b16