Package com.im.df.api.dml
Class Operators.RelativeDateOperator
- java.lang.Object
-
- com.im.df.api.dml.DFOperator
-
- com.im.df.api.dml.Operators.SimpleFieldValuesOperator
-
- com.im.df.api.dml.Operators.RelativeDateOperator
-
- Enclosing class:
- Operators
public static final class Operators.RelativeDateOperator extends Operators.SimpleFieldValuesOperator
Operator for relative date queries. query can be made for implementations ofOperators.RelativeDateOperator.TimePeriod
. This operator is applicable only forDFFieldDateCapability
.- Since:
- 6.4
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Operators.RelativeDateOperator.TimePeriod
Class representing time periods like days, months, years.
When introducing newOperators.RelativeDateOperator.TimePeriod
make a new private static implementation, introduce a public static final field inOperators.RelativeDateOperator.TimePeriod
and add it to theOperators.RelativeDateOperator.TimePeriod.TIME_PERIODS
.
-
Constructor Summary
Constructors Constructor Description RelativeDateOperator()
Constructs new operator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getTooltip(DFTermExpression expr)
java.lang.String
getToStringPart(java.util.List<DFTerm> operands, int index)
Get the part of the completeDFOperator.toString(java.util.List)
method result.static java.lang.Object[]
getValues(java.lang.Object... values)
java.lang.Object[]
parseOperands(DFField field, java.lang.String operands)
static java.lang.String[]
splitOperands(java.lang.String operands)
Returns an array with length of 2 containing the input split into 2 parts after the first integer number in input.static java.util.Date
truncateDate(java.util.Date date)
Converts given input parameterdate
to start of the day (time is 00:00:00.000).static java.util.Date
truncateDateOfNextDay(java.util.Date date)
Converts given input parameterdate
to start of the next day (time is 00:00:00.000).void
validate(DFDataTree dataTree, java.util.List<DFTerm> operands, java.util.Map<java.lang.String,java.lang.Object> options, TermErrors errors)
Validate the operands in context of this operator.-
Methods inherited from class com.im.df.api.dml.Operators.SimpleFieldValuesOperator
getValidFormatMsg, isEmptyStringAllowed, isFieldAcceptableAsOperand
-
Methods inherited from class com.im.df.api.dml.DFOperator
correctNumberOfOperands, getDisplayName, getDisplayNameInExpression, getMaxOperands, getMinOperands, getPersistName, getStartingWith, getStartingWithOperator, toString, toString
-
-
-
-
Method Detail
-
getValues
public static java.lang.Object[] getValues(java.lang.Object... values)
-
truncateDate
public static java.util.Date truncateDate(java.util.Date date)
Converts given input parameterdate
to start of the day (time is 00:00:00.000).- Parameters:
date
- date to convert- Returns:
- converted date
-
truncateDateOfNextDay
public static java.util.Date truncateDateOfNextDay(java.util.Date date)
Converts given input parameterdate
to start of the next day (time is 00:00:00.000).- Parameters:
date
- date to convert- Returns:
- converted date
-
getTooltip
public static java.lang.String getTooltip(DFTermExpression expr)
-
getToStringPart
public java.lang.String getToStringPart(java.util.List<DFTerm> operands, int index)
Description copied from class:DFOperator
Get the part of the completeDFOperator.toString(java.util.List)
method result. This method can be overriden by subclasses so each operator can provide specific form of String representation.For example for binary operator is this method called 3 times: for indexes 0, 1 and 2. The index=0 means it's string before the first operand, index=1 is string between operands and index=2 is after the second operand. For operator LESS_THAN it should return: index=0 => "", index=1 => " less than ", and for index=2 => "".
This method allow subclass to reuse the generic code from
DFOperator.toString(java.util.List)
and change the own notation (e.g. "[molW < 15]" => "[< moW, 15]" etc.).- Overrides:
getToStringPart
in classDFOperator
- Parameters:
operands
- The list of all operandsindex
- The index of String [0..operands.size()]- Returns:
- The indexed part of whole
DFOperator.toString(java.util.List)
method.
-
splitOperands
public static java.lang.String[] splitOperands(java.lang.String operands)
Returns an array with length of 2 containing the input split into 2 parts after the first integer number in input.- Parameters:
operands
- Operands to split.- Returns:
- Array containing operands. Fields can not be null, can be empty;
-
parseOperands
public java.lang.Object[] parseOperands(DFField field, java.lang.String operands) throws java.lang.IllegalArgumentException
- Overrides:
parseOperands
in classOperators.SimpleFieldValuesOperator
- Throws:
java.lang.IllegalArgumentException
-
validate
public void validate(DFDataTree dataTree, java.util.List<DFTerm> operands, java.util.Map<java.lang.String,java.lang.Object> options, TermErrors errors)
Description copied from class:DFOperator
Validate the operands in context of this operator. It's up to operator to decide if it accepts the given operands or not. This method is called fromDFTerm.validate(com.im.df.api.ddl.DFDataTree)
.- Overrides:
validate
in classOperators.SimpleFieldValuesOperator
- Parameters:
dataTree
- The datatree where this operator will be usedoperands
- The list of operandsoptions
- Options of this query term (DFTermExpression.getOptions()
errors
- The errors object which contains the result of the validation
-
-