Class EntityDateFilterCondition
java.lang.Object
org.apache.ofbiz.entity.condition.EntityDateFilterCondition
- All Implemented Interfaces:
Serializable
,IsEmpty
,EntityCondition
Represents Date-range condition expression.
This is used to filter rows that are valid in a particular range.
- See Also:
-
Field Summary
Fields inherited from interface org.apache.ofbiz.entity.condition.EntityCondition
serialVersionUID
-
Constructor Summary
ConstructorDescriptionEntityDateFilterCondition
(String fromDateName, String thruDateName) Constructs a condition expression to filter rows that are currently valid. -
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
freeze()
Create a Frozen condition expression corresponding to this condition expression.int
hashCode()
boolean
isEmpty()
static EntityCondition
makeCondition
(Timestamp moment, String fromDateName, String thruDateName) Constructs a condition expression to filter rows that are valid at a given time stamp.static EntityCondition
makeRangeCondition
(Timestamp rangeStart, Timestamp rangeEnd, String fromDateName, String thruDateName) Creates an EntityCondition representing a date range filter query to be used against entities that themselves represent a date range.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
entityMatches, makeWhereString
-
Constructor Details
-
EntityDateFilterCondition
Constructs a condition expression to filter rows that are currently valid. This means that we remove rows whose from/thru date range does not match the current date. The current date is the one computed when the SQL query is generated.- Parameters:
fromDateName
- the name of the field corresponding to the from datethruDateName
- the name of the field corresponding to the thru date
-
-
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
-
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
-
equals
-
hashCode
public int hashCode() -
accept
Description copied from interface:EntityCondition
Applies a visitor to this condition.- Specified by:
accept
in interfaceEntityCondition
- Parameters:
visitor
- the visitor to be applied
-
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
-
toString
-
makeCondition
public static EntityCondition makeCondition(Timestamp moment, String fromDateName, String thruDateName) Constructs a condition expression to filter rows that are valid at a given time stamp. This means that we remove rows whose from/thru date range does not match the time stamp.- Parameters:
moment
- the time stamp used to check validityfromDateName
- the name of the field corresponding to the from datethruDateName
- the name of the field corresponding to the thru date- Returns:
- a condition expression filtering rows that are currently valid
-
makeRangeCondition
public static EntityCondition makeRangeCondition(Timestamp rangeStart, Timestamp rangeEnd, String fromDateName, String thruDateName) Creates an EntityCondition representing a date range filter query to be used against entities that themselves represent a date range. When used the resulting entities will meet at least one of the following criteria: - fromDate is equal to or after rangeStart but before rangeEnd - thruDate is equal to or after rangeStart but before rangeEnd - fromDate is null and thruDate is equal to or after rangeStart - thruDate is null and fromDate is before rangeEnd - fromDate is null and thruDate is null - fromDate is before rangeStart and thruDate is after rangeEnd- Parameters:
rangeStart
- The start of the range to filter againstrangeEnd
- The end of the range to filter againstfromDateName
- The name of the field containing the entity's "fromDate"thruDateName
- The name of the field containing the entity's "thruDate"- Returns:
- EntityCondition representing the date range filter
-