Class QueryBuilderFactoryImpl
java.lang.Object
ch.tocco.nice2.persist.core.impl.qb2.QueryBuilderFactoryImpl
- All Implemented Interfaces:
QueryBuilderFactory
@Component("legacyQueryBuilderFactoryImpl")
@Deprecated
public class QueryBuilderFactoryImpl
extends Object
implements QueryBuilderFactory
Deprecated.
-
Constructor Summary
ConstructorDescriptionQueryBuilderFactoryImpl
(TypeManager typeManager, DataModel dataModel, PersistenceService persistenceService, ConditionFactory conditionFactory, QueryCompiler compiler) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionasPredicate
(Condition condition) compileCondition
(String query) Deprecated.Compiles the given query string and creates a condition to be used to apply to a query builder.compileCondition
(String entityName, String condition) Deprecated.Compiles the given query condition string and creates aCondition
to be used to apply to aQueryBuilder
.compileOrder
(String query) Deprecated.Compiles the given query string and creates a list ofOrder
objects to be used with aQueryBuilder
.boolean
Deprecated.Same asQueryBuilderFactory.evaluate(Condition, Entity, Map)
forwarding an empty parameter map for convenience.boolean
Deprecated.Evaluates the given `condition` against the given entity.Deprecated.Creates a new and emptyQueryBuilder
object to build a query for the given entity model.Deprecated.Same asQueryBuilderFactory.resolve(Entity, Path)
using the model and primary key from the given entity id.Deprecated.Same asQueryBuilderFactory.resolve(Entity, Path)
using the model and primary key from the given entity id.Deprecated.Creates aQueryBuilder
initialized to a query that is deduced from resolving the given relation path against the given source entity.Deprecated.Creates aQueryBuilder
initialized to a query that is deduced from resolving the given relation path against the given source entity.
-
Constructor Details
-
QueryBuilderFactoryImpl
public QueryBuilderFactoryImpl(TypeManager typeManager, @Lazy DataModel dataModel, @Lazy PersistenceService persistenceService, ConditionFactory conditionFactory, @Lazy QueryCompiler compiler) Deprecated.
-
-
Method Details
-
find
Deprecated.Description copied from interface:QueryBuilderFactory
Creates a new and empty
QueryBuilder
object to build a query for the given entity model. The returned object is stateful and cannot be used concurrently by different threads.Conditions are combined by
Junction.Type.AND
.Note, that the returned builder is stateful and is not thread-safe.
- Specified by:
find
in interfaceQueryBuilderFactory
-
resolve
Deprecated.Description copied from interface:QueryBuilderFactory
Creates aQueryBuilder
initialized to a query that is deduced from resolving the given relation path against the given source entity. For example, for a `User` entity and the path `relAddress.relAddress_status`, the query builder will be created with the query `find Address_status where relAddress.relUser.pk=?`. The returnedQueryBuilder
can be used to further constrain the query or add ordering information.- Specified by:
resolve
in interfaceQueryBuilderFactory
-
resolve
Deprecated.Description copied from interface:QueryBuilderFactory
Creates aQueryBuilder
initialized to a query that is deduced from resolving the given relation path against the given source entity. For example, for a `User` entity and the path `relAddress.relAddress_status`, the query builder will be created with the query `find Address_status where relAddress.relUser.pk=?`. The returnedQueryBuilder
can be used to further constrain the query or add ordering information.- Specified by:
resolve
in interfaceQueryBuilderFactory
-
resolve
Deprecated.Description copied from interface:QueryBuilderFactory
Same asQueryBuilderFactory.resolve(Entity, Path)
using the model and primary key from the given entity id.- Specified by:
resolve
in interfaceQueryBuilderFactory
-
resolve
Deprecated.Description copied from interface:QueryBuilderFactory
Same asQueryBuilderFactory.resolve(Entity, Path)
using the model and primary key from the given entity id.- Specified by:
resolve
in interfaceQueryBuilderFactory
-
compileCondition
Deprecated.Description copied from interface:QueryBuilderFactory
Compiles the given query string and creates a condition to be used to apply to a query builder. A full query must be supplied, otherwise an exception is thrown (e.g. if the
where
clause is missing).Note, that an
order by
clause is ignored, obviously.- Specified by:
compileCondition
in interfaceQueryBuilderFactory
- Parameters:
query
- a full query with a where clause, like`find User where firstname == "test"`
- Returns:
- a condition compiled from the where clause of the query
- Throws:
PersistException
-
compileCondition
Deprecated.Description copied from interface:QueryBuilderFactory
Compiles the given query condition string and creates aCondition
to be used to apply to aQueryBuilder
.- Specified by:
compileCondition
in interfaceQueryBuilderFactory
- Parameters:
entityName
- the base entity namecondition
- a query condition`firstname == "test"`
- Returns:
- the compiled condition.
-
compileOrder
Deprecated.Description copied from interface:QueryBuilderFactory
Compiles the given query string and creates a list of
Order
objects to be used with aQueryBuilder
. A full query must be supplied, otherwise an exception is thrown (e.g. if theorder by
clause is missing!).- Specified by:
compileOrder
in interfaceQueryBuilderFactory
- Parameters:
query
- a full query with a order-by clause, like`find User order by firstname, lastname asc`
- Throws:
PersistException
-
evaluate
Deprecated.Description copied from interface:QueryBuilderFactory
Evaluates the given `condition` against the given entity. Returns `true` if the entity would have been returned from a query formed by `condition`, `false` otherwise. The `params` map must contain all parameter values if those are used within the `condition`. Note that subqueries (like `EXISTS` and `COUNT`) and functions (like `fulltext` or `DISTANCE`) are currently *not* supported. `JdbcFunction`s (like `DISTANCE`) can't work anyways as they are directly translated to database calls.- Specified by:
evaluate
in interfaceQueryBuilderFactory
-
evaluate
Deprecated.Description copied from interface:QueryBuilderFactory
Same asQueryBuilderFactory.evaluate(Condition, Entity, Map)
forwarding an empty parameter map for convenience.- Specified by:
evaluate
in interfaceQueryBuilderFactory
-
asPredicate
Deprecated.Description copied from interface:QueryBuilderFactory
Get aPredicate
for the providedCondition
. It can be used, for example to filter a list of previously loadedEntity
s.- Specified by:
asPredicate
in interfaceQueryBuilderFactory
- Parameters:
condition
- aCondition
-