From bf81bc51fb103cd7ac35318303ed2f041576a758 Mon Sep 17 00:00:00 2001 From: Rob Bygrave Date: Mon, 28 Aug 2023 21:49:33 +1200 Subject: [PATCH] [15x] Remove Named queries, ANTLR, Query language parser --- .../src/main/java/io/ebean/BeanFinder.java | 6 - ebean-api/src/main/java/io/ebean/DB.java | 52 - .../src/main/java/io/ebean/Database.java | 47 - .../main/java/io/ebean/ExpressionFactory.java | 8 - .../main/java/io/ebean/ExpressionList.java | 30 - ebean-api/src/main/java/io/ebean/Finder.java | 7 - ebean-core/pom.xml | 6 - .../server/core/DefaultServer.java | 24 - .../expression/DefaultExpressionFactory.java | 6 - .../expression/DefaultExpressionList.java | 11 - .../server/expression/JunctionExpression.java | 10 - .../server/grammer/EqlAdapter.java | 176 - .../server/grammer/EqlOperator.java | 29 - .../server/grammer/EqlParser.java | 51 - .../server/grammer/EqlValueType.java | 9 - .../server/grammer/EqlWhereAdapter.java | 48 - .../server/grammer/EqlWhereListener.java | 468 --- .../server/grammer/NamedParameter.java | 16 - .../server/grammer/OperatorMapping.java | 57 - .../server/grammer/antlr/EQL.interp | 212 -- .../server/grammer/antlr/EQL.tokens | 146 - .../server/grammer/antlr/EQLBaseListener.java | 579 ---- .../server/grammer/antlr/EQLBaseVisitor.java | 329 -- .../server/grammer/antlr/EQLLexer.interp | 251 -- .../server/grammer/antlr/EQLLexer.java | 374 -- .../server/grammer/antlr/EQLLexer.tokens | 146 - .../server/grammer/antlr/EQLListener.java | 460 --- .../server/grammer/antlr/EQLParser.java | 3046 ----------------- .../server/grammer/antlr/EQLVisitor.java | 283 -- ebean-core/src/main/java/module-info.java | 1 - .../java/io/ebean/typequery/TQAssocBean.java | 36 - .../java/org/querytest/QCustomerTest.java | 4 +- .../ebean/xtest/base/EbeanServer_eqlTest.java | 62 +- .../xtest/internal/api/TDSpiEbeanServer.java | 11 - .../ebean/xtest/internal/api/TDSpiServer.java | 10 - .../server/grammer/EqlParserTest.java | 805 ----- .../model/basic/finder/CustomerFinder.java | 5 +- .../org/tests/query/TestQueryFilterMany.java | 16 +- 38 files changed, 24 insertions(+), 7813 deletions(-) delete mode 100644 ebean-core/src/main/java/io/ebeaninternal/server/grammer/EqlAdapter.java delete mode 100644 ebean-core/src/main/java/io/ebeaninternal/server/grammer/EqlOperator.java delete mode 100644 ebean-core/src/main/java/io/ebeaninternal/server/grammer/EqlParser.java delete mode 100644 ebean-core/src/main/java/io/ebeaninternal/server/grammer/EqlValueType.java delete mode 100644 ebean-core/src/main/java/io/ebeaninternal/server/grammer/EqlWhereAdapter.java delete mode 100644 ebean-core/src/main/java/io/ebeaninternal/server/grammer/EqlWhereListener.java delete mode 100644 ebean-core/src/main/java/io/ebeaninternal/server/grammer/NamedParameter.java delete mode 100644 ebean-core/src/main/java/io/ebeaninternal/server/grammer/OperatorMapping.java delete mode 100644 ebean-core/src/main/java/io/ebeaninternal/server/grammer/antlr/EQL.interp delete mode 100644 ebean-core/src/main/java/io/ebeaninternal/server/grammer/antlr/EQL.tokens delete mode 100644 ebean-core/src/main/java/io/ebeaninternal/server/grammer/antlr/EQLBaseListener.java delete mode 100644 ebean-core/src/main/java/io/ebeaninternal/server/grammer/antlr/EQLBaseVisitor.java delete mode 100644 ebean-core/src/main/java/io/ebeaninternal/server/grammer/antlr/EQLLexer.interp delete mode 100644 ebean-core/src/main/java/io/ebeaninternal/server/grammer/antlr/EQLLexer.java delete mode 100644 ebean-core/src/main/java/io/ebeaninternal/server/grammer/antlr/EQLLexer.tokens delete mode 100644 ebean-core/src/main/java/io/ebeaninternal/server/grammer/antlr/EQLListener.java delete mode 100644 ebean-core/src/main/java/io/ebeaninternal/server/grammer/antlr/EQLParser.java delete mode 100644 ebean-core/src/main/java/io/ebeaninternal/server/grammer/antlr/EQLVisitor.java delete mode 100644 ebean-test/src/test/java/io/ebean/xtest/internal/server/grammer/EqlParserTest.java diff --git a/ebean-api/src/main/java/io/ebean/BeanFinder.java b/ebean-api/src/main/java/io/ebean/BeanFinder.java index f0b8c17ad2..9c7248baac 100644 --- a/ebean-api/src/main/java/io/ebean/BeanFinder.java +++ b/ebean-api/src/main/java/io/ebean/BeanFinder.java @@ -155,10 +155,4 @@ protected Query nativeSql(String nativeSql) { return db().findNative(type, nativeSql); } - /** - * Creates a query using the ORM query language. - */ - protected Query query(String ormQuery) { - return db().createQuery(type, ormQuery); - } } diff --git a/ebean-api/src/main/java/io/ebean/DB.java b/ebean-api/src/main/java/io/ebean/DB.java index b2490232bd..1871e3da03 100644 --- a/ebean-api/src/main/java/io/ebean/DB.java +++ b/ebean-api/src/main/java/io/ebean/DB.java @@ -790,21 +790,6 @@ public static Update createUpdate(Class beanType, String ormUpdate) { return getDefault().createUpdate(beanType, ormUpdate); } - - /** - * Create a named query. - *

- * For RawSql the named query is expected to be in ebean.xml. - * - * @param beanType The type of entity bean - * @param namedQuery The name of the query - * @param The type of entity bean - * @return The query - */ - public static Query createNamedQuery(Class beanType, String namedQuery) { - return getDefault().createNamedQuery(beanType, namedQuery); - } - /** * Create a query for a type of entity bean. *

@@ -824,43 +809,6 @@ public static Query createQuery(Class beanType) { return getDefault().createQuery(beanType); } - /** - * Parse the Ebean query language statement returning the query which can then - * be modified (add expressions, change order by clause, change maxRows, change - * fetch and select paths etc). - *

- *

Example

- *
{@code
-   *
-   *   // Find order additionally fetching the customer, details and details.product name.
-   *
-   *   String eql = "fetch customer fetch details fetch details.product (name) where id = :orderId ";
-   *
-   *   Query query = DB.createQuery(Order.class, eql);
-   *   query.setParameter("orderId", 2);
-   *
-   *   Order order = query.findOne();
-   *
-   *   // This is the same as:
-   *
-   *   Order order = DB.find(Order.class)
-   *     .fetch("customer")
-   *     .fetch("details")
-   *     .fetch("detail.product", "name")
-   *     .setId(2)
-   *     .findOne();
-   *
-   * }
- * - * @param beanType The type of bean to fetch - * @param eql The Ebean query - * @param The type of the entity bean - * @return The query with expressions defined as per the parsed query statement - */ - public static Query createQuery(Class beanType, String eql) { - return getDefault().createQuery(beanType, eql); - } - /** * Create a query for a type of entity bean. *

diff --git a/ebean-api/src/main/java/io/ebean/Database.java b/ebean-api/src/main/java/io/ebean/Database.java index 7c394c3969..076a0b52bf 100644 --- a/ebean-api/src/main/java/io/ebean/Database.java +++ b/ebean-api/src/main/java/io/ebean/Database.java @@ -225,18 +225,6 @@ public interface Database { */ UpdateQuery update(Class beanType); - /** - * Create a named query. - *

- * For RawSql the named query is expected to be in ebean.xml. - * - * @param beanType The type of entity bean - * @param namedQuery The name of the query - * @param The type of entity bean - * @return The query - */ - Query createNamedQuery(Class beanType, String namedQuery); - /** * Create a query for an entity bean and synonym for {@link #find(Class)}. * @@ -244,41 +232,6 @@ public interface Database { */ Query createQuery(Class beanType); - /** - * Parse the Ebean query language statement returning the query which can then - * be modified (add expressions, change order by clause, change maxRows, change - * fetch and select paths etc). - *

- *

Example

- *
{@code
-   *
-   *   // Find order additionally fetching the customer, details and details.product name.
-   *
-   *   String ormQuery = "fetch customer fetch details fetch details.product (name) where id = :orderId ";
-   *
-   *   Query query = DB.createQuery(Order.class, ormQuery);
-   *   query.setParameter("orderId", 2);
-   *
-   *   Order order = query.findOne();
-   *
-   *   // This is the same as:
-   *
-   *   Order order = DB.find(Order.class)
-   *     .fetch("customer")
-   *     .fetch("details")
-   *     .fetch("detail.product", "name")
-   *     .setId(2)
-   *     .findOne();
-   *
-   * }
- * - * @param beanType The type of bean to fetch - * @param ormQuery The Ebean ORM query - * @param The type of the entity bean - * @return The query with expressions defined as per the parsed query statement - */ - Query createQuery(Class beanType, String ormQuery); - /** * Create a query for a type of entity bean. *

diff --git a/ebean-api/src/main/java/io/ebean/ExpressionFactory.java b/ebean-api/src/main/java/io/ebean/ExpressionFactory.java index d8857acbe0..dd30ec96e0 100644 --- a/ebean-api/src/main/java/io/ebean/ExpressionFactory.java +++ b/ebean-api/src/main/java/io/ebean/ExpressionFactory.java @@ -693,12 +693,4 @@ public interface ExpressionFactory { */ Junction junction(Junction.Type type, Query query, ExpressionList parent); - /** - * Add the expressions to the given expression list. - * - * @param where The expression list to add the expressions to - * @param expressions The expressions that are parsed - * @param params Bind parameters to match ? or ?1 bind positions. - */ - void where(ExpressionList where, String expressions, Object[] params); } diff --git a/ebean-api/src/main/java/io/ebean/ExpressionList.java b/ebean-api/src/main/java/io/ebean/ExpressionList.java index 9db4faecfd..5d5f3f1a64 100644 --- a/ebean-api/src/main/java/io/ebean/ExpressionList.java +++ b/ebean-api/src/main/java/io/ebean/ExpressionList.java @@ -507,28 +507,6 @@ default A findSingleAttribute() { */ ExpressionList filterMany(String manyProperty); - /** - * Deprecated for removal - migrate to filterManyRaw() - *

- * Add filter expressions to the many property. - * - *

{@code
-   *
-   *   DB.find(Customer.class)
-   *   .where()
-   *   .eq("name", "Rob")
-   *   .filterMany("orders", "status = ?", Status.NEW)
-   *   .findList();
-   *
-   * }
- * - * @param manyProperty The many property - * @param expressions Filter expressions with and, or and ? or ?1 type bind parameters - * @param params Bind parameters used in the expressions - */ - @Deprecated(forRemoval = true) - ExpressionList filterMany(String manyProperty, String expressions, Object... params); - /** * Add filter expressions for the many path. The expressions can include SQL functions if * desired and the property names are translated to column names. @@ -721,14 +699,6 @@ default Query setUseQueryCache(boolean enabled) { */ ExpressionList where(); - /** - * Add the expressions to this expression list. - * - * @param expressions The expressions that are parsed and added to this expression list - * @param params Bind parameters to match ? or ?1 bind positions. - */ - ExpressionList where(String expressions, Object... params); - /** * Path exists - for the given path in a JSON document. *
{@code
diff --git a/ebean-api/src/main/java/io/ebean/Finder.java b/ebean-api/src/main/java/io/ebean/Finder.java
index 8dd4088fbf..d994f96f02 100644
--- a/ebean-api/src/main/java/io/ebean/Finder.java
+++ b/ebean-api/src/main/java/io/ebean/Finder.java
@@ -213,11 +213,4 @@ public Query nativeSql(String nativeSql) {
     return db().findNative(type, nativeSql);
   }
 
-  /**
-   * Creates a query using the ORM query language.
-   */
-  public Query query(String ormQuery) {
-    return db().createQuery(type, ormQuery);
-  }
-
 }
diff --git a/ebean-core/pom.xml b/ebean-core/pom.xml
index 7827cd4de6..1e9016ecaa 100644
--- a/ebean-core/pom.xml
+++ b/ebean-core/pom.xml
@@ -55,12 +55,6 @@
       13.18.0
     
 
-    
-      org.antlr
-      antlr4-runtime
-      4.8-1
-    
-