Example usage for org.apache.commons.collections4 IterableUtils filteredIterable

List of usage examples for org.apache.commons.collections4 IterableUtils filteredIterable

Introduction

In this page you can find the example usage for org.apache.commons.collections4 IterableUtils filteredIterable.

Prototype

public static <E> Iterable<E> filteredIterable(final Iterable<E> iterable,
        final Predicate<? super E> predicate) 

Source Link

Document

Returns a view of the given iterable that only contains elements matching the provided predicate.

Usage

From source file:org.apache.syncope.client.console.panels.ResourceMappingPanel.java

private List<String> getSchemaNames(final Long connectorId, final Set<ConnConfProperty> conf) {
    final ConnInstanceTO connInstanceTO = new ConnInstanceTO();
    connInstanceTO.setKey(connectorId);/*from  w  ww  .  ja  v  a 2 s .c  o  m*/
    connInstanceTO.getConf().addAll(conf);

    // SYNCOPE-156: use provided info to give schema names (and type!) by ObjectClass
    ConnIdObjectClassTO clazz = IterableUtils.find(connRestClient.buildObjectClassInfo(connInstanceTO, true),
            new Predicate<ConnIdObjectClassTO>() {

                @Override
                public boolean evaluate(final ConnIdObjectClassTO object) {
                    return object.getType()
                            .equalsIgnoreCase(ResourceMappingPanel.this.provisionTO.getObjectClass());
                }
            });

    return clazz == null ? new ArrayList<String>()
            : IterableUtils
                    .toList(IterableUtils.filteredIterable(clazz.getAttributes(), new Predicate<String>() {

                        @Override
                        public boolean evaluate(final String object) {
                            return !("__NAME__".equals(object) || "__ENABLE__".equals(object)
                                    || "__PASSWORD__".equals(object));
                        }
                    }));
}