Class EntityDateFilterCondition

java.lang.Object
org.apache.ofbiz.entity.condition.EntityDateFilterCondition
All Implemented Interfaces:
Serializable, IsEmpty, EntityCondition

public final class EntityDateFilterCondition extends Object implements EntityCondition
Represents Date-range condition expression.

This is used to filter rows that are valid in a particular range.

See Also:
  • Constructor Details

    • EntityDateFilterCondition

      public EntityDateFilterCondition(String fromDateName, String thruDateName)
      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 date
      thruDateName - the name of the field corresponding to the thru date
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface 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 interface EntityCondition
      Parameters:
      modelEntity - the model of the entity
      entityConditionParams - the effective parameters used to substitute '?' parameters
      datasourceInfo - the model of the data source interpreting the SQL
      Returns:
      the corresponding SQL string
    • checkCondition

      public void checkCondition(ModelEntity modelEntity) throws GenericModelException
      Description copied from interface: EntityCondition
      Verifies that this condition expression is valid.
      Specified by:
      checkCondition in interface EntityCondition
      Parameters:
      modelEntity - the model of the entity
      Throws:
      GenericModelException - when this condition expression is not valid
    • mapMatches

      public boolean mapMatches(Delegator delegator, Map<String,? extends Object> map)
      Description copied from interface: EntityCondition
      Checks that this condition expression matches a particular entity.
      Specified by:
      mapMatches in interface EntityCondition
      Parameters:
      delegator - the delegator used to match
      map - the entity definition to match
      Returns:
      true if this condition expression matches map when using delegator
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • accept

      public void accept(EntityConditionVisitor visitor)
      Description copied from interface: EntityCondition
      Applies a visitor to this condition.
      Specified by:
      accept in interface EntityCondition
      Parameters:
      visitor - the visitor to be applied
    • freeze

      public EntityCondition freeze()
      Description copied from interface: EntityCondition
      Create a Frozen condition expression corresponding to this condition expression.
      Specified by:
      freeze in interface EntityCondition
      Returns:
      the frozen condition expression
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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 validity
      fromDateName - the name of the field corresponding to the from date
      thruDateName - 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 against
      rangeEnd - The end of the range to filter against
      fromDateName - 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