Search in sources :

Example 1 with IBooleanFilterBuilder

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

the class BeanRelationNodeModelImpl method getFilter.

private IFilter getFilter() {
    final IFilter addedDataFilter = getAddedDataFilter();
    if (filters.size() > 0 || addedDataFilter != null) {
        final IBooleanFilterBuilder builder = CapCommonToolkit.filterFactory().booleanFilterBuilder();
        builder.setOperator(BooleanOperator.AND);
        final IUiFilterFactory filterFactory = CapUiToolkit.filterToolkit().filterFactory();
        for (final IUiFilter uiFilter : filters.values()) {
            builder.addFilter(filterFactory.convert(uiFilter));
        }
        if (addedDataFilter != null) {
            builder.addFilter(addedDataFilter);
        }
        return builder.build();
    } else {
        return addedDataFilter;
    }
}
Also used : IBooleanFilterBuilder(org.jowidgets.cap.common.api.filter.IBooleanFilterBuilder) IUiFilterFactory(org.jowidgets.cap.ui.api.filter.IUiFilterFactory) IFilter(org.jowidgets.cap.common.api.filter.IFilter) IUiFilter(org.jowidgets.cap.ui.api.filter.IUiFilter)

Example 2 with IBooleanFilterBuilder

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

the class BeanTableModelImpl method getFilter.

private IFilter getFilter() {
    final IFilter addedDataFilter = getAddedDataFilter();
    if (filters.size() > 0 || addedDataFilter != null) {
        final IBooleanFilterBuilder builder = CapCommonToolkit.filterFactory().booleanFilterBuilder();
        builder.setOperator(BooleanOperator.AND);
        final IUiFilterFactory filterFactory = CapUiToolkit.filterToolkit().filterFactory();
        for (final IUiFilter uiFilter : filters.values()) {
            builder.addFilter(filterFactory.convert(uiFilter));
        }
        if (addedDataFilter != null) {
            builder.addFilter(addedDataFilter);
        }
        return builder.build();
    } else {
        return addedDataFilter;
    }
}
Also used : IBooleanFilterBuilder(org.jowidgets.cap.common.api.filter.IBooleanFilterBuilder) IUiFilterFactory(org.jowidgets.cap.ui.api.filter.IUiFilterFactory) IFilter(org.jowidgets.cap.common.api.filter.IFilter) IUiFilter(org.jowidgets.cap.ui.api.filter.IUiFilter)

Example 3 with IBooleanFilterBuilder

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

the class LinkDeleterServiceImpl method createLinkFilter.

private IFilter createLinkFilter(final IBeanKey sourceKey, final IBeanKey destinationKey) {
    final IBooleanFilterBuilder builder = BooleanFilter.builder();
    builder.setOperator(BooleanOperator.AND);
    builder.addFilter(createKeyFilter(sourceKey, sourceProperties));
    builder.addFilter(createKeyFilter(destinationKey, destinationProperties));
    return builder.build();
}
Also used : IBooleanFilterBuilder(org.jowidgets.cap.common.api.filter.IBooleanFilterBuilder)

Example 4 with IBooleanFilterBuilder

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

the class LinkDeleterServiceImpl method deleteStandardLinks.

private void deleteStandardLinks(final Collection<? extends ILinkDeletion> linksDeletions, final IExecutionCallback executionCallback) {
    final List<IBeanKey> sourceKeys = new LinkedList<IBeanKey>();
    final List<IBeanKey> destinationKeys = new LinkedList<IBeanKey>();
    final IFilterFactory filterFactory = CapCommonToolkit.filterFactory();
    final IBooleanFilterBuilder linkReaderFilterBuilder = filterFactory.booleanFilterBuilder();
    linkReaderFilterBuilder.setOperator(BooleanOperator.OR);
    for (final ILinkDeletion linkDeletion : linksDeletions) {
        final IBeanKey sourceKey = linkDeletion.getSourceKey();
        final IBeanKey destinationKey = linkDeletion.getDestinationKey();
        if (linkDeletion.deleteSource()) {
            sourceKeys.add(sourceKey);
        }
        if (linkDeletion.deleteDestination()) {
            destinationKeys.add(destinationKey);
        }
        linkReaderFilterBuilder.addFilter(createLinkFilter(sourceKey, destinationKey));
        if (symmetric) {
            linkReaderFilterBuilder.addFilter(createLinkFilter(destinationKey, sourceKey));
        }
    }
    if (!linkReaderFilterBuilder.isEmpty()) {
        deleteLinks(linkReaderFilterBuilder.build(), linksDeletions.size() * 10, executionCallback);
    }
    deleteKeys(destinationKeys, linkedDeleterService, executionCallback);
    deleteKeys(sourceKeys, sourceDeleterService, executionCallback);
}
Also used : IBooleanFilterBuilder(org.jowidgets.cap.common.api.filter.IBooleanFilterBuilder) IBeanKey(org.jowidgets.cap.common.api.bean.IBeanKey) IFilterFactory(org.jowidgets.cap.common.api.filter.IFilterFactory) ILinkDeletion(org.jowidgets.cap.common.api.link.ILinkDeletion) LinkedList(java.util.LinkedList)

Example 5 with IBooleanFilterBuilder

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

the class BeanTabFolderModelImpl method getFilter.

private IFilter getFilter() {
    if (filters.size() > 0) {
        final IBooleanFilterBuilder builder = CapCommonToolkit.filterFactory().booleanFilterBuilder();
        builder.setOperator(BooleanOperator.AND);
        final IUiFilterFactory filterFactory = CapUiToolkit.filterToolkit().filterFactory();
        for (final IUiFilter uiFilter : filters.values()) {
            builder.addFilter(filterFactory.convert(uiFilter));
        }
        return builder.build();
    } else {
        return null;
    }
}
Also used : IBooleanFilterBuilder(org.jowidgets.cap.common.api.filter.IBooleanFilterBuilder) IUiFilterFactory(org.jowidgets.cap.ui.api.filter.IUiFilterFactory) IUiFilter(org.jowidgets.cap.ui.api.filter.IUiFilter)

Aggregations

IBooleanFilterBuilder (org.jowidgets.cap.common.api.filter.IBooleanFilterBuilder)5 IUiFilter (org.jowidgets.cap.ui.api.filter.IUiFilter)3 IUiFilterFactory (org.jowidgets.cap.ui.api.filter.IUiFilterFactory)3 IFilter (org.jowidgets.cap.common.api.filter.IFilter)2 LinkedList (java.util.LinkedList)1 IBeanKey (org.jowidgets.cap.common.api.bean.IBeanKey)1 IFilterFactory (org.jowidgets.cap.common.api.filter.IFilterFactory)1 ILinkDeletion (org.jowidgets.cap.common.api.link.ILinkDeletion)1