Add SQL searching to RdapEntitySearchAction and RdapSearchActionBase (#969)

- Adds a CriteriaQueryBuilder class that allows us to build
CriteriaQuery objects with sane and modular WHERE and ORDER BY clauses.
CriteriaQuery requires that all WHERE and ORDER BY clauses be specified
at the same time (else later ones will overwrite the earlier ones) so in
order to have a proper builder pattern we need to wait to build the
query object until we are done adding clauses.

- In addition, encapsulating the query logic in the CriteriaQueryBuilder
class means that we don't need to deal with the complicated Root/Path
branching, otherwise we'd have to keep track of CriteriaQuery and Root
objects everywhere.

- Added a REPLAYED_ENTITIES TransitionId that will represent all
replayed entities, e.g. EppResources. Also sets this, by default, to
always be CLOUD_SQL if we're using the SQL transaction manager in tests.

- Added branching logic in RdapEntitySearchAction based on that transition
ID that determines whether we do the existing ofy query logic or JPA
logic.
This commit is contained in:
gbrodman 2021-03-02 13:13:55 -05:00 committed by GitHub
parent 519cbfb660
commit f78b64d93c
9 changed files with 681 additions and 139 deletions

View file

@ -207,6 +207,9 @@ PRESUBMITS = {
"ForeignKeyIndex.java",
"HistoryEntryDao.java",
"JpaTransactionManagerImpl.java",
# CriteriaQueryBuilder is a false positive
"CriteriaQueryBuilder.java",
"RdapSearchActionBase.java",
},
):
"The first String parameter to EntityManager.create(Native)Query "