I don't think it can easily be achieved using the current Jspresso version (4.0.7 as of now). The problem is that the code responsible for exploding the comparable scalar properties into a (comparator, min, max) filtering structure is too deeply nested for it to be overridden using dependency injection :
The following method :
protected boolean isPropertyFilterComparable(
IPropertyDescriptor propertyDescriptor) {
return propertyDescriptor instanceof INumberPropertyDescriptor
|| propertyDescriptor instanceof IDatePropertyDescriptor
|| propertyDescriptor instanceof ITimePropertyDescriptor
|| propertyDescriptor instanceof IDurationPropertyDescriptor;
}
is located into the RefQueryComponentDescriptor
class whose instances are constructed at runtime by the BasicQueryComponentDescriptorFactory
but in a private method (i.e. createOrGetQueryComponentDescriptor
). So even if you could inject your own customized instance of BasicQueryComponentDescriptorFactory
, you would have to copy/paste too much code to reach the isPropertyFilterComparable
method.
Since your use case is perfectly valid, I suggest that you create an enhancement request on the Jspresso GitHub.
A little less straightforward but more versatile approach might be to open the various comparable properties (number, date, time and duration) for an extra customization in order to tell Jspresso whether to generate or not the comparator structure when those properties are added in a filter view.
something like :
date 'validityDate', filterComparable:true
But this would require a change in the SJS DSL.