Class EntityWhereString
java.lang.Object
org.apache.ofbiz.entity.condition.EntityWhereString
- All Implemented Interfaces:
Serializable
,IsEmpty
,EntityCondition
Represents a raw SQL string condition expression.
Encapsulates SQL expressions used for where clause snippets. NOTE: This is UNSAFE and BREAKS the idea behind the Entity Engine where you avoid directly specifying SQL. So, KEEP IT MINIMAL and preferably replace it when the feature you are getting at is implemented in a more automatic way for you.
By minimal I mean use this in conjunction with other EntityConditions like the EntityExpr, EntityConditionList and EntityFieldMap objects which more cleanly encapsulate where conditions and don't require you to directly write SQL.
- See Also:
-
Field Summary
Fields inherited from interface org.apache.ofbiz.entity.condition.EntityCondition
serialVersionUID
-
Constructor Summary
ConstructorDescriptionEntityWhereString
(String sqlString) Constructs a raw SQL string condition expression. -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(EntityConditionVisitor visitor) Applies a visitor to this condition.void
checkCondition
(ModelEntity modelEntity) Verifies that this condition expression is valid.boolean
entityMatches
(GenericEntity entity) Checks that this condition expression matches a particular entity.boolean
freeze()
Create a Frozen condition expression corresponding to this condition expression.Provides access to the embedded raw SQL string.int
hashCode()
boolean
isEmpty()
makeWhereString
(ModelEntity modelEntity, List<EntityConditionParam> entityConditionParams, Datasource datasourceInfo) Dumps the corresponding SQL string.boolean
mapMatches
(Delegator delegator, Map<String, ? extends Object> map) Checks that this condition expression matches a particular entity.toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.ofbiz.entity.condition.EntityCondition
makeWhereString
-
Constructor Details
-
EntityWhereString
Constructs a raw SQL string condition expression.- Parameters:
sqlString
- the raw SQL to embed in a condition expression
-
-
Method Details
-
isEmpty
public boolean isEmpty() -
makeWhereString
public String makeWhereString(ModelEntity modelEntity, List<EntityConditionParam> entityConditionParams, Datasource datasourceInfo) Description copied from interface:EntityCondition
Dumps the corresponding SQL string.- Specified by:
makeWhereString
in interfaceEntityCondition
- Parameters:
modelEntity
- the model of the entityentityConditionParams
- the effective parameters used to substitute '?' parametersdatasourceInfo
- the model of the data source interpreting the SQL- Returns:
- the corresponding SQL string
-
checkCondition
Description copied from interface:EntityCondition
Verifies that this condition expression is valid.- Specified by:
checkCondition
in interfaceEntityCondition
- Parameters:
modelEntity
- the model of the entity- Throws:
GenericModelException
- when this condition expression is not valid
-
entityMatches
Description copied from interface:EntityCondition
Checks that this condition expression matches a particular entity.- Specified by:
entityMatches
in interfaceEntityCondition
- Parameters:
entity
- the entity to match- Returns:
true
if this condition expression matchesentity
-
mapMatches
Description copied from interface:EntityCondition
Checks that this condition expression matches a particular entity.- Specified by:
mapMatches
in interfaceEntityCondition
- Parameters:
delegator
- the delegator used to matchmap
- the entity definition to match- Returns:
true
if this condition expression matchesmap
when usingdelegator
-
getWhereString
Provides access to the embedded raw SQL string.- Returns:
- the corresponding SQL string
-
freeze
Description copied from interface:EntityCondition
Create a Frozen condition expression corresponding to this condition expression.- Specified by:
freeze
in interfaceEntityCondition
- Returns:
- the frozen condition expression
-
accept
Description copied from interface:EntityCondition
Applies a visitor to this condition.- Specified by:
accept
in interfaceEntityCondition
- Parameters:
visitor
- the visitor to be applied
-
equals
-
hashCode
public int hashCode() -
toString
-