use of org.jowidgets.cap.common.api.filter.IArithmeticPropertyFilterBuilder in project jo-client-platform by jo-source.
the class UiFilterFactoryImpl method convert.
@Override
public IFilter convert(final IUiFilter uiFilter) {
if (uiFilter instanceof IUiBooleanFilter) {
final IUiBooleanFilter uiBooleanFilter = (IUiBooleanFilter) uiFilter;
final List<IFilter> filters = new LinkedList<IFilter>();
for (final IUiFilter uiF : uiBooleanFilter.getFilters()) {
filters.add(convert(uiF));
}
return CapCommonToolkit.filterFactory().booleanFilter(uiBooleanFilter.getOperator(), filters);
} else if (uiFilter instanceof IUiArithmeticFilter<?>) {
final IUiArithmeticFilter<?> uiArithmeticFilter = (IUiArithmeticFilter<?>) uiFilter;
final IArithmeticFilterBuilder arithmeticFilterBuilder = CapCommonToolkit.filterFactory().arithmeticFilterBuilder();
arithmeticFilterBuilder.setInverted(uiArithmeticFilter.isInverted());
arithmeticFilterBuilder.setOperator(uiArithmeticFilter.getOperator());
arithmeticFilterBuilder.setParameters(uiArithmeticFilter.getParameters());
arithmeticFilterBuilder.setPropertyName(uiArithmeticFilter.getPropertyName());
return arithmeticFilterBuilder.build();
} else if (uiFilter instanceof IUiArithmeticPropertyFilter<?>) {
final IUiArithmeticPropertyFilter<?> uiArithmeticPropertyFilter = (IUiArithmeticPropertyFilter<?>) uiFilter;
final IArithmeticPropertyFilterBuilder arithmeticPropertyFilterBuilder = CapCommonToolkit.filterFactory().arithmeticPropertyFilterBuilder();
arithmeticPropertyFilterBuilder.setInverted(uiArithmeticPropertyFilter.isInverted());
arithmeticPropertyFilterBuilder.setPropertyName(uiArithmeticPropertyFilter.getPropertyName());
arithmeticPropertyFilterBuilder.setOperator(uiArithmeticPropertyFilter.getOperator());
arithmeticPropertyFilterBuilder.setRightHandPropertyNames(uiArithmeticPropertyFilter.getRightHandPropertyNames());
return arithmeticPropertyFilterBuilder.build();
} else if (uiFilter instanceof IUiCustomFilter<?>) {
final IUiCustomFilter<?> uiCustomFilter = (IUiCustomFilter<?>) uiFilter;
final ICustomFilterBuilder customFilterBuilder = CapCommonToolkit.filterFactory().customFilterBuilder();
customFilterBuilder.setFilterType(uiCustomFilter.getFilterType());
customFilterBuilder.setInverted(uiCustomFilter.isInverted());
customFilterBuilder.setOperator(uiCustomFilter.getOperator());
customFilterBuilder.setPropertyName(uiCustomFilter.getPropertyName());
customFilterBuilder.setValue(uiCustomFilter.getValue());
return customFilterBuilder.build();
} else {
throw new IllegalStateException("Cannot convert unkown filter class '" + uiFilter.getClass().getName() + "'.");
}
}
Aggregations