Search in sources :

Example 1 with IArithmeticFilterBuilder

use of org.jowidgets.cap.common.api.filter.IArithmeticFilterBuilder in project jo-client-platform by jo-source.

the class BeanRelationNodeModelImpl method getAddedDataFilter.

private IFilter getAddedDataFilter() {
    if (!EmptyCheck.isEmpty(addedData)) {
        final IArithmeticFilterBuilder builder = CapCommonToolkit.filterFactory().arithmeticFilterBuilder();
        builder.setInverted(true);
        builder.setPropertyName(IBean.ID_PROPERTY);
        builder.setOperator(ArithmeticOperator.CONTAINS_ANY);
        boolean added = false;
        for (final IBeanProxy<CHILD_BEAN_TYPE> addedBean : addedData) {
            if (!addedBean.isDummy() && !addedBean.isTransient()) {
                builder.addParameter(addedBean.getId());
                added = true;
            }
        }
        if (added) {
            return builder.build();
        }
    }
    return null;
}
Also used : IArithmeticFilterBuilder(org.jowidgets.cap.common.api.filter.IArithmeticFilterBuilder)

Example 2 with IArithmeticFilterBuilder

use of org.jowidgets.cap.common.api.filter.IArithmeticFilterBuilder in project jo-client-platform by jo-source.

the class LinkDeleterServiceImpl method createKeyFilter.

private IFilter createKeyFilter(final IBeanKey key, final IEntityLinkProperties linkProperties) {
    final IArithmeticFilterBuilder builder = ArithmeticFilter.builder();
    builder.setPropertyName(linkProperties.getForeignKeyPropertyName());
    builder.setOperator(ArithmeticOperator.EQUAL);
    builder.setParameter(key.getId());
    return builder.build();
}
Also used : IArithmeticFilterBuilder(org.jowidgets.cap.common.api.filter.IArithmeticFilterBuilder)

Example 3 with IArithmeticFilterBuilder

use of org.jowidgets.cap.common.api.filter.IArithmeticFilterBuilder in project jo-client-platform by jo-source.

the class OrderedBeansCrudInterceptorImpl method createOrderNumberNotNullFilter.

private IFilter createOrderNumberNotNullFilter() {
    final IArithmeticFilterBuilder builder = ArithmeticFilter.builder();
    builder.setPropertyName(IOrderedBean.ORDER_NUMBER_PROPERTY);
    builder.setOperator(ArithmeticOperator.EMPTY);
    builder.setInverted(true);
    return builder.build();
}
Also used : IArithmeticFilterBuilder(org.jowidgets.cap.common.api.filter.IArithmeticFilterBuilder)

Example 4 with IArithmeticFilterBuilder

use of org.jowidgets.cap.common.api.filter.IArithmeticFilterBuilder in project jo-client-platform by jo-source.

the class BeanTableModelImpl method getAddedDataFilter.

private IFilter getAddedDataFilter() {
    if (!EmptyCheck.isEmpty(addedData)) {
        final IArithmeticFilterBuilder builder = CapCommonToolkit.filterFactory().arithmeticFilterBuilder();
        builder.setInverted(true);
        builder.setPropertyName(IBean.ID_PROPERTY);
        builder.setOperator(ArithmeticOperator.CONTAINS_ANY);
        boolean added = false;
        for (final IBeanProxy<BEAN_TYPE> addedBean : addedData) {
            if (!addedBean.isDummy() && !addedBean.isTransient()) {
                builder.addParameter(addedBean.getId());
                added = true;
            }
        }
        if (added) {
            return builder.build();
        }
    }
    return null;
}
Also used : IArithmeticFilterBuilder(org.jowidgets.cap.common.api.filter.IArithmeticFilterBuilder)

Example 5 with IArithmeticFilterBuilder

use of org.jowidgets.cap.common.api.filter.IArithmeticFilterBuilder 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() + "'.");
    }
}
Also used : IArithmeticFilterBuilder(org.jowidgets.cap.common.api.filter.IArithmeticFilterBuilder) IUiArithmeticPropertyFilter(org.jowidgets.cap.ui.api.filter.IUiArithmeticPropertyFilter) IUiCustomFilter(org.jowidgets.cap.ui.api.filter.IUiCustomFilter) IUiBooleanFilter(org.jowidgets.cap.ui.api.filter.IUiBooleanFilter) LinkedList(java.util.LinkedList) ICustomFilterBuilder(org.jowidgets.cap.common.api.filter.ICustomFilterBuilder) IFilter(org.jowidgets.cap.common.api.filter.IFilter) IUiFilter(org.jowidgets.cap.ui.api.filter.IUiFilter) IArithmeticPropertyFilterBuilder(org.jowidgets.cap.common.api.filter.IArithmeticPropertyFilterBuilder) IUiArithmeticFilter(org.jowidgets.cap.ui.api.filter.IUiArithmeticFilter)

Aggregations

IArithmeticFilterBuilder (org.jowidgets.cap.common.api.filter.IArithmeticFilterBuilder)5 LinkedList (java.util.LinkedList)1 IArithmeticPropertyFilterBuilder (org.jowidgets.cap.common.api.filter.IArithmeticPropertyFilterBuilder)1 ICustomFilterBuilder (org.jowidgets.cap.common.api.filter.ICustomFilterBuilder)1 IFilter (org.jowidgets.cap.common.api.filter.IFilter)1 IUiArithmeticFilter (org.jowidgets.cap.ui.api.filter.IUiArithmeticFilter)1 IUiArithmeticPropertyFilter (org.jowidgets.cap.ui.api.filter.IUiArithmeticPropertyFilter)1 IUiBooleanFilter (org.jowidgets.cap.ui.api.filter.IUiBooleanFilter)1 IUiCustomFilter (org.jowidgets.cap.ui.api.filter.IUiCustomFilter)1 IUiFilter (org.jowidgets.cap.ui.api.filter.IUiFilter)1